commit d7619777afd806c46823bf80b3e05ec5bd9454d0 Author: Gregory PLANCHAT Date: Tue Jun 7 09:23:48 2011 +0200 Initial commit diff --git a/LICENCE b/LICENCE new file mode 100644 index 0000000..10926e8 --- /dev/null +++ b/LICENCE @@ -0,0 +1,675 @@ + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 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 General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + Copyright (C) + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +. + + The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +. + diff --git a/add_declare.php b/add_declare.php new file mode 100644 index 0000000..c1cc82e --- /dev/null +++ b/add_declare.php @@ -0,0 +1,68 @@ + + * All rights reserved. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + * --> NOTICE <-- + * This file is part of the core development branch, changing its contents will + * make you unable to use the automatic updates manager. Please refer to the + * documentation for further information about customizing XNova. + * + */ + +define('INSIDE' , true); +define('INSTALL' , false); +require_once dirname(__FILE__) .'/common.php'; + + + includeLang('admin'); + + $mode = $_POST['mode']; + + $PageTpl = gettemplate("add_declare"); + $parse = $lang; + + if ($mode == 'addit') { + $declarator = $user['id']; + $declarator_name = addslashes(htmlspecialchars($user['username'])); + $decl1 = addslashes(htmlspecialchars($_POST['dec1'])); + $decl2 = addslashes(htmlspecialchars($_POST['dec2'])); + $decl3 = addslashes(htmlspecialchars($_POST['dec3'])); + $reason1 = addslashes(htmlspecialchars($_POST['reason'])); + + $QryDeclare = "INSERT INTO {{table}} SET "; + $QryDeclare .= "`declarator` = '". $declarator ."', "; + $QryDeclare .= "`declarator_name` = '". $declarator_name ."', "; $QryDeclare .= "`declared_1` = '". $decl1 ."', "; + $QryDeclare .= "`declared_2` = '". $decl2 ."', "; + $QryDeclare .= "`declared_3` = '". $decl3 ."', "; + $QryDeclare .= "`reason` = '". $reason1 ."' "; + + doquery( $QryDeclare, "declared"); + doquery("UPDATE {{table}} SET multi_validated ='1' WHERE username='{$user['username']}'","users"); + + AdminMessage ( "Merci, votre demande a ete prise en compte. Les autres joueurs que vous avez implique doivent egalement et imperativement suivre cette procedure aussi.", "Ajout" ); + } + $Page = parsetemplate($PageTpl, $parse); + + display ($Page, "Declaration d\'IP partagee", false, '', true); + + +?> \ No newline at end of file diff --git a/admin/ElementQueueFixer.php b/admin/ElementQueueFixer.php new file mode 100644 index 0000000..4411b89 --- /dev/null +++ b/admin/ElementQueueFixer.php @@ -0,0 +1,79 @@ + + * All rights reserved. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + * --> NOTICE <-- + * This file is part of the core development branch, changing its contents will + * make you unable to use the automatic updates manager. Please refer to the + * documentation for further information about customizing XNova. + * + */ + +define('INSIDE' , true); +define('INSTALL' , false); +define('IN_ADMIN', true); +require_once dirname(dirname(__FILE__)) .'/common.php'; + + if (in_array($user['authlevel'], array(LEVEL_ADMIN, LEVEL_OPERATOR, LEVEL_MODERATOR))) { + includeLang('admin'); + + $QrySelectPlanet = "SELECT `id`, `id_owner`, `b_hangar`, `b_hangar_id` "; + $QrySelectPlanet .= "FROM {{table}} "; + $QrySelectPlanet .= "WHERE "; + $QrySelectPlanet .= "`b_hangar_id` != '0';"; + $AffectedPlanets = doquery ($QrySelectPlanet, 'planets'); + $DeletedQueues = 0; + while ( $ActualPlanet = mysql_fetch_assoc($AffectedPlanets) ) { + $HangarQueue = explode (";", $ActualPlanet['b_hangar_id']); + $bDelQueue = false; + if (count($HangarQueue)) { + for ( $Queue = 0; $Queue < count($HangarQueue); $Queue++) { + $InQueue = explode (",", $HangarQueue[$Queue]); + if ($InQueue[1] > MAX_FLEET_OR_DEFS_PER_ROW) { + $bDelQueue = true; + } + } + } + if ($bDelQueue) { + $QryUpdatePlanet = "UPDATE {{table}} "; + $QryUpdatePlanet .= "SET "; + $QryUpdatePlanet .= "`b_hangar` = '0', "; + $QryUpdatePlanet .= "`b_hangar_id` = '0' "; + $QryUpdatePlanet .= "WHERE "; + $QryUpdatePlanet .= "`id` = '".$ActualPlanet['id']."';"; + doquery ($QryUpdatePlanet, 'planets'); + $DeletedQueues += 1; + } + } + if ($DeletedQueues > 0) { + $QuitMessage = $lang['adm_cleaned']." ". $DeletedQueues; + } else { + $QuitMessage = $lang['adm_done']; + } + + AdminMessage ($QuitMessage, $lang['adm_cleaner_title']); + + } else { + message( $lang['sys_noalloaw'], $lang['sys_noaccess'] ); + } + +?> \ No newline at end of file diff --git a/admin/QueryExecute.php b/admin/QueryExecute.php new file mode 100644 index 0000000..1ef16cb --- /dev/null +++ b/admin/QueryExecute.php @@ -0,0 +1,59 @@ + + * All rights reserved. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + * --> NOTICE <-- + * This file is part of the core development branch, changing its contents will + * make you unable to use the automatic updates manager. Please refer to the + * documentation for further information about customizing XNova. + * + */ + +define('INSIDE' , true); +define('INSTALL' , false); +define('IN_ADMIN', true); +require_once dirname(dirname(__FILE__)) .'/common.php'; + + if (in_array($user['authlevel'], array(LEVEL_ADMIN))) { + includeLang('admin/Queries'); + + $parse = $lang; + + if ($_POST['really_do_it'] == 'on') { + + mysql_query ($_POST['qry_sql']); + AdminMessage ($lang['qry_succesful'], 'Succes', '?'); + + } else { + + + } + + $PageTpl = gettemplate("admin/exec_query"); + $Page = parsetemplate( $PageTpl, $parse); + + display( $Page, $lang['qry_title'], false, '', true ); + } else { + message( $lang['sys_noalloaw'], $lang['sys_noaccess'] ); + } + +?> \ No newline at end of file diff --git a/admin/ShowFlyingFleets.php b/admin/ShowFlyingFleets.php new file mode 100644 index 0000000..9d66c27 --- /dev/null +++ b/admin/ShowFlyingFleets.php @@ -0,0 +1,50 @@ + + * All rights reserved. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + * --> NOTICE <-- + * This file is part of the core development branch, changing its contents will + * make you unable to use the automatic updates manager. Please refer to the + * documentation for further information about customizing XNova. + * + */ + +define('INSIDE' , true); +define('INSTALL' , false); +define('IN_ADMIN', true); +require_once dirname(dirname(__FILE__)) .'/common.php'; + + if (in_array($user['authlevel'], array(LEVEL_ADMIN, LEVEL_OPERATOR, LEVEL_MODERATOR))) { + includeLang('admin/fleets'); + $PageTPL = gettemplate('admin/fleet_body'); + + $parse = $lang; + $parse['flt_table'] = BuildFlyingFleetTable (); + + $page = parsetemplate( $PageTPL, $parse ); + display ( $page, $lang['flt_title'], false, '', true); + + } else { + AdminMessage ( $lang['sys_noalloaw'], $lang['sys_noaccess'] ); + } + +?> \ No newline at end of file diff --git a/admin/XNovaResetUnivers.php b/admin/XNovaResetUnivers.php new file mode 100644 index 0000000..bf64d50 --- /dev/null +++ b/admin/XNovaResetUnivers.php @@ -0,0 +1,138 @@ + + * All rights reserved. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + * --> NOTICE <-- + * This file is part of the core development branch, changing its contents will + * make you unable to use the automatic updates manager. Please refer to the + * documentation for further information about customizing XNova. + * + */ + +define('INSIDE' , true); +define('INSTALL' , false); +define('IN_ADMIN', true); +require_once dirname(dirname(__FILE__)) .'/common.php'; + +includeLang('admin'); + +function XNovaResetUnivers ( $CurrentUser ) { + global $lang; + + if (in_array($CurrentUser['authlevel'], array(LEVEL_ADMIN))) { + + // Copier la table users et planets vers des tables de replis ! + doquery( "RENAME TABLE {{table}} TO {{table}}_s", 'planets'); + doquery( "RENAME TABLE {{table}} TO {{table}}_s", 'users'); + doquery( "RENAME TABLE {{table}} TO {{table}}_s", 'galaxy'); + doquery( "RENAME TABLE {{table}} TO {{table}}_s", 'banned'); + + // Recreer la structure des tables renommées + doquery( "CREATE TABLE IF NOT EXISTS {{table}} ( LIKE {{table}}_s );", 'planets'); + doquery( "CREATE TABLE IF NOT EXISTS {{table}} ( LIKE {{table}}_s );", 'users'); + doquery( "CREATE TABLE IF NOT EXISTS {{table}} ( LIKE {{table}}_s );", 'galaxy'); + doquery( "CREATE TABLE IF NOT EXISTS {{table}} ( LIKE {{table}}_s );", 'banned'); + + // Vider toutes les tables ! + doquery( "TRUNCATE TABLE {{table}}", 'aks'); + doquery( "TRUNCATE TABLE {{table}}", 'alliance'); + doquery( "TRUNCATE TABLE {{table}}", 'annonce'); + doquery( "TRUNCATE TABLE {{table}}", 'banned'); + doquery( "TRUNCATE TABLE {{table}}", 'buddy'); + doquery( "TRUNCATE TABLE {{table}}", 'chat'); + doquery( "TRUNCATE TABLE {{table}}", 'galaxy'); + doquery( "TRUNCATE TABLE {{table}}", 'errors'); + doquery( "TRUNCATE TABLE {{table}}", 'fleets'); + doquery( "TRUNCATE TABLE {{table}}", 'iraks'); + doquery( "TRUNCATE TABLE {{table}}", 'lunas'); + doquery( "TRUNCATE TABLE {{table}}", 'messages'); + doquery( "TRUNCATE TABLE {{table}}", 'notes'); + doquery( "TRUNCATE TABLE {{table}}", 'rw'); + doquery( "TRUNCATE TABLE {{table}}", 'statpoints'); + + $AllUsers = doquery ("SELECT `username`,`password`,`email`, `email_2`,`authlevel`,`galaxy`,`system`,`planet`, `sex`, `dpath`, `onlinetime`, `register_time`, `id_planet` FROM {{table}} WHERE 1;", 'users_s'); + $LimitTime = time() - (15 * (24 * (60 * 60))); + $TransUser = 0; + while ( $TheUser = mysql_fetch_assoc($AllUsers) ) { + if ( $TheUser['onlinetime'] > $LimitTime ) { + $UserPlanet = doquery ("SELECT `name` FROM {{table}} WHERE `id` = '". $TheUser['id_planet']."';", 'planets_s', true); + if ($UserPlanet['name'] != "") { + // Creation de l'utilisateur + $QryInsertUser = "INSERT INTO {{table}} SET "; + $QryInsertUser .= "`username` = '". $TheUser['username'] ."', "; + $QryInsertUser .= "`email` = '". $TheUser['email'] ."', "; + $QryInsertUser .= "`email_2` = '". $TheUser['email_2'] ."', "; + $QryInsertUser .= "`sex` = '". $TheUser['sex'] ."', "; + $QryInsertUser .= "`id_planet` = '0', "; + $QryInsertUser .= "`authlevel` = '". $TheUser['authlevel'] ."', "; + $QryInsertUser .= "`dpath` = '". $TheUser['dpath'] ."', "; + $QryInsertUser .= "`galaxy` = '". $TheUser['galaxy'] ."', "; + $QryInsertUser .= "`system` = '". $TheUser['system'] ."', "; + $QryInsertUser .= "`planet` = '". $TheUser['planet'] ."', "; + $QryInsertUser .= "`register_time` = '". $TheUser['register_time'] ."', "; + $QryInsertUser .= "`password` = '". $TheUser['password'] ."';"; + doquery( $QryInsertUser, 'users'); + + // On cherche le numero d'enregistrement de l'utilisateur fraichement cr�� + $NewUser = doquery("SELECT `id` FROM {{table}} WHERE `username` = '". $TheUser['username'] ."' LIMIT 1;", 'users', true); + + CreateOnePlanetRecord ($TheUser['galaxy'], $TheUser['system'], $TheUser['planet'], $NewUser['id'], $UserPlanet['name'], true); + // Recherche de la reference de la nouvelle planete (qui est unique normalement ! + $PlanetID = doquery("SELECT `id` FROM {{table}} WHERE `id_owner` = '". $NewUser['id'] ."' LIMIT 1;", 'planets', true); + + // Mise a jour de l'enregistrement utilisateur avec les infos de sa planete mere + $QryUpdateUser = "UPDATE {{table}} SET "; + $QryUpdateUser .= "`id_planet` = '". $PlanetID['id'] ."', "; + $QryUpdateUser .= "`current_planet` = '". $PlanetID['id'] ."' "; + $QryUpdateUser .= "WHERE "; + $QryUpdateUser .= "`id` = '". $NewUser['id'] ."';"; + doquery( $QryUpdateUser, 'users'); + $TransUser++; + } + } + } // while + // Mise a jour du nombre de joueurs inscripts + doquery("UPDATE {{table}} SET `config_value` = '". $TransUser ."' WHERE `config_name` = 'users_amount' LIMIT 1;", 'config'); + + // Menage on vire les tables transitoires + doquery("DROP TABLE {{table}}", 'planets_s'); + doquery("DROP TABLE {{table}}", 'users_s'); + + AdminMessage ( $TransUser . $lang['adm_rz_done'], $lang['adm_rz_ttle'] ); + } else { + AdminMessage ( $lang['sys_noalloaw'], $lang['sys_noaccess'] ); + } + return $Page; +} + + $mode = $_POST['mode']; + $PageTpl = gettemplate("admin/reset_body"); + $parse = $lang; + + if ($mode == 'reset') { + XNovaResetUnivers ( $user ); + } else { + $Page = parsetemplate($PageTpl, $parse); + display ($Page, $lang['Reset'], false, '', true); + } + +?> \ No newline at end of file diff --git a/admin/activeplanet.php b/admin/activeplanet.php new file mode 100644 index 0000000..ec28086 --- /dev/null +++ b/admin/activeplanet.php @@ -0,0 +1,66 @@ + + * All rights reserved. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + * --> NOTICE <-- + * This file is part of the core development branch, changing its contents will + * make you unable to use the automatic updates manager. Please refer to the + * documentation for further information about customizing XNova. + * + */ + +define('INSIDE' , true); +define('INSTALL' , false); +define('IN_ADMIN', true); +require_once dirname(dirname(__FILE__)) .'/common.php'; + + if (in_array($user['authlevel'], array(LEVEL_ADMIN, LEVEL_OPERATOR))) { + includeLang('admin'); + + $parse = $lang; + $parse['dpath'] = $dpath; + $parse['mf'] = $mf; + + $PageTPL = gettemplate('admin/activeplanet_body'); + $AllActivPlanet = doquery("SELECT * FROM {{table}} WHERE `last_update` >= '". (time()-15 * 60) ."' ORDER BY `id` ASC", 'planets'); + $Count = 0; + + while ($ActivPlanet = mysql_fetch_array($AllActivPlanet)) { + $parse['online_list'] .= ""; + $parse['online_list'] .= "
". $ActivPlanet['name'] ."
"; + $parse['online_list'] .= "
[". $ActivPlanet['galaxy'] .":". $ActivPlanet['system'] .":". $ActivPlanet['planet'] ."]
"; + $parse['online_list'] .= "
". pretty_number($ActivPlanet['points'] / 1000) ."
"; + $parse['online_list'] .= "
". pretty_time(time() - $ActivPlanet['last_update']) . "
"; + $parse['online_list'] .= ""; + $Count++; + } + $parse['online_list'] .= ""; + $parse['online_list'] .= "". $lang['adm_pl_they'] ." ". $Count ." ". $lang['adm_pl_apla'] .""; + $parse['online_list'] .= ""; + + $page = parsetemplate( $PageTPL , $parse ); + display( $page, $lang['adm_pl_title'], false, '', true ); + } else { + message( $lang['sys_noalloaw'], $lang['sys_noaccess'] ); + } + +?> \ No newline at end of file diff --git a/admin/add_fleet.php b/admin/add_fleet.php new file mode 100644 index 0000000..dc03f9c --- /dev/null +++ b/admin/add_fleet.php @@ -0,0 +1,101 @@ + + * All rights reserved. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + * --> NOTICE <-- + * This file is part of the core development branch, changing its contents will + * make you unable to use the automatic updates manager. Please refer to the + * documentation for further information about customizing XNova. + * + */ + +define('INSIDE' , true); +define('INSTALL' , false); +define('IN_ADMIN', true); +require_once dirname(dirname(__FILE__)) .'/common.php'; + + if ($user['authlevel'] >= 1) { + includeLang('admin/add_fleet'); + $mode = $_GET['mode']; + + if($mode != 'add') { + $parse['ID'] = $lang['Id']; + $parse['Cle'] = $lang['cle']; + $parse['Clourd'] = $lang['clourd']; + $parse['Pt'] = $lang['pt']; + $parse['Gt'] = $lang['gt']; + $parse['Cruise'] = $lang['cruise']; + $parse['Vb'] = $lang['vb']; + $parse['Colo'] = $lang['colo']; + $parse['Rc'] = $lang['rc']; + $parse['Spy'] = $lang['spy']; + $parse['Bomb'] = $lang['bomb']; + $parse['Solar'] = $lang['solar']; + $parse['Des'] = $lang['des']; + $parse['Rip'] = $lang['rip']; + $parse['Traq'] = $lang['traq']; + + } elseif($mode == 'add') { + $id = $_POST['id']; + $cle = $_POST['cle']; + $clourd = $_POST['clourd']; + $pt = $_POST['pt']; + $gt = $_POST['gt']; + $cruise = $_POST['cruise']; + $vb = $_POST['vb']; + $colo = $_POST['colo']; + $rc = $_POST['rc']; + $spy = $_POST['spy']; + $bomb = $_POST['bomb']; + $solar = $_POST['solar']; + $des = $_POST['des']; + $rip = $_POST['rip']; + $traq = $_POST['traq']; + + $SqlAdd = "UPDATE {{table}} SET"; + $SqlAdd .= "`light_hunter` = '".$cle."+light_hunter', "; + $SqlAdd .= "`heavy_hunter` = '".$clourd."+heavy_hunter', "; + $SqlAdd .= "`small_ship_cargo` = '".$pt."+small_ship_cargo', "; + $SqlAdd .= "`big_ship_cargo` = '".$gt."+big_ship_cargo', "; + $SqlAdd .= "`crusher` = '".$cruise."+crusher', "; + $SqlAdd .= "`battle_ship` = '".$vb."+battle_ship', "; + $SqlAdd .= "`colonizer` = '".$colo."+colonizer', "; + $SqlAdd .= "`recycler` = '".$rc."+recycler', "; + $SqlAdd .= "`spy_sonde`= '".$spy."+spy_sonde', "; + $SqlAdd .= "`bomber_ship` = '".$bomb."+bomber_ship', "; + $SqlAdd .= "`solar_satelit` = '".$solar."+solar_satelit', "; + $SqlAdd .= "`destructor` = '".$des."+destructor', "; + $SqlAdd .= "`dearth_star` = '".$rip."+dearth_star', "; + $SqlAdd .= "`battleship` = '".$traq."+battleship', "; + $SqlAdd .= " WHERE `id` = '".$id."' LIMIT 1"; + doquery($SqlAdd, "planets"); + message('Ajout OK'); + } + + $page = parsetemplate(gettemplate('admin/add_fleet'), $parse); + display( $page); + + } else { + message( $lang['sys_noalloaw'], $lang['sys_noaccess'] ); + } + +?> \ No newline at end of file diff --git a/admin/add_money.php b/admin/add_money.php new file mode 100644 index 0000000..87beb94 --- /dev/null +++ b/admin/add_money.php @@ -0,0 +1,67 @@ + + * All rights reserved. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + * --> NOTICE <-- + * This file is part of the core development branch, changing its contents will + * make you unable to use the automatic updates manager. Please refer to the + * documentation for further information about customizing XNova. + * + */ + +define('INSIDE' , true); +define('INSTALL' , false); +define('IN_ADMIN', true); +require_once dirname(dirname(__FILE__)) .'/common.php'; + + if (in_array($user['authlevel'], array(LEVEL_ADMIN, LEVEL_OPERATOR))) { + includeLang('admin'); + + $mode = $_POST['mode']; + + $PageTpl = gettemplate("admin/add_money"); + $parse = $lang; + + if ($mode == 'addit') { + $id = $_POST['id']; + $metal = $_POST['metal']; + $cristal = $_POST['cristal']; + $deut = $_POST['deut']; + + $QryUpdatePlanet = "UPDATE {{table}} SET "; + $QryUpdatePlanet .= "`metal` = `metal` + '". $metal ."', "; + $QryUpdatePlanet .= "`crystal` = `crystal` + '". $cristal ."', "; + $QryUpdatePlanet .= "`deuterium` = `deuterium` + '". $deut ."' "; + $QryUpdatePlanet .= "WHERE "; + $QryUpdatePlanet .= "`id` = '". $id ."' "; + doquery( $QryUpdatePlanet, "planets"); + + AdminMessage ( $lang['adm_am_done'], $lang['adm_am_ttle'] ); + } + $Page = parsetemplate($PageTpl, $parse); + + display ($Page, $lang['adm_am_ttle'], false, '', true); + } else { + AdminMessage ( $lang['sys_noalloaw'], $lang['sys_noaccess'] ); + } + +?> \ No newline at end of file diff --git a/admin/add_moon.php b/admin/add_moon.php new file mode 100644 index 0000000..f2f220f --- /dev/null +++ b/admin/add_moon.php @@ -0,0 +1,69 @@ + + * All rights reserved. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + * --> NOTICE <-- + * This file is part of the core development branch, changing its contents will + * make you unable to use the automatic updates manager. Please refer to the + * documentation for further information about customizing XNova. + * + */ + +define('INSIDE' , true); +define('INSTALL' , false); +define('IN_ADMIN', true); +require_once dirname(dirname(__FILE__)) .'/common.php'; + + if (in_array($user['authlevel'], array(LEVEL_ADMIN, LEVEL_OPERATOR))) { + includeLang('admin/addmoon'); + + $mode = $_POST['mode']; + + $PageTpl = gettemplate("admin/add_moon"); + $parse = $lang; + + if ($mode == 'addit') { + $PlanetID = $_POST['user']; + $MoonName = $_POST['name']; + + $QrySelectPlanet = "SELECT * FROM {{table}} "; + $QrySelectPlanet .= "WHERE "; + $QrySelectPlanet .= "`id` = '". $PlanetID ."';"; + $PlanetSelected = doquery ( $QrySelectPlanet, 'planets', true); + + $Galaxy = $PlanetSelected['galaxy']; + $System = $PlanetSelected['system']; + $Planet = $PlanetSelected['planet']; + $Owner = $PlanetSelected['id_owner']; + $MoonID = time(); + + CreateOneMoonRecord ( $Galaxy, $System, $Planet, $Owner, $MoonID, $MoonName, 20 ); + + AdminMessage ( $lang['addm_done'], $lang['addm_title'] ); + } + $Page = parsetemplate($PageTpl, $parse); + + display ($Page, $lang['addm_title'], false, '', true); + } else { + AdminMessage ( $lang['sys_noalloaw'], $lang['sys_noaccess'] ); + } +?> \ No newline at end of file diff --git a/admin/autounban.php b/admin/autounban.php new file mode 100644 index 0000000..fae8ef9 --- /dev/null +++ b/admin/autounban.php @@ -0,0 +1,48 @@ + + * All rights reserved. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + * --> NOTICE <-- + * This file is part of the core development branch, changing its contents will + * make you unable to use the automatic updates manager. Please refer to the + * documentation for further information about customizing XNova. + * + */ + +define('INSIDE' , true); +define('INSTALL' , false); +define('IN_ADMIN', true); +require_once dirname(dirname(__FILE__)) .'/common.php'; + + if (in_array($user['authlevel'], array(LEVEL_ADMIN))) { + $lang['PHP_SELF'] = 'options.'.PHPEXT; + doquery("UPDATE {{table}} SET `banaday` =` banaday` - '1' WHERE `banaday` != '0';",'users'); + doquery("UPDATE {{table}} SET `bana` = '0' WHERE `banaday` < '1';",'users'); + $parse = $gameConfig; + $parse['dpath'] = $dpath; + $parse['debug'] = ($gameConfig['debug'] == 1) ? " checked='checked'/":''; + } else { + message ( $lang['sys_noalloaw'], $lang['sys_noaccess'] ); + } + +?> + diff --git a/admin/banned.php b/admin/banned.php new file mode 100644 index 0000000..9867ced --- /dev/null +++ b/admin/banned.php @@ -0,0 +1,89 @@ + + * All rights reserved. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + * --> NOTICE <-- + * This file is part of the core development branch, changing its contents will + * make you unable to use the automatic updates manager. Please refer to the + * documentation for further information about customizing XNova. + * + */ + +define('INSIDE' , true); +define('INSTALL' , false); +define('IN_ADMIN', true); +require_once dirname(dirname(__FILE__)) .'/common.php'; + + if (in_array($user['authlevel'], array(LEVEL_ADMIN, LEVEL_OPERATOR, LEVEL_MODERATOR))) { + includeLang('admin'); + + $mode = $_POST['mode']; + + $PageTpl = gettemplate("admin/banned"); + + $parse = $lang; + if ($mode == 'banit') { + $name = $_POST['name']; + $reas = $_POST['why']; + $days = $_POST['days']; + $hour = $_POST['hour']; + $mins = $_POST['mins']; + $secs = $_POST['secs']; + + $admin = $user['username']; + $mail = $user['email']; + + $Now = time(); + $BanTime = $days * 86400; + $BanTime += $hour * 3600; + $BanTime += $mins * 60; + $BanTime += $secs; + $BannedUntil = $Now + $BanTime; + + $QryInsertBan = "INSERT INTO {{table}} SET "; + $QryInsertBan .= "`who` = \"". $name ."\", "; + $QryInsertBan .= "`theme` = '". $reas ."', "; + $QryInsertBan .= "`who2` = '". $name ."', "; + $QryInsertBan .= "`time` = '". $Now ."', "; + $QryInsertBan .= "`longer` = '". $BannedUntil ."', "; + $QryInsertBan .= "`author` = '". $admin ."', "; + $QryInsertBan .= "`email` = '". $mail ."';"; + doquery( $QryInsertBan, 'banned'); + + $QryUpdateUser = "UPDATE {{table}} SET "; + $QryUpdateUser .= "`bana` = '1', "; + $QryUpdateUser .= "`banaday` = '". $BannedUntil ."' "; + $QryUpdateUser .= "WHERE "; + $QryUpdateUser .= "`username` = \"". $name ."\";"; + doquery( $QryUpdateUser, 'users'); + + $DoneMessage = $lang['adm_bn_thpl'] ." ". $name ." ". $lang['adm_bn_isbn']; + AdminMessage ($DoneMessage, $lang['adm_bn_ttle']); + } + + $Page = parsetemplate($PageTpl, $parse); + display( $Page, $lang['adm_bn_ttle'], false, '', true); + } else { + AdminMessage ($lang['sys_noalloaw'], $lang['sys_noaccess']); + } + +?> \ No newline at end of file diff --git a/admin/changelog.php b/admin/changelog.php new file mode 100644 index 0000000..abca21c --- /dev/null +++ b/admin/changelog.php @@ -0,0 +1,56 @@ + + * All rights reserved. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + * --> NOTICE <-- + * This file is part of the core development branch, changing its contents will + * make you unable to use the automatic updates manager. Please refer to the + * documentation for further information about customizing XNova. + * + */ + +define('INSIDE' , true); +define('INSTALL' , false); +define('IN_ADMIN', true); +require_once dirname(dirname(__FILE__)) .'/common.php'; +includeLang('changelog'); +$template = gettemplate('changelog_table'); + +$parse = $lang; + +foreach($lang['changelog'] as $a => $b) +{ + + $parse['version_number'] = $a; + $parse['description'] = nl2br($b); + + $body .= parsetemplate($template, $parse); + +} + +$parse['body'] = $body; + +$page .= parsetemplate(gettemplate('changelog_body'), $parse); + +display( $page, "Changelog", false, '', true); + +?> \ No newline at end of file diff --git a/admin/chat.php b/admin/chat.php new file mode 100644 index 0000000..fd85732 --- /dev/null +++ b/admin/chat.php @@ -0,0 +1,66 @@ + + * All rights reserved. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + * --> NOTICE <-- + * This file is part of the core development branch, changing its contents will + * make you unable to use the automatic updates manager. Please refer to the + * documentation for further information about customizing XNova. + * + */ + +define('INSIDE' , true); +define('INSTALL' , false); +define('IN_ADMIN', true); +require_once dirname(dirname(__FILE__)) .'/common.php'; +includeLang('admin'); +$parse = $lang; + + if (in_array($user['authlevel'], array(LEVEL_ADMIN))) { + + // Système de suppression + extract($_GET); + if (isset($delete)) { + doquery("DELETE FROM {{table}} WHERE `messageid`=$delete", 'chat'); + } elseif ($deleteall == 'yes') { + doquery("DELETE FROM {{table}}", 'chat'); + } + + // Affichage des messages + $query = doquery("SELECT * FROM {{table}} ORDER BY messageid DESC LIMIT 25", 'chat'); + $i = 0; + while ($e = mysql_fetch_array($query)) { + $i++; + $parse['msg_list'] .= stripslashes("" . date('h:i:s', $e['timestamp']) . "". + "". $e['user'] . "". + "" . nl2br($e['message']) . "". + ""); + } + $parse['msg_list'] .= "{$i} ".$lang['adm_ch_nbs'].""; + + display(parsetemplate(gettemplate('admin/chat_body'), $parse), "Chat", false, '', true); + + } else { + message( $lang['sys_noalloaw'], $lang['sys_noaccess'] ); + } + +?> \ No newline at end of file diff --git a/admin/credit.php b/admin/credit.php new file mode 100644 index 0000000..8eef023 --- /dev/null +++ b/admin/credit.php @@ -0,0 +1,73 @@ + + * All rights reserved. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + * --> NOTICE <-- + * This file is part of the core development branch, changing its contents will + * make you unable to use the automatic updates manager. Please refer to the + * documentation for further information about customizing XNova. + * + */ + +define('INSIDE' , true); +define('INSTALL' , false); +define('IN_ADMIN', true); +require_once dirname(dirname(__FILE__)) .'/common.php'; +includeLang('credit'); +$parse = $lang; + +if (in_array($user['authlevel'], array(LEVEL_ADMIN))) { + if ($_POST['opt_save'] == "1") { + // Extended copyright is activated? + if (isset($_POST['ExtCopyFrame']) && $_POST['ExtCopyFrame'] == 'on') { + $gameConfig['ExtCopyFrame'] = "1"; + $gameConfig['ExtCopyOwner'] = $_POST['ExtCopyOwner']; + $gameConfig['ExtCopyFunct'] = $_POST['ExtCopyFunct']; + } else { + $gameConfig['ExtCopyFrame'] = "0"; + $gameConfig['ExtCopyOwner'] = ""; + $gameConfig['ExtCopyFunct'] = ""; + } + + // Update values + doquery("UPDATE {{table}} SET `config_value` = '". $gameConfig['ExtCopyFrame'] ."' WHERE `config_name` = 'ExtCopyFrame';", 'config'); + doquery("UPDATE {{table}} SET `config_value` = '". $gameConfig['ExtCopyOwner'] ."' WHERE `config_name` = 'ExtCopyOwner';", 'config'); + doquery("UPDATE {{table}} SET `config_value` = '". $gameConfig['ExtCopyFunct'] ."' WHERE `config_name` = 'ExtCopyFunct';", 'config'); + + AdminMessage ($lang['cred_done'], $lang['cred_ext']); + + } else { + //View values + $parse['ExtCopyFrame'] = ($gameConfig['ExtCopyFrame'] == 1) ? " checked = 'checked' ":""; + $parse['ExtCopyOwnerVal'] = $gameConfig['ExtCopyOwner']; + $parse['ExtCopyFunctVal'] = $gameConfig['ExtCopyFunct']; + + $BodyTPL = gettemplate('admin/credit_body'); + $page = parsetemplate($BodyTPL, $parse); + display($page, $lang['cred_credit'], false); + } + +} else { + message( $lang['sys_noalloaw'], $lang['sys_noaccess'] ); +} + +?> \ No newline at end of file diff --git a/admin/declare_list.php b/admin/declare_list.php new file mode 100644 index 0000000..0927ccd --- /dev/null +++ b/admin/declare_list.php @@ -0,0 +1,84 @@ + + * All rights reserved. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + * --> NOTICE <-- + * This file is part of the core development branch, changing its contents will + * make you unable to use the automatic updates manager. Please refer to the + * documentation for further information about customizing XNova. + * + */ + +define('INSIDE' , true); +define('INSTALL' , false); +define('IN_ADMIN', true); +require_once dirname(dirname(__FILE__)) .'/common.php'; + + if (in_array($user['authlevel'], array(LEVEL_ADMIN, LEVEL_OPERATOR))) { + includeLang('admin'); + if ($_GET['cmd'] == 'dele') { + DeleteSelectedUser ( $_GET['user'] ); + } + if ($_GET['cmd'] == 'sort') { + $TypeSort = $_GET['type']; + } else { + $TypeSort = "id"; + } + + $PageTPL = gettemplate('admin/declarelist_body'); + $RowsTPL = gettemplate('admin/declarelist_rows'); + + $query = doquery("SELECT * FROM {{table}} ORDER BY `declarator` DESC", 'declared'); + + $parse = $lang; + $parse['adm_ul_table'] = ""; + $i = 0; + $Color = "lime"; + while ($u = mysql_fetch_assoc ($query) ) { + if ($PrevIP != "") { + if ($PrevIP == $u['declarator']) { + $Color = "red"; + } else { + $Color = "lime"; + } + } + $Bloc['adm_ul_data_id'] = stripslashes($u['declarator_name']); + $Bloc['adm_ul_data_name'] = stripslashes($u['declarator']); + $Bloc['adm_ul_data_mail'] = stripslashes($u['declared_1']); + $Bloc['adm_ul_data_adip'] = stripslashes($u['declared_2']); + $Bloc['adm_ul_data_detai'] = stripslashes($u['declared_3']); + $Bloc['adm_ul_data_regd'] = stripslashes($u['reason']); + + + $parse['adm_ul_table'] .= parsetemplate( $RowsTPL, $Bloc ); + $i++; + } + $parse['adm_ul_count'] = $i; + + $page = parsetemplate( $PageTPL, $parse ); + display( $page, "Liste des joueurs ayant declare une IP collective", false, '', true); + } else { + message( $lang['sys_noalloaw'], $lang['sys_noaccess'] ); + } + +// Created by e-Zobar. All rights reversed (C) XNova Team 2008 +?> \ No newline at end of file diff --git a/admin/deletuser.php b/admin/deletuser.php new file mode 100644 index 0000000..5bbfecd --- /dev/null +++ b/admin/deletuser.php @@ -0,0 +1,50 @@ + + * All rights reserved. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + * --> NOTICE <-- + * This file is part of the core development branch, changing its contents will + * make you unable to use the automatic updates manager. Please refer to the + * documentation for further information about customizing XNova. + * + */ + +define('INSIDE' , true); +define('INSTALL' , false); +define('IN_ADMIN', true); +require_once dirname(dirname(__FILE__)) .'/common.php'; + + if (in_array($CurrentUser['authlevel'], array(LEVEL_ADMIN, LEVEL_OPERATOR))) { + $PageTpl = gettemplate( "admin/deletuser" ); + + if ( $mode != "delet" ) { + $parse['adm_bt_delet'] = $lang['adm_bt_delet']; + } + + $Page = parsetemplate( $PageTpl, $parse ); + display ( $Page, $lang['adminpanel'], false, '', true ); + + } else { + message( $lang['sys_noalloaw'], $lang['sys_noaccess'] ); + } + +?> \ No newline at end of file diff --git a/admin/errors.php b/admin/errors.php new file mode 100644 index 0000000..6309e5b --- /dev/null +++ b/admin/errors.php @@ -0,0 +1,70 @@ + + * All rights reserved. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + * --> NOTICE <-- + * This file is part of the core development branch, changing its contents will + * make you unable to use the automatic updates manager. Please refer to the + * documentation for further information about customizing XNova. + * + */ + +define('INSIDE' , true); +define('INSTALL' , false); +define('IN_ADMIN', true); +require_once dirname(dirname(__FILE__)) .'/common.php'; + +includeLang('admin'); +$parse = $lang; + + if (in_array($user['authlevel'], array(LEVEL_ADMIN))) { + + // Supprimer les erreurs + extract($_GET); + if (isset($delete)) { + doquery("DELETE FROM {{table}} WHERE `error_id`=$delete", 'errors'); + } elseif ($deleteall == 'yes') { + doquery("TRUNCATE TABLE {{table}}", 'errors'); + } + + // Afficher les erreurs + $query = doquery("SELECT * FROM {{table}}", 'errors'); + $i = 0; + while ($u = mysql_fetch_array($query)) { + $i++; + $parse['errors_list'] .= " + ". $u['error_id'] ." + ". $u['error_type'] ." + ". date('d/m/Y h:i:s', $u['error_time']) ." + + ". nl2br($u['error_text']).""; + } + $parse['errors_list'] .= " + ". $i ." ". $lang['adm_er_nbs'] ." + "; + + display(parsetemplate(gettemplate('admin/errors_body'), $parse), "Bledy", false, '', true); + } else { + message( $lang['sys_noalloaw'], $lang['sys_noaccess'] ); + } + +?> diff --git a/admin/leftmenu.php b/admin/leftmenu.php new file mode 100644 index 0000000..4b41251 --- /dev/null +++ b/admin/leftmenu.php @@ -0,0 +1,50 @@ + + * All rights reserved. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + * --> NOTICE <-- + * This file is part of the core development branch, changing its contents will + * make you unable to use the automatic updates manager. Please refer to the + * documentation for further information about customizing XNova. + * + */ + +define('INSIDE' , true); +define('INSTALL' , false); +define('IN_ADMIN', true); +require_once dirname(dirname(__FILE__)) .'/common.php'; + +includeLang('leftmenu'); + + if (in_array($user['authlevel'], array(LEVEL_ADMIN, LEVEL_OPERATOR, LEVEL_MODERATOR))) { + $parse = $lang; + $parse['mf'] = "Hauptframe"; + $parse['dpath'] = $dpath; + $parse['XNovaRelease'] = VERSION; + $parse['servername'] = XNova; + $Page = parsetemplate(gettemplate('admin/left_menu'), $parse); + display( $Page, "", false, '', true); + } else { + message( $lang['sys_noalloaw'], $lang['sys_noaccess'] ); + } + +?> diff --git a/admin/mass_message.php b/admin/mass_message.php new file mode 100644 index 0000000..3d22c76 --- /dev/null +++ b/admin/mass_message.php @@ -0,0 +1,66 @@ + + * All rights reserved. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + * --> NOTICE <-- + * This file is part of the core development branch, changing its contents will + * make you unable to use the automatic updates manager. Please refer to the + * documentation for further information about customizing XNova. + * + */ + +define('INSIDE' , true); +define('INSTALL' , false); +define('IN_ADMIN', true); + +function mass_message_run($parent){ + if($_POST["mode"] == "change"){ + if(isset($_POST["tresc"])&& $_POST["tresc"] != ''){ + $gameConfig['tresc'] = $parent->safe_get_post_var("tresc"); + } + if(isset($_POST["temat"])&& $_POST["temat"] != ''){ + $gameConfig['temat'] = $parent->safe_get_post_var("temat"); + } + $kolor = 'red'; + if($gameConfig['tresc'] !='' and $gameConfig['temat']){ + $sq = $parent->db->query("SELECT `id` FROM {{table}}","users"); + while($u = $parent->db->fetch_assoc($sq)){ + doquery("INSERT INTO {{table}} SET + `message_owner`='{$u['id']}', + `message_sender`='1' , + `message_time`='".time()."', + `message_type`='0', + `message_from`='Administracja', + `message_subject`='{$gameConfig['temat']}', + `message_text`='{$gameConfig['tresc']}' + ","messages"); + $parent->db->query("UPDATE {{table}} SET new_message=new_message+1 WHERE id='{$u['id']}'",'users'); + } + $parent->smarty->assign("message","Wys�a�e� wiadomo�� do wszystkich graczy"); + } + } + $parent->smarty->display("mass_message.tpl"); +} + +function mass_message_info(){ + return array("name" => "Send MassMessages","description"=>"Sends messagess to all players","default_weight"=>"0"); +} \ No newline at end of file diff --git a/admin/md5changepass.php b/admin/md5changepass.php new file mode 100644 index 0000000..72ca6c4 --- /dev/null +++ b/admin/md5changepass.php @@ -0,0 +1,60 @@ + + * All rights reserved. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + * --> NOTICE <-- + * This file is part of the core development branch, changing its contents will + * make you unable to use the automatic updates manager. Please refer to the + * documentation for further information about customizing XNova. + * + */ + +define('INSIDE' , true); +define('INSTALL' , false); +define('IN_ADMIN', true); +require_once dirname(dirname(__FILE__)) .'/common.php'; + if (in_array($user['authlevel'], array(LEVEL_ADMIN, LEVEL_OPERATOR, LEVEL_MODERATOR))) { + includeLang('admin/changepass'); + + $parse = $lang; + + if ($_POST['md5q'] != "") { + + doquery ("UPDATE {{table}} SET `password` = '" . md5 ($_POST['md5q']) . "' WHERE `username` = '".$_POST['user']."';", 'users'); + //$QueryUpdatePass = "UPDATE {{table}} SET "; + //$QueryUpdatePass .= "`password` = '" . md5 ($_POST['md5q']) . "', "; + //$QueryUpdatePass = "WHERE "; + //$QueryUpdatePass .= "`username`=" . $_POST['user'] . ""; + // doquery($QueryUpdatePass, 'users'); + } else { + + } + + $PageTpl = gettemplate("admin/changepass"); + $Page = parsetemplate( $PageTpl, $parse); + + display( $Page, $lang['md5_title'], false, '', true ); + } else { + message( $lang['sys_noalloaw'], $lang['sys_noaccess'] ); + } + +?> \ No newline at end of file diff --git a/admin/md5enc.php b/admin/md5enc.php new file mode 100644 index 0000000..20f3c2a --- /dev/null +++ b/admin/md5enc.php @@ -0,0 +1,57 @@ + + * All rights reserved. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + * --> NOTICE <-- + * This file is part of the core development branch, changing its contents will + * make you unable to use the automatic updates manager. Please refer to the + * documentation for further information about customizing XNova. + * + */ + +define('INSIDE' , true); +define('INSTALL' , false); +define('IN_ADMIN', true); +require_once dirname(dirname(__FILE__)) .'/common.php'; + + if (in_array($user['authlevel'], array(LEVEL_ADMIN, LEVEL_OPERATOR, LEVEL_MODERATOR))) { + includeLang('admin/md5enc'); + + $parse = $lang; + + if ($_POST['md5q'] != "") { + $parse['md5_md5'] = $_POST['md5q']; + $parse['md5_enc'] = md5 ($_POST['md5q']); + } else { + $parse['md5_md5'] = ""; + $parse['md5_enc'] = md5 (""); + } + + $PageTpl = gettemplate("admin/md5enc"); + $Page = parsetemplate( $PageTpl, $parse); + + display( $Page, $lang['md5_title'], false, '', true ); + } else { + message( $lang['sys_noalloaw'], $lang['sys_noaccess'] ); + } + +?> \ No newline at end of file diff --git a/admin/messagelist.php b/admin/messagelist.php new file mode 100644 index 0000000..56dfd6a --- /dev/null +++ b/admin/messagelist.php @@ -0,0 +1,148 @@ + + * All rights reserved. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + * --> NOTICE <-- + * This file is part of the core development branch, changing its contents will + * make you unable to use the automatic updates manager. Please refer to the + * documentation for further information about customizing XNova. + * + */ + +define('INSIDE' , true); +define('INSTALL' , false); +define('IN_ADMIN', true); +require_once dirname(dirname(__FILE__)) .'/common.php'; + + if (in_array($user['authlevel'], array(LEVEL_ADMIN, LEVEL_OPERATOR))) { + includeLang('admin/messagelist'); + + $BodyTpl = gettemplate('admin/messagelist_body'); + $RowsTpl = gettemplate('admin/messagelist_table_rows'); + + $Prev = ( !empty($_POST['prev']) ) ? true : false; + $Next = ( !empty($_POST['next']) ) ? true : false; + $DelSel = ( !empty($_POST['delsel']) ) ? true : false; + $DelDat = ( !empty($_POST['deldat']) ) ? true : false; + $CurrPage = ( !empty($_POST['curr']) ) ? $_POST['curr'] : 1; + $Selected = ( !empty($_POST['sele']) ) ? $_POST['sele'] : 0; + $SelType = $_POST['type']; + $SelPage = $_POST['page']; + + $ViewPage = 1; + if ( $Selected != $SelType ) { + $Selected = $SelType; + $ViewPage = 1; + } elseif ( $CurrPage != $SelPage ) { + $ViewPage = ( !empty($SelPage) ) ? $SelPage : 1; + } + + if ($Prev == true) { + $CurrPage -= 1; + if ($CurrPage >= 1) { + $ViewPage = $CurrPage; + } else { + $ViewPage = 1; + } + } elseif ($Next == true) { + $Mess = doquery("SELECT COUNT(*) AS `max` FROM {{table}} WHERE `message_type` = '". $Selected ."';", 'messages', true); + $MaxPage = ceil ( ($Mess['max'] / 25) ); + $CurrPage += 1; + if ($CurrPage <= $MaxPage) { + $ViewPage = $CurrPage; + } else { + $ViewPage = $MaxPage; + } + } elseif ($DelSel == true) { + foreach($_POST['sele'] as $MessId => $Value) { + if ($Value = "on") { + doquery ( "DELETE FROM {{table}} WHERE `message_id` = '". $MessId ."';", 'messages'); + } + } + } elseif ($DelDat == true) { + $SelDay = $_POST['selday']; + $SelMonth = $_POST['selmonth']; + $SelYear = $_POST['selyear']; + $LimitDate = mktime (0,0,0, $SelMonth, $SelDay, $SelYear ); + if ($LimitDate != false) { + doquery ( "DELETE FROM {{table}} WHERE `message_time` <= '". $LimitDate ."';", 'messages'); + doquery ( "DELETE FROM {{table}} WHERE `time` <= '". $LimitDate ."';", 'rw'); + } + } + + $Mess = doquery("SELECT COUNT(*) AS `max` FROM {{table}} WHERE `message_type` = '". $Selected ."';", 'messages', true); + $MaxPage = ceil ( ($Mess['max'] / 25) ); + + $parse = $lang; + $parse['mlst_data_page'] = $ViewPage; + $parse['mlst_data_pagemax'] = $MaxPage; + $parse['mlst_data_sele'] = $Selected; + + $parse['mlst_data_types'] = ""; + $parse['mlst_data_types'] .= ""; + $parse['mlst_data_types'] .= ""; + $parse['mlst_data_types'] .= ""; + $parse['mlst_data_types'] .= ""; + $parse['mlst_data_types'] .= ""; + $parse['mlst_data_types'] .= ""; + $parse['mlst_data_types'] .= ""; + + $parse['mlst_data_pages'] = ""; + for ( $cPage = 1; $cPage <= $MaxPage; $cPage++ ) { + $parse['mlst_data_pages'] .= ""; + } + + $parse['mlst_scpt'] = "\n"; + + $parse['tbl_rows'] = ""; + $parse['mlst_title'] = $lang['mlst_title']; + + $StartRec = 1 + (($ViewPage - 1) * 25); + $Messages = doquery("SELECT * FROM {{table}} WHERE `message_type` = '". $Selected ."' ORDER BY `message_time` DESC LIMIT ". $StartRec .",25;", 'messages'); + while ($row = mysql_fetch_assoc($Messages)) { + $OwnerData = doquery ("SELECT `username` FROM {{table}} WHERE `id` = '". $row['message_owner'] ."';", 'users',true); + $bloc['mlst_id'] = $row['message_id']; + $bloc['mlst_from'] = $row['message_from']; + $bloc['mlst_to'] = $OwnerData['username'] ." ID:". $row['message_owner']; + $bloc['mlst_text'] = $row['message_text']; + $bloc['mlst_time'] = gmdate ( "d. M Y H:i:s", $row['message_time'] ); + + $parse['mlst_data_rows'] .= parsetemplate($RowsTpl , $bloc); + } + + $display = parsetemplate($BodyTpl , $parse); + + if (isset($_POST['delit'])) { + doquery ("DELETE FROM {{table}} WHERE `message_id` = '". $_POST['delit'] ."';", 'messages'); + AdminMessage ( $lang['mlst_mess_del'] ." ( ". $_POST['delit'] ." )", $lang['mlst_title'], "./messagelist.".PHPEXT, 3); + } + display ($display, $lang['mlst_title'], false, '', true); + } else { + message($lang['sys_noalloaw'], $lang['sys_noaccess']); + } + +?> diff --git a/admin/messall.php b/admin/messall.php new file mode 100644 index 0000000..3522792 --- /dev/null +++ b/admin/messall.php @@ -0,0 +1,75 @@ + + * All rights reserved. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + * --> NOTICE <-- + * This file is part of the core development branch, changing its contents will + * make you unable to use the automatic updates manager. Please refer to the + * documentation for further information about customizing XNova. + * + */ + +define('INSIDE' , true); +define('INSTALL' , false); +define('IN_ADMIN', true); +require_once dirname(dirname(__FILE__)) .'/common.php'; + + if (in_array($user['authlevel'], array(LEVEL_ADMIN, LEVEL_OPERATOR, LEVEL_MODERATOR))) { + if ($_POST && $mode == "change") { + if (isset($_POST["tresc"]) && $_POST["tresc"] != '') { + $gameConfig['tresc'] = $_POST['tresc']; + } + if (isset($_POST["temat"]) && $_POST["temat"] != '') { + $gameConfig['temat'] = $_POST['temat']; + } + if ($user['authlevel'] == LEVEL_ADMIN) { + $kolor = 'red'; + $ranga = 'Administrator'; + } elseif ($user['authlevel'] == LEVEL_OPERATOR) { + $kolor = 'skyblue'; + $ranga = 'Operator'; + } elseif ($user['authlevel'] == LEVEL_MODERATOR) { + $kolor = 'yellow'; + $ranga = 'Moderator'; + } + if ($gameConfig['tresc'] != '' and $gameConfig['temat']) { + $sq = doquery("SELECT `id` FROM {{table}}", "users"); + $Time = time(); + $From = "". $ranga ." ".$user['username'].""; + $Subject = "". $gameConfig['temat'] .""; + $Message = "". $gameConfig['tresc'] .""; + while ($u = mysql_fetch_array($sq)) { + SendSimpleMessage ( $u['id'], $user['id'], $Time, 97, $From, $Subject, $Message); + } + message("Wys�a�e� wiadomo�� do wszystkich graczy", "Complete", "../overview." . PHPEXT, 3); + } + } else { + $parse = $gameConfig; + $parse['dpath'] = $dpath; + $parse['debug'] = ($gameConfig['debug'] == 1) ? " checked='checked'/":''; + $page .= parsetemplate(gettemplate('admin/messall_body'), $parse); + display($page, '', false,'', true); + } + } else { + message($lang['sys_noalloaw'], $lang['sys_noaccess']); + } +?> \ No newline at end of file diff --git a/admin/moonlist.php b/admin/moonlist.php new file mode 100644 index 0000000..510af57 --- /dev/null +++ b/admin/moonlist.php @@ -0,0 +1,62 @@ + + * All rights reserved. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + * --> NOTICE <-- + * This file is part of the core development branch, changing its contents will + * make you unable to use the automatic updates manager. Please refer to the + * documentation for further information about customizing XNova. + * + */ + +define('INSIDE' , true); +define('INSTALL' , false); +define('IN_ADMIN', true); +require_once dirname(dirname(__FILE__)) .'/common.php'; + if (in_array($user['authlevel'], array(LEVEL_ADMIN, LEVEL_OPERATOR))) { + includeLang('overview'); + + $parse = $lang; + $query = doquery("SELECT * FROM {{table}} WHERE planet_type='3'", "planets"); + $i = 0; + while ($u = mysql_fetch_array($query)) { + $parse['moon'] .= "" + . "
" . $u[0] . "
" + . "
" . $u[1] . "
" + . "
" . $u[2] . "
" + . "
" . $u[4] . "
" + . "
" . $u[5] . "
" + . "
" . $u[6] . "
" + . ""; + $i++; + } + + if ($i == "1") + $parse['moon'] .= "Il y a qu'une seule lune"; + else + $parse['moon'] .= "Il y a {$i} lunes"; + + display(parsetemplate(gettemplate('admin/moonlist_body'), $parse), 'Lunalist' , false, '', true); + } else { + message( $lang['sys_noalloaw'], $lang['sys_noaccess'] ); + } +?> \ No newline at end of file diff --git a/admin/multi.php b/admin/multi.php new file mode 100644 index 0000000..b7d01e1 --- /dev/null +++ b/admin/multi.php @@ -0,0 +1,65 @@ + + * All rights reserved. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + * --> NOTICE <-- + * This file is part of the core development branch, changing its contents will + * make you unable to use the automatic updates manager. Please refer to the + * documentation for further information about customizing XNova. + * + */ + +define('INSIDE' , true); +define('INSTALL' , false); +define('IN_ADMIN', true); +require_once dirname(dirname(__FILE__)) .'/common.php'; + + if (in_array($user['authlevel'], array(LEVEL_ADMIN, LEVEL_OPERATOR, LEVEL_MODERATOR))) { + includeLang('admin/multi'); + + $query = doquery("SELECT * FROM {{table}}", 'multi'); + + $parse = $lang; + $parse['adm_mt_table'] = ""; + $i = 0; + + $RowsTPL = gettemplate('admin/multi_rows'); + $PageTPL = gettemplate('admin/multi_body'); + + while ($infos = mysql_fetch_assoc($query)) { + $Bloc['player'] = $infos['player']; + $Bloc['text'] = $infos['text']; + + $parse['adm_mt_table'] .= parsetemplate( $RowsTPL, $Bloc ); + $i++; + } + + $parse['adm_mt_count'] = $i; + + $page = parsetemplate( $PageTPL, $parse ); + display( $page, $lang['adm_mt_title'], false, '', true); + + } else { + message( $lang['sys_noalloaw'], $lang['sys_noaccess'] ); + } + +?> \ No newline at end of file diff --git a/admin/overview.php b/admin/overview.php new file mode 100644 index 0000000..f89a7ed --- /dev/null +++ b/admin/overview.php @@ -0,0 +1,116 @@ + + * All rights reserved. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + * --> NOTICE <-- + * This file is part of the core development branch, changing its contents will + * make you unable to use the automatic updates manager. Please refer to the + * documentation for further information about customizing XNova. + * + */ + +define('INSIDE' , true); +define('INSTALL' , false); +define('IN_ADMIN', true); +require_once dirname(dirname(__FILE__)) .'/common.php'; + + if (in_array($user['authlevel'], array(LEVEL_ADMIN, LEVEL_OPERATOR, LEVEL_MODERATOR))) { + includeLang('admin'); + + if ($_GET['cmd'] == 'sort') { + $TypeSort = $_GET['type']; + } else { + $TypeSort = "id"; + } + + $PageTPL = gettemplate('admin/overview_body'); + $RowsTPL = gettemplate('admin/overview_rows'); + + $parse = $lang; + $parse['dpath'] = $dpath; + $parse['mf'] = $mf; + $parse['adm_ov_data_yourv'] = colorRed(VERSION); + + $Last15Mins = doquery("SELECT * FROM {{table}} WHERE `onlinetime` >= '". (time() - 15 * 60) ."' ORDER BY `". $TypeSort ."` ASC;", 'users'); + $Count = 0; + $Color = "lime"; + while ( $TheUser = mysql_fetch_array($Last15Mins) ) { + if ($PrevIP != "") { + if ($PrevIP == $TheUser['user_lastip']) { + $Color = "red"; + } else { + $Color = "lime"; + } + } + + $UserPoints = doquery("SELECT * FROM {{table}} WHERE `stat_type` = '1' AND `stat_code` = '1' AND `id_owner` = '" . $TheUser['id'] . "';", 'statpoints', true); + $Bloc['dpath'] = $dpath; + $Bloc['adm_ov_altpm'] = $lang['adm_ov_altpm']; + $Bloc['adm_ov_wrtpm'] = $lang['adm_ov_wrtpm']; + $Bloc['adm_ov_data_id'] = $TheUser['id']; + $Bloc['adm_ov_data_name'] = $TheUser['username']; + $Bloc['adm_ov_data_agen'] = $TheUser['user_agent']; + $Bloc['current_page'] = $TheUser['current_page']; + $Bloc['usr_s_id'] = $TheUser['id']; + + $Bloc['adm_ov_data_clip'] = $Color; + $Bloc['adm_ov_data_adip'] = $TheUser['user_lastip']; + $Bloc['adm_ov_data_ally'] = $TheUser['ally_name']; + $Bloc['adm_ov_data_point'] = pretty_number ( $UserPoints['total_points'] ); + $Bloc['adm_ov_data_activ'] = pretty_time ( time() - $TheUser['onlinetime'] ); + $Bloc['adm_ov_data_pict'] = "m.gif"; + $PrevIP = $TheUser['user_lastip']; + + //Tweaks vue g�n�rale + $Bloc['usr_email'] = $TheUser['email']; + $Bloc['usr_xp_raid'] = $TheUser['xpraid']; + $Bloc['usr_xp_min'] = $TheUser['xpminier']; + + if ($TheUser['urlaubs_modus'] == 1) { + $Bloc['state_vacancy'] = ""; + } else { + $Bloc['state_vacancy'] = ""; + } + + if ($TheUser['bana'] == 1) { + $Bloc['is_banned'] = ""; + } else { + $Bloc['is_banned'] = $lang['is_banned_lang']; + } + $Bloc['usr_planet_gal'] = $TheUser['galaxy']; + $Bloc['usr_planet_sys'] = $TheUser['system']; + $Bloc['usr_planet_pos'] = $TheUser['planet']; + + + $parse['adm_ov_data_table'] .= parsetemplate( $RowsTPL, $Bloc ); + $Count++; + } + + $parse['adm_ov_data_count'] = $Count; + $Page = parsetemplate($PageTPL, $parse); + + display ( $Page, $lang['sys_overview'], false, '', true); + } else { + AdminMessage ( $lang['sys_noalloaw'], $lang['sys_noaccess'] ); + } + +?> diff --git a/admin/paneladmina.php b/admin/paneladmina.php new file mode 100644 index 0000000..86793a2 --- /dev/null +++ b/admin/paneladmina.php @@ -0,0 +1,194 @@ + + * All rights reserved. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + * --> NOTICE <-- + * This file is part of the core development branch, changing its contents will + * make you unable to use the automatic updates manager. Please refer to the + * documentation for further information about customizing XNova. + * + */ + +define('INSIDE' , true); +define('INSTALL' , false); +define('IN_ADMIN', true); + +require_once dirname(dirname(__FILE__)) .'/common.php'; + + if (in_array($user['authlevel'], array(LEVEL_ADMIN, LEVEL_OPERATOR, LEVEL_MODERATOR))) { + + includeLang('admin/adminpanel'); + + $PanelMainTPL = gettemplate('admin/admin_panel_main'); + + $parse = $lang; + $parse['adm_sub_form1'] = ""; + $parse['adm_sub_form2'] = ""; + $parse['adm_sub_form3'] = ""; + + // Afficher les templates + if (isset($_GET['result'])) { + + switch ($_GET['result']){ + case 'usr_search': + $pattern = mysql_real_escape_string($_GET['player']); + $SelUser = doquery("SELECT * FROM {{table}} WHERE `username` LIKE '%". $pattern ."%' LIMIT 1;", 'users', true); + $UsrMain = doquery("SELECT `name` FROM {{table}} WHERE `id` = '". $SelUser['id_planet'] ."';", 'planets', true); + + $bloc = $lang; + $bloc['answer1'] = $SelUser['id']; + $bloc['answer2'] = $SelUser['username']; + $bloc['answer3'] = $SelUser['user_lastip']; + $bloc['answer4'] = $SelUser['email']; + $bloc['answer5'] = $lang['adm_usr_level'][ $SelUser['authlevel'] ]; + $bloc['answer6'] = $lang['adm_usr_genre'][ $SelUser['sex'] ]; + $bloc['answer7'] = "[".$SelUser['id_planet']."] ".$UsrMain['name']; + $bloc['answer8'] = "[".$SelUser['galaxy'].":".$SelUser['system'].":".$SelUser['planet']."] "; + $SubPanelTPL = gettemplate('admin/admin_panel_asw1'); + $parse['adm_sub_form2'] = parsetemplate( $SubPanelTPL, $bloc ); + break; + + case 'usr_data': + $pattern = mysql_real_escape_string($_GET['player']); + $SelUser = doquery("SELECT * FROM {{table}} WHERE `username` LIKE '%". $pattern ."%' LIMIT 1;", 'users', true); + $UsrMain = doquery("SELECT `name` FROM {{table}} WHERE `id` = '". $SelUser['id_planet'] ."';", 'planets', true); + + $bloc = $lang; + $bloc['answer1'] = $SelUser['id']; + $bloc['answer2'] = $SelUser['username']; + $bloc['answer3'] = $SelUser['user_lastip']; + $bloc['answer4'] = $SelUser['email']; + $bloc['answer5'] = $lang['adm_usr_level'][ $SelUser['authlevel'] ]; + $bloc['answer6'] = $lang['adm_usr_genre'][ $SelUser['sex'] ]; + $bloc['answer7'] = "[".$SelUser['id_planet']."] ".$UsrMain['name']; + $bloc['answer8'] = "[".$SelUser['galaxy'].":".$SelUser['system'].":".$SelUser['planet']."] "; + $SubPanelTPL = gettemplate('admin/admin_panel_asw1'); + $parse['adm_sub_form1'] = parsetemplate( $SubPanelTPL, $bloc ); + + $parse['adm_sub_form2'] = ""; + $parse['adm_sub_form2'] .= ""; + $UsrColo = doquery("SELECT * FROM {{table}} WHERE `id_owner` = '". $SelUser['id'] ." ORDER BY `galaxy` ASC, `planet` ASC, `system` ASC, `planet_type` ASC';", 'planets'); + while ( $Colo = mysql_fetch_assoc($UsrColo) ) { + if ($Colo['id'] != $SelUser['id_planet']) { + $parse['adm_sub_form2'] .= ""; + $parse['adm_sub_form2'] .= ""; + $parse['adm_sub_form2'] .= ""; + $parse['adm_sub_form2'] .= ""; + } + } + $parse['adm_sub_form2'] .= "
".$lang['adm_colony']."
".$Colo['id']."". (($Colo['planet_type'] == 1) ? $lang['adm_planet'] : $lang['adm_moon'] ) ."[".$Colo['galaxy'].":".$Colo['system'].":".$Colo['planet']."]".$Colo['name']."
"; + + $parse['adm_sub_form3'] = ""; + $parse['adm_sub_form3'] .= ""; + for ($Item = 100; $Item <= 199; $Item++) { + if ($resource[$Item] != "") { + $parse['adm_sub_form3'] .= ""; + $parse['adm_sub_form3'] .= ""; + } + } + $parse['adm_sub_form3'] .= "
".$lang['adm_technos']."
".$lang['tech'][$Item]."".$SelUser[$resource[$Item]]."
"; + break; + + case 'usr_level': + if (!isset($_GET['s']) || !isset($_SESSION['CSRF']) || $_GET['s'] !== $_SESSION['CSRF']) { + AdminMessage( + 'One have tried to overcome administration privilleges.', + 'Hacking attempt'); + break; + } + + $player = isset($_GET['player']) ? mysql_real_escape_string($_GET['player']) : ''; + $level = isset($_GET['authlvl']) ? mysql_real_escape_string($_GET['authlvl']) : ''; + + if ($level >= $user['authlevel'] && $user['authlevel'] != LEVEL_ADMIN) { + AdminMessage('Not enough privilleges to promote user.', $lang['adm_mod_level']); + break; + } + + $userData = doquery("SELECT id FROM {{table}} WHERE `username` = '".$player."';", 'users', true); + if (empty($user)) { + AdminMessage('No such user.', $lang['adm_mod_level']); + break; + } + + doquery("UPDATE {{table}} SET `authlevel` = '{$level}' WHERE id={$userData['id']}", 'users'); + $message = $lang['adm_mess_lvl1']. " ". $player ." ".$lang['adm_mess_lvl2']; + $message .= "".$lang['adm_usr_level'][$level]."!"; + + AdminMessage($message, $lang['adm_mod_level']); + break; + + case 'ip_search': + $pattern = isset($_GET['ip']) ? mysql_real_escape_string($_GET['ip']) : ''; + $SelUser = doquery("SELECT * FROM {{table}} WHERE `user_lastip` = '". $pattern ."' LIMIT 10;", 'users'); + $bloc = $lang; + $bloc['adm_this_ip'] = $pattern; + while ( $Usr = mysql_fetch_assoc($SelUser) ) { + $UsrMain = doquery("SELECT `name` FROM {{table}} WHERE `id` = '". $Usr['id_planet'] ."';", 'planets', true); + $bloc['adm_plyer_lst'] .= "".$Usr['username']."[".$Usr['galaxy'].":".$Usr['system'].":".$Usr['planet']."] ".$UsrMain['name'].""; + } + $SubPanelTPL = gettemplate('admin/admin_panel_asw2'); + $parse['adm_sub_form2'] = parsetemplate( $SubPanelTPL, $bloc ); + break; + default: + break; + } + } + + // Traiter les reponses aux formulaires + if (isset($_GET['action'])) { + $bloc = $lang; + + $_SESSION['CSRF'] = sha1(uniqid(null, true)); + $bloc['csrf_hack'] = $_SESSION['CSRF']; + + switch ($_GET['action']){ + case 'usr_search': + $SubPanelTPL = gettemplate('admin/admin_panel_frm1'); + break; + + case 'usr_data': + $SubPanelTPL = gettemplate('admin/admin_panel_frm4'); + break; + + case 'usr_level': + for ($Lvl = 0; $Lvl < 4; $Lvl++) { + $bloc['adm_level_lst'] .= ""; + } + $SubPanelTPL = gettemplate('admin/admin_panel_frm3'); + break; + + case 'ip_search': + $SubPanelTPL = gettemplate('admin/admin_panel_frm2'); + break; + + default: + break; + } + $parse['adm_sub_form2'] = parsetemplate( $SubPanelTPL, $bloc ); + } + + $page = parsetemplate( $PanelMainTPL, $parse ); + display( $page, $lang['panel_mainttl'], false, '', true ); +} else { + message( $lang['sys_noalloaw'], $lang['sys_noaccess'] ); +} diff --git a/admin/planetlist.php b/admin/planetlist.php new file mode 100644 index 0000000..99e9d49 --- /dev/null +++ b/admin/planetlist.php @@ -0,0 +1,63 @@ + + * All rights reserved. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + * --> NOTICE <-- + * This file is part of the core development branch, changing its contents will + * make you unable to use the automatic updates manager. Please refer to the + * documentation for further information about customizing XNova. + * + */ + +define('INSIDE' , true); +define('INSTALL' , false); +define('IN_ADMIN', true); +require_once dirname(dirname(__FILE__)) .'/common.php'; + + if (in_array($user['authlevel'], array(LEVEL_ADMIN, LEVEL_OPERATOR))) { + + $parse = $lang; + $query = doquery("SELECT * FROM {{table}} WHERE planet_type='1'", "planets"); + $i = 0; + while ($u = mysql_fetch_array($query)) { + $parse['planetes'] .= "" + . "
" . $u[0] . "
" + . "
" . $u[1] . "
" + . "
" . $u[4] . "
" + . "
" . $u[5] . "
" + . "
" . $u[6] . "
" + . ""; + $i++; + } + + if ($i == "1") + $parse['planetes'] .= "Il y a qu'une seule planète"; + else + $parse['planetes'] .= "Il y a {$i} planètes"; + + display(parsetemplate(gettemplate('admin/planetlist_body'), $parse), 'Planetlist', false, '', true); + } else { + message($lang['sys_noalloaw'], $lang['sys_noaccess']); + } + +// Created by e-Zobar. All rights reversed (C) XNova Team 2008 +?> \ No newline at end of file diff --git a/admin/settings.php b/admin/settings.php new file mode 100644 index 0000000..3c5d441 --- /dev/null +++ b/admin/settings.php @@ -0,0 +1,310 @@ + + * All rights reserved. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + * --> NOTICE <-- + * This file is part of the core development branch, changing its contents will + * make you unable to use the automatic updates manager. Please refer to the + * documentation for further information about customizing XNova. + * + */ + +define('INSIDE' , true); +define('INSTALL' , false); +define('IN_ADMIN', true); +require_once dirname(dirname(__FILE__)) .'/common.php'; + + +function DisplayGameSettingsPage ( $CurrentUser ) { + global $lang, $gameConfig; + + includeLang('admin/settings'); + + if (in_array((int) $CurrentUser['authlevel'], array(LEVEL_ADMIN))) { + if ($_POST['opt_save'] == "1") { + // Jeu Ouvert ou Ferm� ! + if (isset($_POST['closed']) && $_POST['closed'] == 'on') { + $gameConfig['game_disable'] = "1"; + $gameConfig['close_reason'] = addslashes( $_POST['close_reason'] ); + } else { + $gameConfig['game_disable'] = "0"; + $gameConfig['close_reason'] = ""; + } + + // Y a un News Frame ? ! + if (isset($_POST['newsframe']) && $_POST['newsframe'] == 'on') { + $gameConfig['OverviewNewsFrame'] = "1"; + $gameConfig['OverviewNewsText'] = addslashes( $_POST['NewsText'] ); + } else { + $gameConfig['OverviewNewsFrame'] = "0"; + $gameConfig['OverviewNewsText'] = ""; + } + + // Y a un TCHAT externe ?? + if (isset($_POST['chatframe']) && $_POST['chatframe'] == 'on') { + $gameConfig['OverviewExternChat'] = "1"; + $gameConfig['OverviewExternChatCmd'] = addslashes( $_POST['ExternChat'] ); + } else { + $gameConfig['OverviewExternChat'] = "0"; + $gameConfig['OverviewExternChatCmd'] = ""; + } + + if (isset($_POST['googlead']) && $_POST['googlead'] == 'on') { + $gameConfig['OverviewBanner'] = "1"; + $gameConfig['OverviewClickBanner'] = addslashes( $_POST['GoogleAds'] ); + } else { + $gameConfig['OverviewBanner'] = "0"; + $gameConfig['OverviewClickBanner'] = ""; + } + + // Y a un BANNER Frame ? + if (isset($_POST['bannerframe']) && $_POST['bannerframe'] == 'on') { + $gameConfig['ForumBannerFrame'] = "1"; + } else { + $gameConfig['ForumBannerFrame'] = "0"; + } + + // Mode Debug ou pas ! + if (isset($_POST['debug']) && $_POST['debug'] == 'on') { + $gameConfig['debug'] = "1"; + } else { + $gameConfig['debug'] = "0"; + } + + // Nom du Jeu + if (isset($_POST['game_name']) && $_POST['game_name'] != '') { + $gameConfig['game_name'] = $_POST['game_name']; + } + + // Adresse du Forum + if (isset($_POST['forum_url']) && $_POST['forum_url'] != '') { + $gameConfig['forum_url'] = $_POST['forum_url']; + } + + // Vitesse du Jeu + if (isset($_POST['game_speed']) && is_numeric($_POST['game_speed'])) { + $gameConfig['game_speed'] = $_POST['game_speed']; + } + + // Vitesse des Flottes + if (isset($_POST['fleet_speed']) && is_numeric($_POST['fleet_speed'])) { + $gameConfig['fleet_speed'] = $_POST['fleet_speed']; + } + + // Multiplicateur de Production + if (isset($_POST['resource_multiplier']) && is_numeric($_POST['resource_multiplier'])) { + $gameConfig['resource_multiplier'] = $_POST['resource_multiplier']; + } + + // Taille de la planete mère + if (isset($_POST['initial_fields']) && is_numeric($_POST['initial_fields'])) { + $gameConfig['initial_fields'] = $_POST['initial_fields']; + } + + // Revenu de base Metal + if (isset($_POST['metal_basic_income']) && is_numeric($_POST['metal_basic_income'])) { + $gameConfig['metal_basic_income'] = $_POST['metal_basic_income']; + } + + // Revenu de base Cristal + if (isset($_POST['crystal_basic_income']) && is_numeric($_POST['crystal_basic_income'])) { + $gameConfig['crystal_basic_income'] = $_POST['crystal_basic_income']; + } + + // Revenu de base Deuterium + if (isset($_POST['deuterium_basic_income']) && is_numeric($_POST['deuterium_basic_income'])) { + $gameConfig['deuterium_basic_income'] = $_POST['deuterium_basic_income']; + } + + // Revenu de base Energie + if (isset($_POST['energy_basic_income']) && is_numeric($_POST['energy_basic_income'])) { + $gameConfig['energy_basic_income'] = $_POST['energy_basic_income']; + } + + // Lien supplémentaire dans le menu + if (isset($_POST['enable_link_']) && is_numeric($_POST['enable_link_'])) { + $gameConfig['link_enable'] = $_POST['enable_link_']; + } + // Texte de ce lien... +$gameConfig['link_name'] = addslashes( $_POST['name_link_']); + + // URL de ce lien... +$gameConfig['link_url'] = $_POST['url_link_']; + // Image de la bannière +$gameConfig['banner_source_post'] = $_POST['banner_source_post']; + // 1 point = ??? Ressources ? + if (isset($_POST['stat_settings']) && is_numeric($_POST['stat_settings'])) { + $gameConfig['stat_settings'] = $_POST['stat_settings']; + } + // Activation -ou non- des annonces + if (isset($_POST['enable_announces_']) && is_numeric($_POST['enable_announces_'])) { + $gameConfig['enable_announces'] = $_POST['enable_announces_']; + } + // Activation -ou non- du marchand + if (isset($_POST['enable_marchand_']) && is_numeric($_POST['enable_marchand_'])) { + $gameConfig['enable_marchand'] = $_POST['enable_marchand_']; + } + // Activation -ou non- des notes + if (isset($_POST['enable_notes_']) && is_numeric($_POST['enable_notes_'])) { + $gameConfig['enable_notes'] = $_POST['enable_notes_']; + } + // Nom du bot antimulti + $gameConfig['bot_name'] = addslashes( $_POST['name_bot']); + + // email du bot antimulti + $gameConfig['bot_adress'] = addslashes( $_POST['adress_bot']); + + // Activation -ou non- des notes + if (isset($_POST['duration_ban']) && is_numeric($_POST['duration_ban'])) { + $gameConfig['ban_duration'] = $_POST['duration_ban']; + } + + // Activation -ou non- du bot + if (isset($_POST['bot_enable']) && is_numeric($_POST['bot_enable'])) { + $gameConfig['enable_bot'] = $_POST['bot_enable']; + } + + // BBCode ou pas ? + + if (isset($_POST['bbcode_field']) && is_numeric($_POST['bbcode_field'])) { + $gameConfig['enable_bbcode'] = $_POST['bbcode_field']; + } + + // Activation du jeu + doquery("UPDATE {{table}} SET `config_value` = '". $gameConfig['game_disable'] ."' WHERE `config_name` = 'game_disable';", 'config'); + doquery("UPDATE {{table}} SET `config_value` = '". $gameConfig['close_reason'] ."' WHERE `config_name` = 'close_reason';", 'config'); + + //Stats + + doquery("UPDATE {{table}} SET `config_value` = '". $gameConfig['stat_settings'] ."' WHERE `config_name` = 'stat_settings';", 'config'); + + + // Configuration du Jeu + doquery("UPDATE {{table}} SET `config_value` = '". $gameConfig['forum_url'] ."' WHERE `config_name` = 'forum_url';", 'config'); + doquery("UPDATE {{table}} SET `config_value` = '". $gameConfig['game_name'] ."' WHERE `config_name` = 'game_name';", 'config'); + doquery("UPDATE {{table}} SET `config_value` = '". $gameConfig['game_speed'] ."' WHERE `config_name` = 'game_speed';", 'config'); + doquery("UPDATE {{table}} SET `config_value` = '". $gameConfig['fleet_speed'] ."' WHERE `config_name` = 'fleet_speed';", 'config'); + doquery("UPDATE {{table}} SET `config_value` = '". $gameConfig['resource_multiplier'] ."' WHERE `config_name` = 'resource_multiplier';", 'config'); + + // Page Generale + doquery("UPDATE {{table}} SET `config_value` = '". $gameConfig['OverviewNewsFrame'] ."' WHERE `config_name` = 'OverviewNewsFrame';", 'config'); + doquery("UPDATE {{table}} SET `config_value` = '". $gameConfig['OverviewNewsText'] ."' WHERE `config_name` = 'OverviewNewsText';", 'config'); + doquery("UPDATE {{table}} SET `config_value` = '". $gameConfig['OverviewExternChat'] ."' WHERE `config_name` = 'OverviewExternChat';", 'config'); + doquery("UPDATE {{table}} SET `config_value` = '". $gameConfig['OverviewExternChatCmd'] ."' WHERE `config_name` = 'OverviewExternChatCmd';", 'config'); + doquery("UPDATE {{table}} SET `config_value` = '". $gameConfig['OverviewBanner'] ."' WHERE `config_name` = 'OverviewBanner';", 'config'); + doquery("UPDATE {{table}} SET `config_value` = '". $gameConfig['OverviewClickBanner'] ."' WHERE `config_name` = 'OverviewClickBanner';", 'config'); + doquery("UPDATE {{table}} SET `config_value` = '". $gameConfig['ForumBannerFrame'] ."' WHERE `config_name` = 'ForumBannerFrame';", 'config'); + + //Bannière + doquery("UPDATE {{table}} SET `config_value` = '". $gameConfig['banner_source_post'] ."' WHERE `config_name` = 'banner_source_post';", 'config'); + + // Lien supplémentaire dans le menu + doquery("UPDATE {{table}} SET `config_value` = '". $gameConfig['link_enable'] ."' WHERE `config_name` = 'link_enable';", 'config'); + doquery("UPDATE {{table}} SET `config_value` = '". $gameConfig['link_name'] ."' WHERE `config_name` = 'link_name';", 'config'); + doquery("UPDATE {{table}} SET `config_value` = '". $gameConfig['link_url'] ."' WHERE `config_name` = 'link_url';", 'config'); + + // Options Planete + doquery("UPDATE {{table}} SET `config_value` = '". $gameConfig['initial_fields'] ."' WHERE `config_name` = 'initial_fields';", 'config'); + doquery("UPDATE {{table}} SET `config_value` = '". $gameConfig['metal_basic_income'] ."' WHERE `config_name` = 'metal_basic_income';", 'config'); + doquery("UPDATE {{table}} SET `config_value` = '". $gameConfig['crystal_basic_income'] ."' WHERE `config_name` = 'crystal_basic_income';", 'config'); + doquery("UPDATE {{table}} SET `config_value` = '". $gameConfig['deuterium_basic_income'] ."' WHERE `config_name` = 'deuterium_basic_income';", 'config'); + doquery("UPDATE {{table}} SET `config_value` = '". $gameConfig['energy_basic_income'] ."' WHERE `config_name` = 'energy_basic_income';", 'config'); + + //Bot antimulti + doquery("UPDATE {{table}} SET `config_value` = '". $gameConfig['bot_name'] ."' WHERE `config_name` = 'bot_name';", 'config'); + doquery("UPDATE {{table}} SET `config_value` = '". $gameConfig['bot_adress'] ."' WHERE `config_name` = 'bot_adress';", 'config'); + doquery("UPDATE {{table}} SET `config_value` = '". $gameConfig['ban_duration'] ."' WHERE `config_name` = 'ban_duration';", 'config'); + doquery("UPDATE {{table}} SET `config_value` = '". $gameConfig['enable_bot'] ."' WHERE `config_name` = 'enable_bot';", 'config'); + + + //Réglage du BBCode + doquery("UPDATE {{table}} SET `config_value` = '". $gameConfig['enable_bbcode'] ."' WHERE `config_name` = 'enable_bbcode';", 'config'); + + + //Controle des pages + doquery("UPDATE {{table}} SET `config_value` = '". $gameConfig['enable_announces'] ."' WHERE `config_name` = 'enable_announces';", 'config'); + doquery("UPDATE {{table}} SET `config_value` = '". $gameConfig['enable_marchand'] ."' WHERE `config_name` = 'enable_marchand';", 'config'); + doquery("UPDATE {{table}} SET `config_value` = '". $gameConfig['enable_notes'] ."' WHERE `config_name` = 'enable_notes';", 'config'); + + // Mode Debug + doquery("UPDATE {{table}} SET `config_value` = '" .$gameConfig['debug'] ."' WHERE `config_name` ='debug'", 'config'); + AdminMessage ('Options changees avec succes !', 'Succes', '?'); + } else { + + $parse = $lang; + $parse['game_name'] = $gameConfig['game_name']; + $parse['game_speed'] = $gameConfig['game_speed']; + $parse['fleet_speed'] = $gameConfig['fleet_speed']; + $parse['resource_multiplier'] = $gameConfig['resource_multiplier']; + $parse['forum_url'] = $gameConfig['forum_url']; + $parse['initial_fields'] = $gameConfig['initial_fields']; + $parse['metal_basic_income'] = $gameConfig['metal_basic_income']; + $parse['crystal_basic_income'] = $gameConfig['crystal_basic_income']; + $parse['deuterium_basic_income'] = $gameConfig['deuterium_basic_income']; + $parse['energy_basic_income'] = $gameConfig['energy_basic_income']; + $parse['enable_link'] = $gameConfig['link_enable']; + $parse['name_link'] = $gameConfig['link_name']; + $parse['url_link'] = $gameConfig['link_url']; + $parse['enable_announces'] = $gameConfig['enable_announces']; + $parse['enable_marchand'] = $gameConfig['enable_marchand']; + $parse['enable_notes'] = $gameConfig['enable_notes']; + $parse['bot_name'] = stripslashes($gameConfig['bot_name']); + $parse['bot_adress'] = stripslashes($gameConfig['bot_adress']); + $parse['ban_duration'] = stripslashes($gameConfig['ban_duration']); + $parse['enable_bot'] = stripslashes($gameConfig['enable_bot']); + $parse['enable_bbcode'] = stripslashes($gameConfig['enable_bbcode']); + + $parse['banner_source_post'] = $gameConfig['banner_source_post']; + $parse['stat_settings'] = stripslashes($gameConfig['stat_settings']); + + + + $parse['closed'] = ($gameConfig['game_disable'] == 1) ? " checked = 'checked' ":""; + $parse['close_reason'] = stripslashes( $gameConfig['close_reason'] ); + + $parse['newsframe'] = ($gameConfig['OverviewNewsFrame'] == 1) ? " checked = 'checked' ":""; + $parse['NewsTextVal'] = stripslashes( $gameConfig['OverviewNewsText'] ); + + $parse['chatframe'] = ($gameConfig['OverviewExternChat'] == 1) ? " checked = 'checked' ":""; + $parse['ExtTchatVal'] = stripslashes( $gameConfig['OverviewExternChatCmd'] ); + + $parse['googlead'] = ($gameConfig['OverviewBanner'] == 1) ? " checked = 'checked' ":""; + $parse['GoogleAdVal'] = stripslashes( $gameConfig['OverviewClickBanner'] ); + + $parse['debug'] = ($gameConfig['debug'] == 1) ? " checked = 'checked' ":""; + + $parse['bannerframe'] = ($gameConfig['ForumBannerFrame'] == 1) ? " checked = 'checked' ":""; + + $PageTPL = gettemplate('admin/options_body'); + $Page .= parsetemplate( $PageTPL, $parse ); + + display ( $Page, $lang['adm_opt_title'], false, '', true ); + } + } else { + AdminMessage ( $lang['sys_noalloaw'], $lang['sys_noaccess'] ); + } + return $Page; +} + + $Page = DisplayGameSettingsPage ( $user ); + +?> diff --git a/admin/statbuilder.php b/admin/statbuilder.php new file mode 100644 index 0000000..6c3a0ca --- /dev/null +++ b/admin/statbuilder.php @@ -0,0 +1,270 @@ + + * All rights reserved. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + * --> NOTICE <-- + * This file is part of the core development branch, changing its contents will + * make you unable to use the automatic updates manager. Please refer to the + * documentation for further information about customizing XNova. + * + */ + +define('INSIDE' , true); +define('INSTALL' , false); +define('IN_ADMIN', true); + +require_once dirname(dirname(__FILE__)) .'/common.php'; + +include(ROOT_PATH . 'admin/statfunctions.' . PHPEXT); + + +if (strtolower(substr(PHP_SAPI, 0, 3)) == 'cli' || in_array($user['authlevel'], array(LEVEL_ADMIN, LEVEL_OPERATOR, LEVEL_MODERATOR))) { + includeLang('admin'); + + $StatDate = time(); + // Rotation des statistiques + doquery ( "DELETE FROM {{table}} WHERE `stat_code` = '2';" , 'statpoints'); + doquery ( "UPDATE {{table}} SET `stat_code` = `stat_code` + '1';" , 'statpoints'); + + $GameUsers = doquery("SELECT * FROM {{table}} WHERE authlevel<3", 'users'); + + while ($CurUser = mysql_fetch_assoc($GameUsers)) { + // Recuperation des anciennes statistiques + $OldStatRecord = doquery ("SELECT * FROM {{table}} WHERE `stat_type` = '1' AND `id_owner` = '".$CurUser['id']."';",'statpoints'); + if ($OldStatRecord) { + $OldTotalRank = $OldStatRecord['total_rank']; + $OldTechRank = $OldStatRecord['tech_rank']; + $OldBuildRank = $OldStatRecord['build_rank']; + $OldDefsRank = $OldStatRecord['defs_rank']; + $OldFleetRank = $OldStatRecord['fleet_rank']; + // Suppression de l'ancien enregistrement + doquery ("DELETE FROM {{table}} WHERE `stat_type` = '1' AND `id_owner` = '".$CurUser['id']."';",'statpoints'); + } else { + $OldTotalRank = 0; + $OldTechRank = 0; + $OldBuildRank = 0; + $OldDefsRank = 0; + $OldFleetRank = 0; + } + + // Total des unitées consommée pour la recherche + $Points = GetTechnoPoints ( $CurUser ); + $TTechCount = $Points['TechCount']; + $TTechPoints = ($Points['TechPoint'] / $gameConfig['stat_settings']); + + // Totalisation des points accumulés par planete + $TBuildCount = 0; + $TBuildPoints = 0; + $TDefsCount = 0; + $TDefsPoints = 0; + $TFleetCount = 0; + $TFleetPoints = 0; + $GCount = $TTechCount; + $GPoints = $TTechPoints; + $UsrPlanets = doquery("SELECT * FROM {{table}} WHERE `id_owner` = '". $CurUser['id'] ."';", 'planets'); + while ($CurPlanet = mysql_fetch_assoc($UsrPlanets) ) { + $Points = GetBuildPoints ( $CurPlanet ); + $TBuildCount += $Points['BuildCount']; + $GCount += $Points['BuildCount']; + $PlanetPoints = ($Points['BuildPoint'] / $gameConfig['stat_settings']); + $TBuildPoints += ($Points['BuildPoint'] / $gameConfig['stat_settings']); + + $Points = GetDefensePoints ( $CurPlanet ); + $TDefsCount += $Points['DefenseCount'];; + $GCount += $Points['DefenseCount']; + $PlanetPoints += ($Points['DefensePoint'] / $gameConfig['stat_settings']); + $TDefsPoints += ($Points['DefensePoint'] / $gameConfig['stat_settings']); + + $Points = GetFleetPoints ( $CurPlanet ); + $TFleetCount += $Points['FleetCount']; + $GCount += $Points['FleetCount']; + $PlanetPoints += ($Points['FleetPoint'] / $gameConfig['stat_settings']); + $TFleetPoints += ($Points['FleetPoint'] / $gameConfig['stat_settings']); + + $GPoints += $PlanetPoints; + $QryUpdatePlanet = "UPDATE {{table}} SET "; + $QryUpdatePlanet .= "`points` = '". $PlanetPoints ."' "; + $QryUpdatePlanet .= "WHERE "; + $QryUpdatePlanet .= "`id` = '". $CurPlanet['id'] ."';"; + doquery ( $QryUpdatePlanet , 'planets'); + } + + $QryInsertStats = "INSERT INTO {{table}} SET "; + $QryInsertStats .= "`id_owner` = '". $CurUser['id'] ."', "; + $QryInsertStats .= "`id_ally` = '". $CurUser['ally_id'] ."', "; + $QryInsertStats .= "`stat_type` = '1', "; // 1 pour joueur , 2 pour alliance + $QryInsertStats .= "`stat_code` = '1', "; // de 1 a 2 mis a jour de maniere automatique + $QryInsertStats .= "`tech_points` = '". $TTechPoints ."', "; + $QryInsertStats .= "`tech_count` = '". $TTechCount ."', "; + $QryInsertStats .= "`tech_old_rank` = '". $OldTechRank ."', "; + $QryInsertStats .= "`build_points` = '". $TBuildPoints ."', "; + $QryInsertStats .= "`build_count` = '". $TBuildCount ."', "; + $QryInsertStats .= "`build_old_rank` = '". $OldBuildRank ."', "; + $QryInsertStats .= "`defs_points` = '". $TDefsPoints ."', "; + $QryInsertStats .= "`defs_count` = '". $TDefsCount ."', "; + $QryInsertStats .= "`defs_old_rank` = '". $OldDefsRank ."', "; + $QryInsertStats .= "`fleet_points` = '". $TFleetPoints ."', "; + $QryInsertStats .= "`fleet_count` = '". $TFleetCount ."', "; + $QryInsertStats .= "`fleet_old_rank` = '". $OldFleetRank ."', "; + $QryInsertStats .= "`total_points` = '". $GPoints ."', "; + $QryInsertStats .= "`total_count` = '". $GCount ."', "; + $QryInsertStats .= "`total_old_rank` = '". $OldTotalRank ."', "; + $QryInsertStats .= "`stat_date` = '". $StatDate ."';"; + doquery ( $QryInsertStats , 'statpoints'); + } + + $Rank = 1; + $RankQry = doquery("SELECT * FROM {{table}} WHERE `stat_type` = '1' AND `stat_code` = '1' ORDER BY `tech_points` DESC;", 'statpoints'); + while ($TheRank = mysql_fetch_assoc($RankQry) ) { + $QryUpdateStats = "UPDATE {{table}} SET "; + $QryUpdateStats .= "`tech_rank` = '". $Rank ."' "; + $QryUpdateStats .= "WHERE "; + $QryUpdateStats .= " `stat_type` = '1' AND `stat_code` = '1' AND `id_owner` = '". $TheRank['id_owner'] ."';"; + doquery ( $QryUpdateStats , 'statpoints'); + $Rank++; + } + + $Rank = 1; + $RankQry = doquery("SELECT * FROM {{table}} WHERE `stat_type` = '1' AND `stat_code` = '1' ORDER BY `build_points` DESC;", 'statpoints'); + while ($TheRank = mysql_fetch_assoc($RankQry) ) { + $QryUpdateStats = "UPDATE {{table}} SET "; + $QryUpdateStats .= "`build_rank` = '". $Rank ."' "; + $QryUpdateStats .= "WHERE "; + $QryUpdateStats .= " `stat_type` = '1' AND `stat_code` = '1' AND `id_owner` = '". $TheRank['id_owner'] ."';"; + doquery ( $QryUpdateStats , 'statpoints'); + $Rank++; + } + + $Rank = 1; + $RankQry = doquery("SELECT * FROM {{table}} WHERE `stat_type` = '1' AND `stat_code` = '1' ORDER BY `defs_points` DESC;", 'statpoints'); + while ($TheRank = mysql_fetch_assoc($RankQry) ) { + $QryUpdateStats = "UPDATE {{table}} SET "; + $QryUpdateStats .= "`defs_rank` = '". $Rank ."' "; + $QryUpdateStats .= "WHERE "; + $QryUpdateStats .= " `stat_type` = '1' AND `stat_code` = '1' AND `id_owner` = '". $TheRank['id_owner'] ."';"; + doquery ( $QryUpdateStats , 'statpoints'); + $Rank++; + } + + $Rank = 1; + $RankQry = doquery("SELECT * FROM {{table}} WHERE `stat_type` = '1' AND `stat_code` = '1' ORDER BY `fleet_points` DESC;", 'statpoints'); + while ($TheRank = mysql_fetch_assoc($RankQry) ) { + $QryUpdateStats = "UPDATE {{table}} SET "; + $QryUpdateStats .= "`fleet_rank` = '". $Rank ."' "; + $QryUpdateStats .= "WHERE "; + $QryUpdateStats .= " `stat_type` = '1' AND `stat_code` = '1' AND `id_owner` = '". $TheRank['id_owner'] ."';"; + doquery ( $QryUpdateStats , 'statpoints'); + $Rank++; + } + + $Rank = 1; + $RankQry = doquery("SELECT * FROM {{table}} WHERE `stat_type` = '1' AND `stat_code` = '1' ORDER BY `total_points` DESC;", 'statpoints'); + while ($TheRank = mysql_fetch_assoc($RankQry) ) { + $QryUpdateStats = "UPDATE {{table}} SET "; + $QryUpdateStats .= "`total_rank` = '". $Rank ."' "; + $QryUpdateStats .= "WHERE "; + $QryUpdateStats .= " `stat_type` = '1' AND `stat_code` = '1' AND `id_owner` = '". $TheRank['id_owner'] ."';"; + doquery ( $QryUpdateStats , 'statpoints'); + $Rank++; + } + + // Statistiques des alliances ... + $GameAllys = doquery("SELECT * FROM {{table}}", 'alliance'); + + while ($CurAlly = mysql_fetch_assoc($GameAllys)) { + // Recuperation des anciennes statistiques + $OldStatRecord = doquery ("SELECT * FROM {{table}} WHERE `stat_type` = '2' AND `id_owner` = '".$CurAlly['id']."';",'statpoints'); + if ($OldStatRecord) { + $OldTotalRank = $OldStatRecord['total_rank']; + $OldTechRank = $OldStatRecord['tech_rank']; + $OldBuildRank = $OldStatRecord['build_rank']; + $OldDefsRank = $OldStatRecord['defs_rank']; + $OldFleetRank = $OldStatRecord['fleet_rank']; + // Suppression de l'ancien enregistrement + doquery ("DELETE FROM {{table}} WHERE `stat_type` = '2' AND `id_owner` = '".$CurAlly['id']."';",'statpoints'); + } else { + $OldTotalRank = 0; + $OldTechRank = 0; + $OldBuildRank = 0; + $OldDefsRank = 0; + $OldFleetRank = 0; + } + + // Total des unitées consommée pour la recherche + $QrySumSelect = "SELECT "; + $QrySumSelect .= "SUM(`tech_points`) as `TechPoint`, "; + $QrySumSelect .= "SUM(`tech_count`) as `TechCount`, "; + $QrySumSelect .= "SUM(`build_points`) as `BuildPoint`, "; + $QrySumSelect .= "SUM(`build_count`) as `BuildCount`, "; + $QrySumSelect .= "SUM(`defs_points`) as `DefsPoint`, "; + $QrySumSelect .= "SUM(`defs_count`) as `DefsCount`, "; + $QrySumSelect .= "SUM(`fleet_points`) as `FleetPoint`, "; + $QrySumSelect .= "SUM(`fleet_count`) as `FleetCount`, "; + $QrySumSelect .= "SUM(`total_points`) as `TotalPoint`, "; + $QrySumSelect .= "SUM(`total_count`) as `TotalCount` "; + $QrySumSelect .= "FROM {{table}} "; + $QrySumSelect .= "WHERE "; + $QrySumSelect .= "`stat_type` = '1' AND "; + $QrySumSelect .= "`id_ally` = '". $CurAlly['id'] ."';"; + $Points = doquery( $QrySumSelect, 'statpoints', true); + + $TTechCount = $Points['TechCount']; + $TTechPoints = $Points['TechPoint']; + $TBuildCount = $Points['BuildCount']; + $TBuildPoints = $Points['BuildPoint']; + $TDefsCount = $Points['DefsCount']; + $TDefsPoints = $Points['DefsPoint']; + $TFleetCount = $Points['FleetCount']; + $TFleetPoints = $Points['FleetPoint']; + $GCount = $Points['TotalCount']; + $GPoints = $Points['TotalPoint']; + + $QryInsertStats = "INSERT INTO {{table}} SET "; + $QryInsertStats .= "`id_owner` = '". $CurAlly['id'] ."', "; + $QryInsertStats .= "`id_ally` = '0', "; + $QryInsertStats .= "`stat_type` = '2', "; // 1 pour joueur , 2 pour alliance + $QryInsertStats .= "`stat_code` = '1', "; // de 1 a 5 mis a jour de maniere automatique + $QryInsertStats .= "`tech_points` = '". $TTechPoints ."', "; + $QryInsertStats .= "`tech_count` = '". $TTechCount ."', "; + $QryInsertStats .= "`tech_old_rank` = '". $OldTechRank ."', "; + $QryInsertStats .= "`build_points` = '". $TBuildPoints ."', "; + $QryInsertStats .= "`build_count` = '". $TBuildCount ."', "; + $QryInsertStats .= "`build_old_rank` = '". $OldBuildRank ."', "; + $QryInsertStats .= "`defs_points` = '". $TDefsPoints ."', "; + $QryInsertStats .= "`defs_count` = '". $TDefsCount ."', "; + $QryInsertStats .= "`defs_old_rank` = '". $OldDefsRank ."', "; + $QryInsertStats .= "`fleet_points` = '". $TFleetPoints ."', "; + $QryInsertStats .= "`fleet_count` = '". $TFleetCount ."', "; + $QryInsertStats .= "`fleet_old_rank` = '". $OldFleetRank ."', "; + $QryInsertStats .= "`total_points` = '". $GPoints ."', "; + $QryInsertStats .= "`total_count` = '". $GCount ."', "; + $QryInsertStats .= "`total_old_rank` = '". $OldTotalRank ."', "; + $QryInsertStats .= "`stat_date` = '". $StatDate ."';"; + doquery ( $QryInsertStats , 'statpoints'); + } + + AdminMessage ( $lang['adm_done'], $lang['adm_stat_title'] ); + +} else { + AdminMessage ( $lang['sys_noalloaw'], $lang['sys_noaccess'] ); +} + diff --git a/admin/statfunctions.php b/admin/statfunctions.php new file mode 100644 index 0000000..0e1ea28 --- /dev/null +++ b/admin/statfunctions.php @@ -0,0 +1,107 @@ + + * All rights reserved. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + * --> NOTICE <-- + * This file is part of the core development branch, changing its contents will + * make you unable to use the automatic updates manager. Please refer to the + * documentation for further information about customizing XNova. + * + */ + +function GetTechnoPoints ( $CurrentUser ) { + global $resource, $pricelist, $reslist; + + $TechCounts = 0; + $TechPoints = 0; + foreach ( $reslist['tech'] as $n => $Techno ) { + if ( $CurrentUser[ $resource[ $Techno ] ] > 0 ) { + for ( $Level = 1; $Level < $CurrentUser[ $resource[ $Techno ] ]; $Level++ ) { + $Units = $pricelist[ $Techno ]['metal'] + $pricelist[ $Techno ]['crystal'] + $pricelist[ $Techno ]['deuterium']; + $LevelMul = pow( $pricelist[ $Techno ]['factor'], $Level ); + $TechPoints += ($Units * $LevelMul); + $TechCounts += 1; + } + } + } + $RetValue['TechCount'] = $TechCounts; + $RetValue['TechPoint'] = $TechPoints; + + return $RetValue; +} + +function GetBuildPoints ( $CurrentPlanet ) { + global $resource, $pricelist, $reslist; + + $BuildCounts = 0; + $BuildPoints = 0; + foreach($reslist['build'] as $n => $Building) { + if ( $CurrentPlanet[ $resource[ $Building ] ] > 0 ) { + for ( $Level = 1; $Level < $CurrentPlanet[ $resource[ $Building ] ]; $Level++ ) { + $Units = $pricelist[ $Building ]['metal'] + $pricelist[ $Building ]['crystal'] + $pricelist[ $Building ]['deuterium']; + $LevelMul = pow( $pricelist[ $Building ]['factor'], $Level ); + $BuildPoints += ($Units * $LevelMul); + $BuildCounts += 1; + } + } + } + $RetValue['BuildCount'] = $BuildCounts; + $RetValue['BuildPoint'] = $BuildPoints; + + return $RetValue; +} + +function GetDefensePoints ( $CurrentPlanet ) { + global $resource, $pricelist, $reslist; + + $DefenseCounts = 0; + $DefensePoints = 0; + foreach($reslist['defense'] as $n => $Defense) { + if ($CurrentPlanet[ $resource[ $Defense ] ] > 0) { + $Units = $pricelist[ $Defense ]['metal'] + $pricelist[ $Defense ]['crystal'] + $pricelist[ $Defense ]['deuterium']; + $DefensePoints += ($Units * $CurrentPlanet[ $resource[ $Defense ] ]); + $DefenseCounts += $CurrentPlanet[ $resource[ $Defense ] ]; + } + } + $RetValue['DefenseCount'] = $DefenseCounts; + $RetValue['DefensePoint'] = $DefensePoints; + + return $RetValue; +} + +function GetFleetPoints ( $CurrentPlanet ) { + global $resource, $pricelist, $reslist; + + $FleetCounts = 0; + $FleetPoints = 0; + foreach($reslist['fleet'] as $n => $Fleet) { + if ($CurrentPlanet[ $resource[ $Fleet ] ] > 0) { + $Units = $pricelist[ $Fleet ]['metal'] + $pricelist[ $Fleet ]['crystal'] + $pricelist[ $Fleet ]['deuterium']; + $FleetPoints += ($Units * $CurrentPlanet[ $resource[ $Fleet ] ]); + $FleetCounts += $CurrentPlanet[ $resource[ $Fleet ] ]; + } + } + $RetValue['FleetCount'] = $FleetCounts; + $RetValue['FleetPoint'] = $FleetPoints; + + return $RetValue; +} \ No newline at end of file diff --git a/admin/unbanned.php b/admin/unbanned.php new file mode 100644 index 0000000..8636506 --- /dev/null +++ b/admin/unbanned.php @@ -0,0 +1,57 @@ + + * All rights reserved. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + * --> NOTICE <-- + * This file is part of the core development branch, changing its contents will + * make you unable to use the automatic updates manager. Please refer to the + * documentation for further information about customizing XNova. + * + */ + +define('INSIDE' , true); +define('INSTALL' , false); +define('IN_ADMIN', true); +require_once dirname(dirname(__FILE__)) .'/common.php'; + + if (in_array($user['authlevel'], array(LEVEL_ADMIN, LEVEL_OPERATOR))) { + + $parse['dpath'] = $dpath; + $parse = $lang; + + $mode = $_GET['mode']; + + if ($mode != 'change') { + $parse['Name'] = "Nom du joueur"; + } elseif ($mode == 'change') { + $nam = $_POST['nam']; + doquery("DELETE FROM {{table}} WHERE who2='{$nam}'", 'banned'); + doquery("UPDATE {{table}} SET bana=0, banaday=0 WHERE username='{$nam}'", "users"); + message("Le joueur {$nam} a bien été débanni!", 'Information'); + } + + display(parsetemplate(gettemplate('admin/unbanned'), $parse), "Overview", false, '', true); + } else { + message( $lang['sys_noalloaw'], $lang['sys_noaccess'] ); + } + +?> \ No newline at end of file diff --git a/admin/userlist.php b/admin/userlist.php new file mode 100644 index 0000000..922b23a --- /dev/null +++ b/admin/userlist.php @@ -0,0 +1,89 @@ + + * All rights reserved. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + * --> NOTICE <-- + * This file is part of the core development branch, changing its contents will + * make you unable to use the automatic updates manager. Please refer to the + * documentation for further information about customizing XNova. + * + */ + +define('INSIDE' , true); +define('INSTALL' , false); +define('IN_ADMIN', true); +require_once dirname(dirname(__FILE__)) .'/common.php'; + + if (in_array($user['authlevel'], array(LEVEL_ADMIN, LEVEL_OPERATOR))) { + includeLang('admin'); + if ($_GET['cmd'] == 'dele') { + DeleteSelectedUser ( $_GET['user'] ); + } + if ($_GET['cmd'] == 'sort') { + $TypeSort = $_GET['type']; + } else { + $TypeSort = "id"; + } + + $PageTPL = gettemplate('admin/userlist_body'); + $RowsTPL = gettemplate('admin/userlist_rows'); + + $query = doquery("SELECT * FROM {{table}} ORDER BY `". $TypeSort ."` ASC", 'users'); + + $parse = $lang; + $parse['adm_ul_table'] = ""; + $i = 0; + $Color = "lime"; + while ($u = mysql_fetch_assoc ($query) ) { + if ($PrevIP != "") { + if ($PrevIP == $u['user_lastip']) { + $Color = "red"; + } else { + $Color = "lime"; + } + } + + $Bloc['adm_ul_data_id'] = $u['id']; + $Bloc['adm_ul_data_name'] = $u['username']; + $Bloc['adm_ul_data_mail'] = $u['email']; + $Bloc['ip_adress_at_register'] = $u['ip_at_reg']; + $Bloc['adm_ul_data_adip'] = "". $u['user_lastip'] .""; + $Bloc['adm_ul_data_regd'] = gmdate ( "d/m/Y G:i:s", $u['register_time'] ); + $Bloc['adm_ul_data_lconn'] = gmdate ( "d/m/Y G:i:s", $u['onlinetime'] ); + $Bloc['adm_ul_data_banna'] = ( $u['bana'] == 1 ) ? "". $lang['adm_ul_yes'] ."" : $lang['adm_ul_no']; + $Bloc['adm_ul_data_detai'] = ""; // Lien vers une page de details genre Empire + $Bloc['adm_ul_data_actio'] = ""; // Lien vers actions 'effacer' + + + $PrevIP = $u['user_lastip']; + $parse['adm_ul_table'] .= parsetemplate( $RowsTPL, $Bloc ); + $i++; + } + $parse['adm_ul_count'] = $i; + + $page = parsetemplate( $PageTPL, $parse ); + display( $page, $lang['adm_ul_title'], false, '', true); + } else { + message( $lang['sys_noalloaw'], $lang['sys_noaccess'] ); + } + +?> \ No newline at end of file diff --git a/admin/variables.php b/admin/variables.php new file mode 100644 index 0000000..10599ea --- /dev/null +++ b/admin/variables.php @@ -0,0 +1,47 @@ + + * All rights reserved. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + * --> NOTICE <-- + * This file is part of the core development branch, changing its contents will + * make you unable to use the automatic updates manager. Please refer to the + * documentation for further information about customizing XNova. + * + */ + +define('INSIDE' , true); +define('INSTALL' , false); +define('IN_ADMIN', true); +require_once dirname(dirname(__FILE__)) .'/common.php'; + + if (in_array($user['authlevel'], array(LEVEL_ADMIN, LEVEL_OPERATOR, LEVEL_MODERATOR))) { + + $parse['phpinfo'] = phpinfo(); + + $Page = parsetemplate($PageTPL, $parse); + + display ( $Page, "PhpInfo", false, '', true); + } else { + AdminMessage ( $lang['sys_noalloaw'], $lang['sys_noaccess'] ); + } + +?> diff --git a/ainfo.php b/ainfo.php new file mode 100644 index 0000000..3c70731 --- /dev/null +++ b/ainfo.php @@ -0,0 +1,71 @@ + + * All rights reserved. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + * --> NOTICE <-- + * This file is part of the core development branch, changing its contents will + * make you unable to use the automatic updates manager. Please refer to the + * documentation for further information about customizing XNova. + * + */ + +define('INSIDE' , true); +define('INSTALL' , false); +require_once dirname(__FILE__) .'/common.php'; + +$dpath = (!$userrow["dpath"]) ? DEFAULT_SKINPATH : $userrow["dpath"]; + + +if(!is_numeric($_GET["a"]) || !$_GET["a"] ){ message("Ungültige Allianz-ID","Fehler");} + +$allyrow = doquery("SELECT ally_name,ally_tag,ally_description,ally_web,ally_image FROM {{table}} WHERE id=".$_GET["a"],"alliance",true); + +if(!$allyrow){ message("Alliance non trouvée","Erreur");} + +$count = doquery("SELECT COUNT(DISTINCT(id)) FROM {{table}} WHERE ally_id=".$_GET["a"].";","users",true); +$ally_member_scount = $count[0]; + +$page .=""; + + if($allyrow["ally_image"] != ""){ + $page .= ""; + } + + $page .= ""; + + if($allyrow["ally_description"] != ""){ + $page .= ""; + } + + + if($allyrow["ally_web"] != ""){ + $page .=" + + + "; + } + $page .= "
Informations sur l'alliance
Tag".$allyrow["ally_tag"]."
Nom".$allyrow["ally_name"]."
Membres$ally_member_scount
".$allyrow["ally_description"]."
Site internet".$allyrow["ally_web"]."
"; + + display($page,"Information sur l'alliance [".$allyrow["ally_name"]."]",false); + +// Created by Perberos. All rights reversed (C) 2006 +?> \ No newline at end of file diff --git a/alliance.php b/alliance.php new file mode 100644 index 0000000..861d312 --- /dev/null +++ b/alliance.php @@ -0,0 +1,1199 @@ + + * All rights reserved. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + * --> NOTICE <-- + * This file is part of the core development branch, changing its contents will + * make you unable to use the automatic updates manager. Please refer to the + * documentation for further information about customizing XNova. + * + */ + +define('INSTALL' , false); + +$mode = $_GET['mode']; +if (empty($mode)) { unset($mode); } +$a = intval($_GET['a']); +if (empty($a)) { unset($a); } +$sort1 = intval($_GET['sort1']); +if (empty($sort1)) { unset($sort1); } +$sort2 = intval($_GET['sort2']); +if (empty($sort2)) { unset($sort2); } +$d = $_GET['d']; +if ((!is_numeric($d)) || (empty($d) && $d != 0)) + unset($d); + +$edit = $_GET['edit']; + +if (empty($edit)) + unset($edit); + +$rank = intval($_GET['rank']); +if (empty($rank)) + unset($rank); + +$kick = intval($_GET['kick']); +if (empty($kick)) + unset($kick); + +$id = intval($_GET['id']); +if (empty($id)) + unset($id); + +define('INSIDE' , true); +require_once dirname(__FILE__) .'/common.php'; + + +if(empty($user['id'])){ +echo ''; +} + +$mode = $_GET['mode']; +$yes = $_GET['yes']; +$edit = $_GET['edit']; +$allyid = intval($_GET['allyid']); +$show = intval($_GET['show']); +$sort = intval($_GET['sort']); +$sendmail = intval($_GET['sendmail']); +$t = $_GET['t']; +$a = intval($_GET['a']); +$tag = mysql_escape_string($_GET['tag']); + +includeLang('alliance'); + + +/* + Alianza consiste en tres partes. + La primera es la comun. Es decir, no se necesita comprobar si se esta en una alianza o no. + La segunda, es sin alianza. Eso implica las solicitudes. + La ultima, seria cuando ya se esta dentro de una. +*/ +// Parte inicial. + +if ($_GET['mode'] == 'ainfo') { + $a = intval($_GET['a']); + $tag = mysql_escape_string($_GET['tag']); + // Evitamos errores casuales xD + // query + $lang['Alliance_information'] = "Information Alliance"; + + if (isset($_GET['tag'])) { + $allyrow = doquery("SELECT * FROM {{table}} WHERE ally_tag='{$tag}'", "alliance", true); + } elseif (is_numeric($a) && $a != 0) { + $allyrow = doquery("SELECT * FROM {{table}} WHERE id='{$a}'", "alliance", true); + } else { + message("Cette alliance n'existe pas !", "Information Alliance (1)"); + } + // Si no existe + if (!$allyrow) { + message("Cette alliance n'existe pas !", "Information Alliance (1)"); + } + extract($allyrow); + + if ($ally_image != "") { + $ally_image = ""; + } + + if ($ally_description != "") { + $ally_description = "{$ally_description}"; + } else + $ally_description = "Il n'y as aucune descriptions de cette alliance."; + + if ($ally_web != "") { + $ally_web = " + {$lang['Initial_page']} + {$ally_web} + "; + } + + $lang['ally_member_scount'] = $ally_members; + $lang['ally_name'] = $ally_name; + $lang['ally_tag'] = $ally_tag; + // codigo raro + $patterns[] = "#\[fc\]([a-z0-9\#]+)\[/fc\](.*?)\[/f\]#Ssi"; + $replacements[] = '\2'; + $patterns[] = '#\[img\](.*?)\[/img\]#Smi'; + $replacements[] = '\1'; + $patterns[] = "#\[fc\]([a-z0-9\#\ \[\]]+)\[/fc\]#Ssi"; + $replacements[] = ''; + $patterns[] = "#\[/f\]#Ssi"; + $replacements[] = ''; + $ally_description = preg_replace($patterns, $replacements, $ally_description); + + $lang['ally_description'] = nl2br($ally_description); + $lang['ally_image'] = $ally_image; + $lang['ally_web'] = $ally_web; + + if ($user['ally_id'] == 0) { + $lang['bewerbung'] = " + Candidature + Cliquer ici pour ecrire votre candidature + + "; + } else + $lang['bewerbung'] = "Candidature"; + + $page .= parsetemplate(gettemplate('alliance_ainfo'), $lang); + display($page, str_replace('%s', $ally_name, $lang['Info_of_Alliance'])); +} +// --[Comprobaciones de alianza]------------------------- +if ($user['ally_id'] == 0) { // Sin alianza + if ($mode == 'make' && $user['ally_request'] == 0) { // Make alliance + /* + Aca se crean las alianzas... + */ + if ($yes == 1 && $_POST) { + /* + Por el momento solo estoy improvisando, luego se perfeccionara el sistema :) + Creo que aqui se realiza una query para comprovar el nombre, y luego le pregunta si es el tag correcto... + */ + if (!$_POST['atag']) { + message($lang['have_not_tag'], $lang['make_alliance']); + } + if (!$_POST['aname']) { + message($lang['have_not_name'], $lang['make_alliance']); + } + $_POST['aname']=addslashes($_POST['aname']); + $_POST['atag']=addslashes($_POST['atag']); + + $tagquery = doquery("SELECT * FROM {{table}} WHERE ally_tag='{$_POST['atag']}'", 'alliance', true); + + if ($tagquery) { + message(str_replace('%s', $_POST['atag'], $lang['always_exist']), $lang['make_alliance']); + } + + doquery("INSERT INTO {{table}} SET + `ally_name`='{$_POST['aname']}', + `ally_tag`='{$_POST['atag']}' , + `ally_owner`='{$user['id']}', + `ally_owner_range`='Leader', + `ally_members`='1', + `ally_register_time`=" . time() , "alliance"); + + $allyquery = doquery("SELECT * FROM {{table}} WHERE ally_tag='{$_POST['atag']}'", 'alliance', true); + + doquery("UPDATE {{table}} SET + `ally_id`='{$allyquery['id']}', + `ally_name`='{$allyquery['ally_name']}', + `ally_register_time`='" . time() . "' + WHERE `id`='{$user['id']}'", "users"); + + $page = MessageForm(str_replace('%s', $_POST['atag'], $lang['ally_maked']), + + str_replace('%s', $_POST['atag'], $lang['alliance_has_been_maked']) . "

", "", $lang['Ok']); + } else { + $page .= parsetemplate(gettemplate('alliance_make'), $lang); + } + + display($page, $lang['make_alliance']); + } + + if ($mode == 'search' && $user['ally_request'] == 0) { // search one + + $parse = $lang; + $lang['searchtext'] = $_POST['searchtext']; + $page = parsetemplate(gettemplate('alliance_searchform'), $lang); + + if ($_POST) { // esta parte es igual que el buscador de search.php... + // searchtext + $search = doquery("SELECT * FROM {{table}} WHERE ally_name LIKE '%{$_POST['searchtext']}%' or ally_tag LIKE '%{$_POST['searchtext']}%' LIMIT 30", "alliance"); + + if (mysql_num_rows($search) != 0) { + $template = gettemplate('alliance_searchresult_row'); + + while ($s = mysql_fetch_array($search)) { + $entry = array(); + $entry['ally_tag'] = "[{$s['ally_tag']}]"; + $entry['ally_name'] = $s['ally_name']; + $entry['ally_members'] = $s['ally_members']; + + $parse['result'] .= parsetemplate($template, $entry); + } + + $page .= parsetemplate(gettemplate('alliance_searchresult_table'), $parse); + } + } + + display($page, $lang['search_alliance']); + } + + if ($mode == 'apply' && $user['ally_request'] == 0) { // solicitudes + if (!is_numeric($_GET['allyid']) || !$_GET['allyid'] || $user['ally_request'] != 0 || $user['ally_id'] != 0) { + message($lang['it_is_not_posible_to_apply'], $lang['it_is_not_posible_to_apply']); + } + // pedimos la info de la alianza + $allyrow = doquery("SELECT ally_tag,ally_request FROM {{table}} WHERE id='" . intval($_GET['allyid']) . "'", "alliance", true); + + if (!$allyrow) { + message($lang['it_is_not_posible_to_apply'], $lang['it_is_not_posible_to_apply']); + } + + extract($allyrow); + + if ($_POST['further'] == $lang['Send']) { // esta parte es igual que el buscador de search.php... + doquery("UPDATE {{table}} SET `ally_request`='" . intval($allyid) . "', ally_request_text='" . mysql_escape_string(strip_tags($_POST['text'])) . "', ally_register_time='" . time() . "' WHERE `id`='" . $user['id'] . "'", "users"); + // mensaje de cuando se envia correctamente el mensaje + message($lang['apply_registered'], $lang['your_apply']); + // mensaje de cuando falla el envio + // message($lang['apply_cantbeadded'], $lang['your_apply']); + } else { + $text_apply = ($ally_request) ? $ally_request : $lang['There_is_no_a_text_apply']; + } + + $parse = $lang; + $parse['allyid'] = intval($_GET['allyid']); + $parse['chars_count'] = strlen($text_apply); + $parse['text_apply'] = $text_apply; + $parse['Write_to_alliance'] = str_replace('%s', $ally_tag, $lang['Write_to_alliance']); + + $page = parsetemplate(gettemplate('alliance_applyform'), $parse); + + display($page, $lang['Write_to_alliance']); + } + + if ($user['ally_request'] != 0) { // Esperando una respuesta + // preguntamos por el ally_tag + $allyquery = doquery("SELECT ally_tag FROM {{table}} WHERE id='" . intval($user['ally_request']) . "' ORDER BY `id`", "alliance", true); + + extract($allyquery); + if ($_POST['bcancel']) { + doquery("UPDATE {{table}} SET `ally_request`=0 WHERE `id`=" . $user['id'], "users"); + + $lang['request_text'] = str_replace('%s', $ally_tag, $lang['Canceled_a_request_text']); + $lang['button_text'] = $lang['Ok']; + $page = parsetemplate(gettemplate('alliance_apply_waitform'), $lang); + } else { + $lang['request_text'] = str_replace('%s', $ally_tag, $lang['Waiting_a_request_text']); + $lang['button_text'] = $lang['Delete_apply']; + $page = parsetemplate(gettemplate('alliance_apply_waitform'), $lang); + } + // mysql_escape_string(strip_tags()); + display($page, "Deine Anfrage"); + } else { // Vista sin allianza + /* + Vista normal de cuando no se tiene ni solicitud ni alianza + */ + $page .= parsetemplate(gettemplate('alliance_defaultmenu'), $lang); + display($page, $lang['alliance']); + } +} + +//--------------------------------------------------------------------------------------------------------------------------------------------------- +// Parte de adentro de la alianza +elseif ($user['ally_id'] != 0 && $user['ally_request'] == 0) { // Con alianza + + $ally = doquery("SELECT * FROM {{table}} WHERE id='{$user['ally_id']}'", "alliance", true); + + $ally_ranks = unserialize($ally['ally_ranks']); + + $allianz_raenge = unserialize($ally['ally_ranks']); + + if ($allianz_raenge[$user['ally_rank_id']-1]['onlinestatus'] == 1 || $ally['ally_owner'] == $user['id']) { + $user_can_watch_memberlist_status = true; + } else + $user_can_watch_memberlist_status = false; + + if ($allianz_raenge[$user['ally_rank_id']-1]['memberlist'] == 1 || $ally['ally_owner'] == $user['id']) { + $user_can_watch_memberlist = true; + } else + $user_can_watch_memberlist = false; + + if ($allianz_raenge[$user['ally_rank_id']-1]['mails'] == 1 || $ally['ally_owner'] == $user['id']) { + $user_can_send_mails = true; + } else + $user_can_send_mails = false; + + if ($allianz_raenge[$user['ally_rank_id']-1]['kick'] == 1 || $ally['ally_owner'] == $user['id']) { + $user_can_kick = true; + } else + $user_can_kick = false; + + if ($allianz_raenge[$user['ally_rank_id']-1]['rechtehand'] == 1 || $ally['ally_owner'] == $user['id']) + $user_can_edit_rights = true; + else + $user_can_edit_rights = false; + + if ($allianz_raenge[$user['ally_rank_id']-1]['delete'] == 1 || $ally['ally_owner'] == $user['id']) + $user_can_exit_alliance = true; + else + $user_can_exit_alliance = false; + + if ($allianz_raenge[$user['ally_rank_id']-1]['bewerbungen'] == 1 || $ally['ally_owner'] == $user['id']) + $user_bewerbungen_einsehen = true; + else + $user_bewerbungen_einsehen = false; + + if ($allianz_raenge[$user['ally_rank_id']-1]['bewerbungenbearbeiten'] == 1 || $ally['ally_owner'] == $user['id']) + $user_bewerbungen_bearbeiten = true; + else + $user_bewerbungen_bearbeiten = false; + + if ($allianz_raenge[$user['ally_rank_id']-1]['administrieren'] == 1 || $ally['ally_owner'] == $user['id']) + $user_admin = true; + else + $user_admin = false; + + if ($allianz_raenge[$user['ally_rank_id']-1]['onlinestatus'] == 1 || $ally['ally_owner'] == $user['id']) + $user_onlinestatus = true; + else + $user_onlinestatus = false; + + if (!$ally) { + doquery("UPDATE {{table}} SET `ally_name`='',`ally_id`=0 WHERE `id`='{$user['id']}'", "users"); + message($lang['ally_notexist'], $lang['your_alliance'], 'alliance.php'); + } + + if ($mode == 'exit') { + if ($ally['ally_owner'] == $user['id']) { + message($lang['Owner_cant_go_out'], $lang['Alliance']); + } + // se sale de la alianza + if ($_GET['yes'] == 1) { + doquery("UPDATE {{table}} SET `ally_id`=0, `ally_name` = '' WHERE `id`='{$user['id']}'", "users"); + $lang['Go_out_welldone'] = str_replace("%s", $ally_name, $lang['Go_out_welldone']); + $page = MessageForm($lang['Go_out_welldone'], "
", $PHP_SELF, $lang['Ok']); + // Se quitan los puntos del user en la alianza + } else { + // se pregunta si se quiere salir + $lang['Want_go_out'] = str_replace("%s", $ally_name, $lang['Want_go_out']); + $page = MessageForm($lang['Want_go_out'], "
", "?mode=exit&yes=1", "Oui"); + } + display($page); + } + + if ($mode == 'memberslist') { // Lista de miembros. + /* + Lista de miembros. + Por lo que parece solo se hace una query fijandose los usuarios con el mismo ally_id. + seguido del query del planeta principal de cada uno para sacarle la posicion, pero + voy a ver si tambien agrego las cordenadas en el id user... + */ + // obtenemos el array de los rangos + // $ally_ranks = unserialize($ally['ally_ranks']); + $allianz_raenge = unserialize($ally['ally_ranks']); + // $user_can_watch_memberlist + // comprobamos el permiso + if ($ally['ally_owner'] != $user['id'] && !$user_can_watch_memberlist) { + message($lang['Denied_access'], $lang['Members_list']); + } + // El orden de aparicion + if ($sort2) { + $sort1 = intval($_GET['sort1']); + $sort2 = intval($_GET['sort2']); + + if ($sort1 == 1) { + $sort = " ORDER BY `username`"; + } elseif ($sort1 == 2) { + $sort = " ORDER BY `username`"; + } elseif ($sort1 == 4) { + $sort = " ORDER BY `ally_register_time`"; + } elseif ($sort1 == 5) { + $sort = " ORDER BY `onlinetime`"; + } else { + $sort = " ORDER BY `id`"; + } + + if ($sort2 == 1) { + $sort .= " DESC;"; + } elseif ($sort2 == 2) { + $sort .= " ASC;"; + } + $listuser = doquery("SELECT * FROM {{table}} WHERE ally_id='{$user['ally_id']}'{$sort}", 'users'); + } else { + $listuser = doquery("SELECT * FROM {{table}} WHERE ally_id='{$user['ally_id']}'", 'users'); + } + // contamos la cantidad de usuarios. + $i = 0; + // Como es costumbre. un row template + $template = gettemplate('alliance_memberslist_row'); + $page_list = ''; + while ($u = mysql_fetch_array($listuser)) { + $UserPoints = doquery("SELECT * FROM {{table}} WHERE `stat_type` = '1' AND `stat_code` = '1' AND `id_owner` = '" . $u['id'] . "';", 'statpoints', true); + + $i++; + $u['i'] = $i; + + if ($u["onlinetime"] + 60 * 10 >= time() && $user_can_watch_memberlist_status) { + $u["onlinetime"] = "lime>{$lang['On']}<"; + } elseif ($u["onlinetime"] + 60 * 20 >= time() && $user_can_watch_memberlist_status) { + $u["onlinetime"] = "yellow>{$lang['15_min']}<"; + } elseif ($user_can_watch_memberlist_status) { + $u["onlinetime"] = "red>{$lang['Off']}<"; + } else $u["onlinetime"] = "orange>-<"; + // Nombre de rango + if ($ally['ally_owner'] == $u['id']) { + $u["ally_range"] = ($ally['ally_owner_range'] == '')?"Leader":$ally['ally_owner_range']; + } elseif (isset($allianz_raenge[$u['ally_rank_id']]['name'])) { + $u["ally_range"] = $allianz_raenge[$u['ally_rank_id']]['name']; + } else { + $u["ally_range"] = $lang['Novate']; + } + + $u["dpath"] = $dpath; + $u['points'] = "" . pretty_number($UserPoints['total_points']) . ""; + + if ($u['ally_register_time'] > 0) + $u['ally_register_time'] = date("Y-m-d h:i:s", $u['ally_register_time']); + else + $u['ally_register_time'] = "-"; + + $page_list .= parsetemplate($template, $u); + } + // para cambiar el link de ordenar. + if ($sort2 == 1) { + $s = 2; + } elseif ($sort2 == 2) { + $s = 1; + } else { + $s = 1; + } + + if ($i != $ally['ally_members']) { + doquery("UPDATE {{table}} SET `ally_members`='{$i}' WHERE `id`='{$ally['id']}'", 'alliance'); + } + + $parse = $lang; + $parse['i'] = $i; + $parse['s'] = $s; + $parse['list'] = $page_list; + + $page .= parsetemplate(gettemplate('alliance_memberslist_table'), $parse); + + display($page, $lang['Members_list']); + } + + if ($mode == 'circular') { // Correo circular + /* + Mandar un correo circular. + creo que aqui tendria que ver yo como crear el sistema de mensajes... + */ + // un loop para mostrar losrangos + $allianz_raenge = unserialize($ally['ally_ranks']); + // comprobamos el permiso + if ($ally['ally_owner'] != $user['id'] && !$user_can_send_mails) { + message($lang['Denied_access'], $lang['Send_circular_mail']); + } + + if ($sendmail == 1) { + $_POST['r'] = intval($_POST['r']); + $_POST['text'] = mysql_escape_string(strip_tags($_POST['text'])); + + if ($_POST['r'] == 0) { + $sq = doquery("SELECT id,username FROM {{table}} WHERE ally_id='{$user['ally_id']}'", "users"); + } else { + $sq = doquery("SELECT id,username FROM {{table}} WHERE ally_id='{$user['ally_id']}' AND ally_rank_id='{$_POST['r']}'", "users"); + } + // looooooop + $list = ''; + while ($u = mysql_fetch_array($sq)) { + doquery("INSERT INTO {{table}} SET + `message_owner`='{$u['id']}', + `message_sender`='{$user['id']}' , + `message_time`='" . time() . "', + `message_type`='2', + `message_from`='{$ally['ally_tag']}', + `message_subject`='{$user['username']}', + `message_text`='{$_POST['text']}' + ", "messages"); + $list .= "
{$u['username']} "; + } + // doquery("SELECT id,username FROM {{table}} WHERE ally_id='{$user['ally_id']}' ORDER BY `id`","users"); + doquery("UPDATE {{table}} SET `new_message`=new_message+1 WHERE ally_id='{$user['ally_id']}' AND ally_rank_id='{$_POST['r']}'", "users"); + doquery("UPDATE {{table}} SET `mnl_alliance`=mnl_alliance+1 WHERE ally_id='{$user['ally_id']}' AND ally_rank_id='{$_POST['r']}'", "users"); + /* + Aca un mensajito diciendo que a quien se mando. + */ + $page = MessageForm($lang['Circular_sended'], "Les membres suivants ont re�u un message:" . $list, "alliance.php", $lang['Ok'], true); + display($page, $lang['Send_circular_mail']); + } + + $lang['r_list'] = ""; + if ($allianz_raenge) { + foreach($allianz_raenge as $id => $array) { + $lang['r_list'] .= ""; + } + } + + $page .= parsetemplate(gettemplate('alliance_circular'), $lang); + + display($page, $lang['Send_circular_mail']); + } + + if ($mode == 'admin' && $edit == 'rights') { // Administrar leyes + $allianz_raenge = unserialize($ally['ally_ranks']); + + if ($ally['ally_owner'] != $user['id'] && !$user_can_edit_rights) { + message($lang['Denied_access'], $lang['Members_list']); + } elseif (!empty($_POST['newrangname'])) { + $name = mysql_escape_string(strip_tags($_POST['newrangname'])); + + $allianz_raenge[] = array('name' => $name, + 'mails' => 0, + 'delete' => 0, + 'kick' => 0, + 'bewerbungen' => 0, + 'administrieren' => 0, + 'bewerbungenbearbeiten' => 0, + 'memberlist' => 0, + 'onlinestatus' => 0, + 'rechtehand' => 0 + ); + + $ranks = serialize($allianz_raenge); + + doquery("UPDATE {{table}} SET `ally_ranks`='" . $ranks . "' WHERE `id`=" . $ally['id'], "alliance"); + + $goto = $_SERVER['PHP_SELF'] . "?" . $_SERVER['QUERY_STRING']; + + header("Location: " . $goto); + exit(); + } elseif ($_POST['id'] != '' && is_array($_POST['id'])) { + $ally_ranks_new = array(); + + foreach ($_POST['id'] as $id) { + $name = $allianz_raenge[$id]['name']; + + $ally_ranks_new[$id]['name'] = $name; + + if (isset($_POST['u' . $id . 'r0'])) { + $ally_ranks_new[$id]['delete'] = 1; + } else { + $ally_ranks_new[$id]['delete'] = 0; + } + + if (isset($_POST['u' . $id . 'r1']) && $ally['ally_owner'] == $user['id']) { + $ally_ranks_new[$id]['kick'] = 1; + } else { + $ally_ranks_new[$id]['kick'] = 0; + } + + if (isset($_POST['u' . $id . 'r2'])) { + $ally_ranks_new[$id]['bewerbungen'] = 1; + } else { + $ally_ranks_new[$id]['bewerbungen'] = 0; + } + + if (isset($_POST['u' . $id . 'r3'])) { + $ally_ranks_new[$id]['memberlist'] = 1; + } else { + $ally_ranks_new[$id]['memberlist'] = 0; + } + + if (isset($_POST['u' . $id . 'r4'])) { + $ally_ranks_new[$id]['bewerbungenbearbeiten'] = 1; + } else { + $ally_ranks_new[$id]['bewerbungenbearbeiten'] = 0; + } + + if (isset($_POST['u' . $id . 'r5'])) { + $ally_ranks_new[$id]['administrieren'] = 1; + } else { + $ally_ranks_new[$id]['administrieren'] = 0; + } + + if (isset($_POST['u' . $id . 'r6'])) { + $ally_ranks_new[$id]['onlinestatus'] = 1; + } else { + $ally_ranks_new[$id]['onlinestatus'] = 0; + } + + if (isset($_POST['u' . $id . 'r7'])) { + $ally_ranks_new[$id]['mails'] = 1; + } else { + $ally_ranks_new[$id]['mails'] = 0; + } + + if (isset($_POST['u' . $id . 'r8'])) { + $ally_ranks_new[$id]['rechtehand'] = 1; + } else { + $ally_ranks_new[$id]['rechtehand'] = 0; + } + } + + $ranks = serialize($ally_ranks_new); + + doquery("UPDATE {{table}} SET `ally_ranks`='" . $ranks . "' WHERE `id`=" . $ally['id'], "alliance"); + + $goto = $_SERVER['PHP_SELF'] . "?" . $_SERVER['QUERY_STRING']; + + header("Location: " . $goto); + exit(); + } + // borrar una entrada + elseif (isset($d) && isset($ally_ranks[$d])) { + unset($ally_ranks[$d]); + $ally['ally_rank'] = serialize($ally_ranks); + + doquery("UPDATE {{table}} SET `ally_ranks`='{$ally['ally_rank']}' WHERE `id`={$ally['id']}", "alliance"); + } + + if (count($ally_ranks) == 0 || $ally_ranks == '') { // si no hay rangos + $list = "{$lang['There_is_not_range']}"; + } else { // Si hay rangos + // cargamos la template de tabla + $list = parsetemplate(gettemplate('alliance_admin_laws_head'), $lang); + $template = gettemplate('alliance_admin_laws_row'); + // Creamos la lista de rangos + $i = 0; + + foreach($ally_ranks as $a => $b) { + if ($ally['ally_owner'] == $user['id']) { + // $i++;u2r5 + $lang['id'] = $a; + $lang['delete'] = "\"{$lang['Delete_range']}\""; + $lang['r0'] = $b['name']; + $lang['a'] = $a; + $lang['r1'] = ""; //{$b[1]} + $lang['r2'] = ""; + $lang['r3'] = ""; + $lang['r4'] = ""; + $lang['r5'] = ""; + $lang['r6'] = ""; + $lang['r7'] = ""; + $lang['r8'] = ""; + $lang['r9'] = ""; + + $list .= parsetemplate($template, $lang); + } else { + $lang['id'] = $a; + $lang['r0'] = $b['name']; + $lang['delete'] = "\"{$lang['Delete_range']}\""; + $lang['a'] = $a; + $lang['r1'] = "-"; + $lang['r2'] = ""; + $lang['r3'] = ""; + $lang['r4'] = ""; + $lang['r5'] = ""; + $lang['r6'] = ""; + $lang['r7'] = ""; + $lang['r8'] = ""; + $lang['r9'] = ""; + + $list .= parsetemplate($template, $lang); + } + } + + if (count($ally_ranks) != 0) { + $list .= parsetemplate(gettemplate('alliance_admin_laws_feet'), $lang); + } + } + + $lang['list'] = $list; + $lang['dpath'] = $dpath; + $page .= parsetemplate(gettemplate('alliance_admin_laws'), $lang); + + display($page, $lang['Law_settings']); + } + + if ($mode == 'admin' && $edit == 'ally') { // Administrar la alianza *pendiente urgente* + if ($t != 1 && $t != 2 && $t != 3) { + $t = 1; + } + // post! + if ($_POST) { + if (!get_magic_quotes_gpc()) { + $_POST['owner_range'] = stripslashes($_POST['owner_range']); + $_POST['web'] = stripslashes($_POST['web']); + $_POST['image'] = stripslashes($_POST['image']); + $_POST['text'] = stripslashes($_POST['text']); + } + } + + if ($_POST['options']) { + $ally['ally_owner_range'] = mysql_escape_string(htmlspecialchars(strip_tags($_POST['owner_range']))); + + $ally['ally_web'] = mysql_escape_string(htmlspecialchars(strip_tags($_POST['web']))); + + $ally['ally_image'] = mysql_escape_string(htmlspecialchars(strip_tags($_POST['image']))); + + $ally['ally_request_notallow'] = intval($_POST['request_notallow']); + + if ($ally['ally_request_notallow'] != 0 && $ally['ally_request_notallow'] != 1) { + message("Aller � \"Candidature\" et sur une option dans le formulaire!", "Erreur"); + exit; + } + + doquery("UPDATE {{table}} SET + `ally_owner_range`='{$ally['ally_owner_range']}', + `ally_image`='{$ally['ally_image']}', + `ally_web`='{$ally['ally_web']}', + `ally_request_notallow`='{$ally['ally_request_notallow']}' + WHERE `id`='{$ally['id']}'", "alliance"); + } elseif ($_POST['t']) { + if ($t == 3) { + $ally['ally_request'] = mysql_escape_string(strip_tags($_POST['text'])); + + doquery("UPDATE {{table}} SET + `ally_request`='{$ally['ally_request']}' + WHERE `id`='{$ally['id']}'", "alliance"); + } elseif ($t == 2) { + $ally['ally_text'] = mysql_escape_string(strip_tags($_POST['text'])); + doquery("UPDATE {{table}} SET + `ally_text`='{$ally['ally_text']}' + WHERE `id`='{$ally['id']}'", "alliance"); + } else { + $ally['ally_description'] = mysql_escape_string(strip_tags(stripslashes($_POST['text']))); + + doquery("UPDATE {{table}} SET + `ally_description`='" . $ally['ally_description'] . "' + WHERE `id`='{$ally['id']}'", "alliance"); + } + } + $lang['dpath'] = $dpath; + /* + Depende del $t, muestra el formulario para cada tipo de texto. + */ + if ($t == 3) { + $lang['request_type'] = $lang['Show_of_request_text']; + } elseif ($t == 2) { + $lang['request_type'] = $lang['Internal_text_of_alliance']; + } else { + $lang['request_type'] = $lang['Public_text_of_alliance']; + } + + if ($t == 2) { + $lang['text'] = $ally['ally_text']; + $lang['Texts'] = "Interner Text"; + $lang['Show_of_request_text'] = "Internet Allianz Text"; + } else { + $lang['text'] = $ally['ally_description']; + } + + if ($t == 3) { + } + $lang['t'] = $t; + + $lang['ally_web'] = $ally['ally_web']; + $lang['ally_image'] = $ally['ally_image']; + $lang['ally_request_notallow_0'] = (($ally['ally_request_notallow'] == 1) ? ' SELECTED' : ''); + $lang['ally_request_notallow_1'] = (($ally['ally_request_notallow'] == 0) ? ' SELECTED' : ''); + $lang['ally_owner_range'] = $ally['ally_owner_range']; + $lang['Transfer_alliance'] = MessageForm("Abandonner / Transférer L'alliance", "", "?mode=admin&edit=give", $lang['Continue']); + $lang['Disolve_alliance'] = MessageForm("Dissoudre L'alliance", "", "?mode=admin&edit=exit", $lang['Continue']); + + $page .= parsetemplate(gettemplate('alliance_admin'), $lang); + display($page, $lang['Alliance_admin']); + } + + if ($mode == 'admin' && $edit == 'give') { + if ($_POST["id"]) { + doquery("update {{table}} set `ally_owner`='".$_POST["id"]."' where `id`='".$user['ally_id']."'",'alliance'); + } else { + $selection=doquery("SELECT * FROM {{table}} where ally_id='".$user['ally_id']."'",'users'); + $select=''; +while($data=mysql_fetch_array($selection)){ + $select.='