commit 13483caf833782561638b6ee0bd0fee0801ce433 Author: Daniel Winzen Date: Tue Mar 31 09:59:37 2015 +0200 Initial release diff --git a/COPYING b/COPYING new file mode 100644 index 0000000..94a9ed0 --- /dev/null +++ b/COPYING @@ -0,0 +1,674 @@ + 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/README b/README new file mode 100644 index 0000000..aa8948f --- /dev/null +++ b/README @@ -0,0 +1,78 @@ +LE CHAT-PHP - a PHP Chat based on LE CHAT + +Copyright (C) 2015 Daniel Winzen + +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 . + + +GENERAL INFORMATION: + +This is a PHP Chat based on LE CHAT v.1.14 . An up-to-date copy of this script can be downloaded at http://github.com/DanWin/le-chat-php +The original perl LE CHAT script by Lucky Eddie can be downloaded at http://4fvfamdpoulu2nms.onion/lechat/ or via a tor2web proxy like https://4fvfamdpoulu2nms.tor2web.blutmagie.de/lechat/ if you don't have TOR installed. +If you add your own cool features or have a feature request, please tell me and I will add them, if I like them. +Please also let me know about any bugs you find in the code, so I can fix them. +Now a piece of information about the origin of the name "LE CHAT" copied from the original script: +The "LE" in the name you can take as "Lucky Eddie", or since the script was meant to be lean and easy on server resources, as "Light Edition". +It may even be the French word for "the" if you prefer. Translated from French to English, "le chat" means: "the cat". + +FEATURES: + +Optimized for TOR +No JavaScript +Cookies supported, but not needed +Captcha +Multiple languages +Members and guests +Waiting room for guests +Moderatoral approval of new guests +Public, member, moderator and admin only chats +Private messages +Multi-line messages +Change font, colour and refresh rate in profile settings +Autologout when inactive for some time +Image and video embedding +Notes for admins and moderators +Clone the chat to have multiple tabs +Kick chatters +Clean selected messages +Clean the whole room +Plain text message filter +Regex message filter +And more + +INSTALLATION INSTRUCTIONS: + +You'll need to have mysql, php and a web-server installed. For the captcha feature, you also need php5-gd. +When you have everything installed, you'll have to create a database and a user for the chat in mysql. +Then edit the configuration at the bottom of the script to reflect the appropriate database settings and to modify the chat settings the way you like them. +Then copy the script to your web-server directory and call the script in your browser with a parameter like this: + http://(server)/(script-name).php?action=setup +Now you can create the Superadmin account. With this account you can administer the chat and add new members and set the guest access. +As soon as you are done with the setup, all necessary database tables will be created and the chat can be used. + +TRANSLATING: + +Copy lang_en.php and rename it to lang_YOUR_LANGCODE.php +Then edit the file and translate the messages into your language. +If you ever use a ' character, you have to escape it by using \' instead or the script will fail. +When you are done, you have to edit the chat script, to include your translation. Simply add a line with + 'lang_code' =>'Language name', +to the $L array in the load_lang() function at the bottom, similar to what I did for the German translation. +Please share your translation with me, so I can add it to the official version. + +LIVE DEMO: + +If you want to see the script in action, you can visit my TOR hidden site http://tt3j2x4k5ycaa5zt.onion/chat.php or via a tor2web proxy like http://tt3j2x4k5ycaa5zt.tor2web.blutmagie.de/chat.php if you don't have TOR installed. +Considering this is a hidden service, you should be prepared for the worst case, as people often tend to do illegal activities in the TOR network. I'm not online 24/7 so it might not be possible to remove such content right away. +If you should see illegal content, don't panic. Use the contact form on my site to notify me and clean your browser cache afterwards. diff --git a/README.md b/README.md new file mode 100644 index 0000000..9d365ee --- /dev/null +++ b/README.md @@ -0,0 +1,65 @@ +General Information: +-------------------- + +This is a PHP Chat based on LE CHAT v.1.14 . An up-to-date copy of this script can be downloaded at http://github.com/DanWin/le-chat-php +The original perl LE CHAT script by Lucky Eddie can be downloaded at [his site](http://4fvfamdpoulu2nms.onion/lechat/) or via a tor2web proxy like [this one](https://4fvfamdpoulu2nms.tor2web.blutmagie.de/lechat/) if you don't have TOR installed. +If you add your own cool features or have a feature request, please tell me and I will add them, if I like them. +Please also let me know about any bugs you find in the code, so I can fix them. +Now a piece of information about the origin of the name "LE CHAT" copied from the original script: +The "LE" in the name you can take as "Lucky Eddie", or since the script was meant to be lean and easy on server resources, as "Light Edition". +It may even be the French word for "the" if you prefer. Translated from French to English, "le chat" means: "the cat". + +Features: +--------- + +* Optimized for TOR +* No JavaScript +* Cookies supported, but not needed +* Captcha +* Multiple languages +* Members and guests +* Waiting room for guests +* Moderatoral approval of new guests +* Public, member, moderator and admin only chats +* Private messages +* Multi-line messages +* Change font, colour and refresh rate in profile settings +* Autologout when inactive for some time +* Image and video embedding +* Notes for admins and moderators +* Clone the chat to have multiple tabs +* Kick chatters +* Clean selected messages +* Clean the whole room +* Plain text message filter +* Regex message filter +* And more + +Installation Instructions: +-------------------------- + +You'll need to have mysql, php and a web-server installed. For the captcha feature, you also need php5-gd. +When you have everything installed, you'll have to create a database and a user for the chat in mysql. +Then edit the configuration at the bottom of the script to reflect the appropriate database settings and to modify the chat settings the way you like them. +Then copy the script to your web-server directory and call the script in your browser with a parameter like this: + http://(server)/(script-name).php?action=setup +Now you can create the Superadmin account. With this account you can administer the chat and add new members and set the guest access. +As soon as you are done with the setup, all necessary database tables will be created and the chat can be used. + +Translating: +------------ + +Copy lang_en.php and rename it to lang_YOUR_LANGCODE.php +Then edit the file and translate the messages into your language. +If you ever use a ' character, you have to escape it by using \' instead or the script will fail. +When you are done, you have to edit the chat script, to include your translation. Simply add a line with + 'lang_code' =>'Language name', +to the $L array in the load_lang() function at the bottom, similar to what I did for the German translation. +Please share your translation with me, so I can add it to the official version. + +Live demo: +---------- + +If you want to see the script in action, you can visit my [TOR hidden site](http://tt3j2x4k5ycaa5zt.onion/chat.php) or via a tor2web proxy like [this one](http://tt3j2x4k5ycaa5zt.tor2web.blutmagie.de/chat.php) if you don't have TOR installed. +Considering this is a hidden service, you should be prepared for the worst case, as people often tend to do illegal activities in the TOR network. I'm not online 24/7 so it might not be possible to remove such content right away. +If you should see illegal content, don't panic. Use the contact form on my site to notify me and clean your browser cache afterwards. I will remove the content as soon as possible. diff --git a/chat.php b/chat.php new file mode 100755 index 0000000..e7e7e66 --- /dev/null +++ b/chat.php @@ -0,0 +1,2097 @@ + +* +* 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 . +*/ + +date_default_timezone_set('UTC'); +$U=array();// This user data +$P=array();// All present users +$A=array();// All registered members +$M=array();// Members: display names +$G=array();// Guests: display names +$F=array();// Fonts +$C=array();// Configuration +$H=array();// HTML-stuff +$I=array();// Translations +$L=array();// Languages +$mysqli;// MySQL database connection +$countmods=0; +load_fonts(); +load_config(); +load_lang(); +load_html(); +check_db(); + +// set session variable to cookie if cookies are enabled +if(!isSet($_REQUEST['session']) && isSet($_COOKIE[$C['cookiename']])){ + $_REQUEST['session']=$_COOKIE[$C['cookiename']]; +} + +// main program: decide what to do based on queries +if(!isSet($_REQUEST['action'])){ + send_login(); +}elseif($_REQUEST['action']=='view'){ + check_session(); + send_messages(); +}elseif($_REQUEST['action']=='redirect' && isSet($_GET['url']) && !$_GET['url']==''){ + send_redirect(); +}elseif($_REQUEST['action']=='wait'){ + send_waiting_room(); +}elseif($_REQUEST['action']=='post'){ + check_session(); + if(isSet($_REQUEST['kick']) && isSet($_REQUEST['sendto']) && valid_nick($_REQUEST['sendto'])){ + if($U['status']>=5 || ($countmods==0 && $U['status']>=3)){ + kick_chatter(array($_REQUEST['sendto']), $_REQUEST['message']); + if(isSet($_REQUEST['what']) && $_REQUEST['what']=='purge') del_all_messages($_REQUEST['sendto']); + } + }elseif(isSet($_REQUEST['message']) && isSet($_REQUEST['sendto']) && !preg_match('/^\s*$/',$_REQUEST['message'])){ + validate_input(); + add_message(); + } + send_post(); +}elseif($_REQUEST['action']=='login'){ + check_login(); + send_frameset(); +}elseif($_REQUEST['action']=='controls'){ + check_session(); + send_controls(); +}elseif($_REQUEST['action']=='delete'){ + check_session(); + if($_REQUEST['what']=='all') del_all_messages($U['nickname']); + if($_REQUEST['what']=='last') del_last_message(); + send_post(); +}elseif($_REQUEST['action']=='profile'){ + check_session(); + if(isSet($_REQUEST['do']) && $_REQUEST['do']=='save') save_profile(); + send_profile(); +}elseif($_REQUEST['action']=='logout'){ + kill_session(); + send_logout(); +}elseif($_REQUEST['action']=='colours'){ + check_session(); + send_colours(); +}elseif($_REQUEST['action']=='notes'){ + check_session(); + if(!$U['status']>=5) send_login(); + send_notes('staff'); +}elseif($_REQUEST['action']=='help'){ + check_session(); + send_help(); +}elseif($_REQUEST['action']=='admnotes'){ + check_session(); + if(!$U['status']>=6) send_login(); + send_notes('admin'); +}elseif($_REQUEST['action']=='admin'){ + check_session(); + if(!$U['status']>=5) send_login(); + if(!isSet($_REQUEST['do'])){ + send_admin(); + }elseif($_REQUEST['do']=='clean'){ + if($_REQUEST['what']=='choose') send_choose_messages(); + if($_REQUEST['what']=='selected') clean_selected(); + if($_REQUEST['what']=='room') clean_room(); + send_admin(); + }elseif($_REQUEST['do']=='kick'){ + if(!isSet($_REQUEST['name'])) send_admin(); + kick_chatter($_REQUEST['name'], $_REQUEST['kickmessage']); + if(isSet($_REQUEST['what']) && $_REQUEST['what']=='purge'){ + foreach($_REQUEST['name'] as $name){ + del_all_messages($name); + } + } + send_admin(); + }elseif($_REQUEST['do']=='logout'){ + if(!isSet($_REQUEST['name'])) send_admin(); + logout_chatter($_REQUEST['name']); + send_admin(); + }elseif($_REQUEST['do']=='sessions'){ + send_sessions(); + }elseif($_REQUEST['do']=='register'){ + register_guest(3); + check_session(); + send_admin(); + }elseif($_REQUEST['do']=='superguest'){ + register_guest(2); + check_session(); + send_admin(); + }elseif($_REQUEST['do']=='status'){ + change_status(); + }elseif($_REQUEST['do']=='regnew'){ + register_new(); + }elseif($_REQUEST['do']=='approve'){ + approve_session(); + send_approve_waiting(); + }elseif($_REQUEST['do']=='guestaccess'){ + if(isSet($_REQUEST['set']) && preg_match('/^[0123]$/', $_REQUEST['set'])){ + update_setting('guestaccess', $_REQUEST['set']); + } + }elseif($_REQUEST['do']=='filter'){ + manage_filter(); + send_filter(); + } + send_admin(); +}elseif($_REQUEST['action']=='setup'){ + $tables=array('captcha', 'filter', 'members', 'messages', 'notes', 'sessions', 'settings'); + $num_tables=0; + $result=mysqli_query($mysqli, 'SHOW TABLES'); + while($tmp=mysqli_fetch_array($result, MYSQLI_NUM)){ + if(in_array($tmp[0],$tables)) $num_tables++; + } + if($num_tables<7) send_init(); + if(!valid_admin()) send_alogin(); + if(!isSet($_REQUEST['do'])){ + }elseif($_REQUEST['do']=='guestaccess'){ + if(isSet($_REQUEST['set']) && preg_match('/^[0123]$/', $_REQUEST['set'])){ + update_setting('guestaccess', $_REQUEST['set']); + } + }elseif($_REQUEST['do']=='dbupdate'){ + update_db(); + }elseif($_REQUEST['do']=='messages'){ + update_messages(); + } + send_setup(); +}elseif($_REQUEST['action']=='init'){ + init_chat(); +}else{ + send_login(); +} +exit; + +// html output subs + +function print_credits(){ + global $I, $C; + echo ''; + if($C['showcredits']){ + echo "

$I[contributors]

"; + echo 'Programming - Daniel Winzen
'; + echo 'German - Daniel Winzen
'; + echo 'English - Daniel Winzen
'; + } + echo "

LE CHAT-PHP - $C[version]
"; +} + +function print_stylesheet($arg1=''){ + echo "\n"; +} + +function print_end(){ + echo ''; + exit; +} + +function frmpst($arg1='', $arg2=''){ + global $U, $H; + $string="<$H[form]>".hidden('action', $arg1).hidden('session', $U['session']); + if($arg2!==''){ + $string.=hidden('what', $arg2).@hidden('sendto', $_REQUEST['sendto']).@hidden('multi', $_REQUEST['multi']); + } + return $string; +} + +function frmadm($arg1=''){ + global $U, $H; + return "<$H[form]>".hidden('action', 'admin').hidden('do', $arg1).hidden('session', $U['session']); +} + +function hidden($arg1='', $arg2=''){ + return ""; +} + +function submit($arg1='', $arg2=''){ + return ""; +} + +function thr(){ + echo '
'; +} + +function print_start($css='', $ref='', $url=''){ + global $H; + header('Content-Type: text/html; charset=UTF-8'); header('Pragma: no-cache'); header('Expires: 0'); + if($url!=='') header("Refresh: $ref; URL=$url"); + echo "$H[meta_html]"; + if($url!=='') echo "\n"; + print_stylesheet($css); + echo "$H[begin_body]"; +} + +function send_redirect(){ + if(preg_match('~^http(s)?://~', $_GET['url'])){ + header("Refresh: 0; URL=$_GET[url]"); + echo "

Redirecting to: ".htmlspecialchars($_GET['url']).".

"; + }else{ + $url=preg_replace('~(.*)://~', 'http://', $_GET['url']); + echo ''; + echo "

Non-http link requested: ".htmlspecialchars($_GET['url']).".

"; + echo "

If it's not working, try this one: ".htmlspecialchars($url).".

"; + echo ''; + } +} + +function send_captcha($code){ + global $C; + $im=imagecreatetruecolor(55, 24); + $bg=imagecolorallocate($im, 0, 0, 0); + $fg=imagecolorallocate($im, 255, 255, 255); + imagefill($im, 0, 0, $bg); + imagestring($im, 5, 5, 5, $code, $fg); + ob_start(); + imagegif($im); + imagedestroy($im); + return ''; +} + +function send_setup(){ + global $H, $I, $mysqli, $C; + $ga=get_setting('guestaccess'); + print_start(); + echo "

$I[setup]

"; + thr(); + echo ""; + thr(); + echo "'; + thr(); + echo "'; + thr(); + echo "
$I[guestacc]"; + echo "<$H[form]>".hidden('action', 'setup').hidden('do', 'guestaccess').hidden('nick', $_REQUEST['nick']).hidden('pass', $_REQUEST['pass']).""; + echo ""; + echo ""; + echo ""; + echo "
  
  
  
  
 ".submit($I['change'])."
$I[dbupdate]"; + echo "<$H[form]>".hidden('action', 'setup').hidden('do', 'dbupdate').hidden('nick', $_REQUEST['nick']).hidden('pass', $_REQUEST['pass']).""; + echo '
 '.submit($I['update']).'
$I[sysmessages]"; + echo "<$H[form]>".hidden('action', 'setup').hidden('do', 'messages').hidden('nick', $_REQUEST['nick']).hidden('pass', $_REQUEST['pass']).""; + echo "'; + echo "'; + echo "'; + if($C['suguests']) echo "'; + echo "'; + echo "'; + echo "'; + echo "'; + echo '
 $I[msgenter] 
 $I[msgexit] 
 $I[msgmemreg] 
 $I[msgsureg] 
 $I[msgkick] 
 $I[msgmultikick] 
 $I[msgallkick] 
 $I[msgclean] 
 '.submit($I['apply']).'
<$H[form]>".hidden('action', 'setup').submit($I['logout']).''; + print_credits(); + print_end(); +} + +function send_init(){ + global $H, $I; + print_start(); + echo "

$I[init]

"; + echo "<$H[form]>".hidden('action', 'init')."

$I[sulogin]

"; + echo ""; + echo ""; + echo ""; + echo "
$I[sunick]
$I[supass]
$I[suconfirm]





"; + echo "

".submit($I['initbtn']).'
'; + print_credits(); + print_end(); +} + +function send_alogin(){ + global $H, $I; + print_start(); + echo "
<$H[form]>".hidden('action', 'setup').''; + echo ""; + echo ""; + echo "
$I[nick]
$I[pass]
".submit($I['login']).'
'; + print_credits(); + print_end(); +} + +function send_admin($arg=''){ + global $U, $C, $P, $H, $I, $mysqli; + $ga=get_setting('guestaccess'); + print_start(); + $chlist="'; + echo "

$I[admfunc]

$arg"; + thr(); + echo "'; + thr(); + echo ''; + thr(); + echo "'; + thr(); + echo "'; + thr(); + echo "'; + thr(); + echo "'; + thr(); + if($C['suguests']){ + echo "'; + thr(); + } + if($U['status']>=7){ + echo "'; + thr(); + echo "'; + thr(); + echo "'; + thr(); + } + echo "
$I[cleanmsgs]"; + echo frmadm('clean').""; + echo ""; + echo "
   "; + echo submit($I['clean']).'
'.sprintf($I['kickchat'], $C['kickpenalty']).'
'; + echo frmadm('kick').""; + echo "
$I[kickmsg]  
$chlist"; + echo submit($I['kick']).'
$I[logoutinact]"; + echo frmadm('logout')."
 $chlist"; + echo submit($I['logout']).'
$I[viewsess]"; + echo frmadm('sessions')."
 ".submit($I['view']).'
$I[filter]"; + echo frmadm('filter')."
 ".submit($I['view']).'
$I[guestacc]"; + echo frmadm('guestaccess').''; + echo ""; + echo ""; + echo ""; + echo ""; + echo '
  
  
  
  
 '.submit($I['change']).'
$I[addsuguest]"; + echo frmadm('superguest')."
 '.submit($I['register']).'
$I[admmembers]
"; + echo frmadm('status')."
 '.submit($I['change']).'
$I[regguest]"; + echo frmadm('register')."
 '.submit($I['register']).'
$I[regmem]
"; + echo frmadm('regnew').""; + echo "
 $I[nick] 
 $I[pass]"; + echo submit($I['register']).'
$H[backtochat]
"; + print_end(); +} + +function send_sessions(){ + global $U, $H, $I; + $lines=parse_sessions(); + print_start(); + echo "

$I[sessact]

"; + echo ""; + if(isSet($lines)){ + foreach($lines as $temp){ + if($temp['status']!=0){ + if($temp['status']==1 || $temp['status']==2) $s=' (G)'; + elseif($temp['status']==3) $s=''; + elseif($temp['status']==5 || $temp['status']==6) $s=' (M)'; + elseif($temp['status']>=7) $s=' (A)'; + echo ''; + } + } + } + echo "
$I[sessnick]$I[sesstimeout]$I[sessua]
'.style_this($temp['nickname'].$s, $temp['fontinfo']).''.get_timeout($temp['lastpost'], $temp['status']).''; + if($U['status']>$temp['status'] || $U['session']==$temp['session']) echo $temp['useragent']; + else echo '-

$H[backtochat]
"; + print_end(); +} + +function manage_filter(){ + global $mysqli, $I; + if(isSet($_REQUEST['id'])){ + $_REQUEST['match']=htmlspecialchars($_REQUEST['match']); + if(isSet($_REQUEST['regex']) && $_REQUEST['regex']==1){ + if(!is_int(@preg_match("/$_REQUEST[match]/", ''))) send_filter($I['incorregex']); + $reg=1; + }else{ + $_REQUEST['match']=preg_replace('/([^\w\d])/', "\\\\$1", $_REQUEST['match']); + $reg=0; + } + if(isSet($_REQUEST['allowinpm']) && $_REQUEST['allowinpm']==1) $pm=1; + else $pm=0; + if(isSet($_REQUEST['kick']) && $_REQUEST['kick']==1) $kick=1; + else $kick=0; + if(preg_match('/^[0-9]*$/', $_REQUEST['id'])){ + if($_REQUEST['match']==''){ + $stmt=mysqli_prepare($mysqli, 'DELETE FROM `filter` WHERE `id`=?'); + mysqli_stmt_bind_param($stmt, 's', $_REQUEST['id']); + mysqli_stmt_execute($stmt); + mysqli_stmt_close($stmt); + }else{ + $stmt=mysqli_prepare($mysqli, 'UPDATE `filter` SET `match`=?, `replace`=?, `allowinpm`=?, `regex`=?, `kick`=? WHERE `id`=?'); + mysqli_stmt_bind_param($stmt, 'ssdddd', $_REQUEST['match'], $_REQUEST['replace'], $pm, $reg, $kick, $_REQUEST['id']); + mysqli_stmt_execute($stmt); + mysqli_stmt_close($stmt); + } + }elseif(preg_match('/^\+$/', $_REQUEST['id'])){ + $stmt=mysqli_prepare($mysqli, 'INSERT INTO `filter` (`match`, `replace`, `allowinpm`, `regex`, `kick`) VALUES (?, ?, ?, ?, ?)'); + mysqli_stmt_bind_param($stmt, 'ssddd', $_REQUEST['match'], $_REQUEST['replace'], $pm, $reg, $kick); + mysqli_stmt_execute($stmt); + mysqli_stmt_close($stmt); + } + } +} + +function send_filter($arg=''){ + global $U, $H, $I, $mysqli; + print_start(); + echo "

$I[filter]

$arg"; + thr(); + echo ""; + $result=mysqli_query($mysqli, 'SELECT * FROM `filter`'); + if(mysqli_num_rows($result)>0){ + while($filter=mysqli_fetch_array($result, MYSQLI_ASSOC)){ + if($filter['allowinpm']==1) $check=' checked'; + else $check=''; + if($filter['regex']==1) $checked=' checked'; + else $checked=''; + if($filter['kick']==1) $checkedk=' checked'; + else $checkedk=''; + if($filter['regex']==0) $filter['match']=preg_replace('/(\\\\(.))/', "$2", $filter['match']); + echo ''; + } + } + echo ''; + echo "
"; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo "
$I[fid]
$I[match]
$I[replace]
$I[allowpm]
$I[regex]
$I[kick]
$I[apply]
'.frmadm('filter').hidden('id', $filter['id']); + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo '
$I[filter] $filter[id]:'.submit($I['change']).'
'.frmadm('filter').hidden('id', '+'); + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo '
$I[newfilter]'.submit($I['add']).'

$H[backtochat]
"; + print_end(); +} + +function send_frameset(){ + global $U, $H, $I; + header('Content-Type: text/html; charset=UTF-8'); header('Pragma: no-cache'); header('Expires: 0'); + echo "$H[meta_html]"; + print_stylesheet(); + if(isSet($_COOKIE['test'])){ + echo "\n$H[begin_body]$I[noframes]$H[backtologin]</body>"; + }else{ + echo "\n$H[begin_body]$I[noframes]$H[backtologin]</body>"; + } + exit; +} + +function send_messages(){ + global $U, $C, $I; + if(isSet($_COOKIE[$C['cookiename']])){ + $url="$_SERVER[SCRIPT_NAME]?action=view&nocache="; + }else{ + $url="$_SERVER[SCRIPT_NAME]?action=view&session=$U[session]&nocache="; + } + if(!isSet($_REQUEST['nocache'])) $_REQUEST['nocache']=''; + print_start('', $U['refresh'], $url.substr(time(), -6)); + echo ''; + print_chatters(); + echo "
$I[bottom]
"; + print_messages(); + echo "
$I[top]
"; + print_end(); +} + +function send_notes($type){ + global $U, $H, $I, $mysqli; + $text=''; + print_start(); + if($type=="staff") echo "

$I[staffnotes]

"; + else echo "

$I[adminnotes]

"; + if(isset($_REQUEST['text'])){ + $stmt=mysqli_prepare($mysqli, 'INSERT INTO `notes`(`type`, `lastedited`, `editedby`, `text`) VALUES (?, ?, ?, ?)'); + mysqli_stmt_bind_param($stmt, 'sdss', $type, time(), $U['nickname'], $_REQUEST['text']); + mysqli_stmt_execute($stmt); + mysqli_stmt_close($stmt); + echo "$I[notessaved] "; + } + $stmt=mysqli_prepare($mysqli, 'SELECT `lastedited`, `editedby`, `text` FROM `notes` WHERE `type`=? ORDER BY `lastedited` DESC LIMIT 1'); + mysqli_stmt_bind_param($stmt, 's', $type); + mysqli_stmt_execute($stmt); + mysqli_stmt_bind_result($stmt, $lastedited, $editedby, $text); + if(mysqli_stmt_fetch($stmt)){ + printf($I['lastedited'], $editedby, date('Y-m-d H:i:s', $lastedited)); + } + mysqli_stmt_close($stmt); + echo "

<$H[form]>"; + if($type=='staff') echo hidden('action', 'notes'); + else echo hidden('action', 'admnotes'); + echo hidden('session', $U['session'])."
'; + echo submit($I['savenotes']).'
'; +} + +function send_approve_waiting(){ + global $H, $U, $I, $mysqli; + print_start('admin'); + echo "

$I[waitingroom]

"; + $result=mysqli_query($mysqli, 'SELECT * FROM `sessions` WHERE `entry`!=\'0\' AND `status`=\'1\' ORDER BY `entry`'); + if(mysqli_num_rows($result)>0){ + echo "<$H[form]>".hidden('action', 'admin').hidden('do', 'approve').hidden('session', $U['session']).""; + echo ""; + while($temp=mysqli_fetch_array($result, MYSQLI_ASSOC)){ + echo ''.hidden('alls[]', $temp['nickname']).""; + } + echo "
$I[sessnick]$I[sessua]
$temp[useragent]

"; + echo ""; + echo ""; + echo ""; + echo '
$I[denymessage]
'.submit($I['butallowdeny']).'

'; + }else{ + echo "$I[waitempty]

"; + } + print "$H[backtochat]
"; + print_end(); +} + +function send_waiting_room(){ + global $U, $C, $M, $H, $I, $countmods, $mysqli; + parse_sessions(); + if(get_setting('guestaccess')==3 && $countmods>0) $wait=false; + else $wait=true; + if(!isSet($_REQUEST['session'])){ + setcookie($C['cookiename'], false); + send_error($I['expire']); + } + $stmt=mysqli_prepare($mysqli, 'SELECT `session`, `nickname`, `displayname`, `status`, `refresh`, `fontinfo`, `style`, `lastpost`, `passhash`, `postid`, `boxwidth`, `boxheight`, `useragent`, `kickmessage`, `bgcolour`, `notesboxheight`, `notesboxwidth`, `entry`, `timestamps`, `embed` FROM `sessions` WHERE `session`=?'); + mysqli_stmt_bind_param($stmt, 's', $_REQUEST['session']); + mysqli_stmt_execute($stmt); + mysqli_stmt_bind_result($stmt, $U['session'], $U['nickname'], $U['displayname'], $U['status'], $U['refresh'], $U['fontinfo'], $U['style'], $U['lastpost'], $U['passhash'], $U['postid'], $U['boxwidth'], $U['boxheight'], $U['useragent'], $U['kickmessage'], $U['bgcolour'], $U['notesboxheight'], $U['notesboxwidth'], $U['entry'], $U['timestamps'], $U['embed']); + if(mysqli_stmt_fetch($stmt)) add_user_defaults(); + mysqli_stmt_close($stmt); + if(!isSet($U['session'])){ + setcookie($C['cookiename'], false); + send_error($I['expire']); + } + if($U['status']==0){ + setcookie($C['cookiename'], false); + send_error("$I[kicked]
$U[kickmessage]"); + } + $timeleft=$C['entrywait']-(time()-$U['entry']); + if(($timeleft<=0 || count($M)==0) && $wait){ + $stmt=mysqli_prepare($mysqli, 'UPDATE `sessions` SET `entry`=\'0\' WHERE `session`=?'); + mysqli_stmt_bind_param($stmt, 's', $U['session']); + mysqli_stmt_execute($stmt); + mysqli_stmt_close($stmt); + send_frameset(); + }elseif(!$wait && $U['entry']==0){ + send_frameset(); + }else{ + $U['nocache']=substr(time(), -6); + if(isSet($_COOKIE['test'])){ + header("Refresh: $C[defaultrefresh]; URL=$_SERVER[SCRIPT_NAME]?action=wait&nocache=$U[nocache]"); + echo "$H[meta_html]\n\n"; + }else{ + header("Refresh: $C[defaultrefresh]; URL=$_SERVER[SCRIPT_NAME]?action=wait&session=$U[session]&nocache=$U[nocache]"); + echo "$H[meta_html]\n\n"; + } + print_stylesheet(); + if($wait){ + echo "$H[begin_body]

$I[waitingroom]

".sprintf($I['waittext'], $U['displayname'], $timeleft).'


'.sprintf($I['waitreload'], $C['defaultrefresh']).'



'; + }else{ + echo "$H[begin_body]

$I[waitingroom]

".sprintf($I['admwaittext'], $U['displayname']).'


'.sprintf($I['waitreload'], $C['defaultrefresh']).'



'; + } + echo "
".hidden('action', 'wait').hidden('session', $U['session']).submit($I['reload']).'

'; + echo "

$I[rules]

$C[rulestxt]
"; + print_end(); + } +} + +function send_choose_messages(){ + global $U, $H, $I; + print_start(); + echo frmadm('clean').hidden('what', 'selected').submit($I['delselmes'], ' style="background-color:#660000;color:#FFFFFF;"').'

'; + print_messages($U['status']); + echo "
$H[backtochat]"; + print_end(); +} + +function send_post(){ + global $U, $C, $P, $I, $countmods; + $U['postid']=substr(time(), -6); + print_start(); + echo "
".frmpst('post').hidden('postid', $U['postid']).@hidden('multi', $_REQUEST['multi']); + echo ""; + if(!isSet($U['rejected'])) $U['rejected']=''; + if(isSet($_REQUEST['multi']) && $_REQUEST['multi']=="on"){ + echo ""; + }else{ + echo ""; + } + echo '
$U[displayname]:'.submit($I['talkto'])."'; + if($U['status']>=5 || ($countmods==0 && $U['status']>=3)){ + echo ""; + echo ""; + } + echo '
'; + echo '
'; + echo frmpst('delete', 'last').submit($I['dellast']).''.frmpst('delete', 'all').submit($I['delall']).''; + if(isSet($_REQUEST['multi']) && $_REQUEST['multi']=='on'){ + $switch=$I['switchsingle']; + $multi=''; + }else{ + $switch=$I['switchmulti']; + $multi='on'; + } + echo frmpst('post').@hidden('sendto', $_REQUEST['sendto']).hidden('multi', $multi).submit($switch).'
'; + print_end(); +} + +function send_help(){ + global $U, $C, $H, $I; + print_start(); + echo "

$I[rules]

$C[rulestxt]


$I[help]

$I[helpguest]"; + if($C['imgembed'] || $C['vidembed']) echo "
$I[helpembed]"; + if($U['status']>=3){ + echo "
$I[helpmem]
"; + if($U['status']>=5){ + echo "
$I[helpmod]
"; + if($U['status']>=7) echo "
$I[helpadm]
"; + } + } + echo "

$H[backtochat]"; + print_credits(); + print_end(); +} + +function send_profile($arg=''){ + global $U, $F, $H, $I; + print_start(); + echo "
<$H[form]>".hidden('action', 'profile').hidden('do', 'save').hidden('session', $U['session'])."

$I[profile]

$arg"; + thr(); + echo ""; + thr(); + echo ""; + thr(); + echo ""; + thr(); + if($U['status']>=3){ + echo ""; + thr(); + } + echo "'; + thr(); + echo ""; + thr(); + echo ""; + thr(); + echo "'; + thr(); + if($U['status']>=5){ + echo "'; + thr(); + } + if($U['status']>=2){ + echo ""; + thr(); + } + echo '
$I[refreshrate]"; + echo "
 
$I[fontcolour] ($I[viewexample])"; + echo "
 
$I[bgcolour] ($I[viewexample])"; + echo "
 
$I[fontface]"; + echo "
  /', $U['fontinfo'])) echo ' checked'; + echo "> /', $U['fontinfo'])) echo ' checked'; + echo ">
$U[displayname] : ".style_this($I['fontexample'], $U['fontinfo']).'
$I[timestamps]"; + echo "
 
$I[embed]"; + echo "
 
$I[pbsize]"; + echo ""; + echo ""; + echo '
 $I[width] $I[height]
$I[nbsize]"; + echo ""; + echo ""; + echo '
 $I[width] $I[height]
"; + echo "
$I[changepass]
"; + echo ""; + echo "
 $I[oldpass]
 $I[newpass]
 $I[confirmpass]
'.submit($I['savechanges'])."

$H[backtochat]
"; + print_end(); +} + +function send_controls(){ + global $U, $H, $I; + print_start(); + echo '
'; + echo "'; + echo "'; + echo "'; + if($U['status']>=5) echo "'; + if($U['status']>=6) echo "'; + if($U['status']>=5) echo "'; + if($U['status']>=3) echo "'; + echo "'; + echo "'; + echo '
<$H[form] target=\"post\">".hidden('action', 'post').hidden('session', $U['session']).submit($I['reloadpb']).'<$H[form] target=\"view\">".hidden('action', 'view').hidden('session', $U['session']).hidden('nocache', '000001').submit($I['reloadmsgs']).'<$H[form] target=\"view\">".hidden('action', 'profile').hidden('session', $U['session']).submit($I['chgprofile']).'<$H[form] target=\"view\">".hidden('action', 'admin').hidden('session', $U['session']).submit($I['adminbtn']).'<$H[form] target=\"view\">".hidden('action', 'admnotes').hidden('session', $U['session']).submit($I['admnotes']).'<$H[form] target=\"view\">".hidden('action', 'notes').hidden('session', $U['session']).submit($I['notes']).'<$H[form] target=\"_blank\">".hidden('action', 'login').hidden('session', $U['session']).submit($I['clone']).'<$H[form] target=\"view\">".hidden('action', 'help').hidden('session', $U['session']).submit($I['randh']).'<$H[form] target=\"_parent\">".hidden('action', 'logout').hidden('session', $U['session']).submit($I['exit']).'
'; + print_end(); +} + +function send_logout(){ + global $U, $H, $I; + print_start(); + echo '

'.sprintf($I['bye'], $U['displayname'])."

$H[backtologin]
"; + print_end(); +} + +function send_colours(){ + global $H, $I; + print_start(); + echo "

$I[colourtable]

"; + for($red=0x00;$red<=0xFF;$red+=0x33){ + for($green=0x00;$green<=0xFF;$green+=0x33){ + for($blue=0x00;$blue<=0xFF;$blue+=0x33){ + $hcol=sprintf('%02X', $red).sprintf('%02X', $green).sprintf('%02X', $blue); + echo "$hcol "; + } + echo '
'; + } + echo '
'; + } + echo "
<$H[form]>".hidden('action', 'profile').hidden('session', $_REQUEST['session']).submit($I['backtoprofile'], ' style="background-color:#004400;color:#FFFFFF;"').'
'; + print_end(); +} + +function send_login(){ + global $C, $H, $I, $mysqli, $L; + setcookie('test', '1'); + print_start(); + echo "

$C[chatname]

<$H[form] target=\"_parent\">".hidden('action', 'login'); + if($C['enablecaptcha']){ + $code=rand(0, 99999); + $randid=rand(0, 99999999); + $enc=base64_encode(openssl_encrypt("$code, $randid", 'aes-128-cbc', $C['captchapass'], 0, '1234567890123456')); + $stmt=mysqli_prepare($mysqli, 'INSERT INTO `captcha` (`id`, `time`) VALUES (?, \''.time().'\')'); + mysqli_stmt_bind_param($stmt, 'd', $randid); + mysqli_stmt_execute($stmt); + mysqli_stmt_close($stmt); + echo hidden('challenge', $enc); + } + echo ""; + echo ""; + if($C['enablecaptcha']){ + echo "'; + } + echo "'; + $nowchatting=get_nowchatting(); + echo '
$I[nick]
$I[pass]
$I[copy]"; + echo send_captcha($code); + echo '
$I[choosecol]
'.submit($I['enter'])."
$nowchatting"; + echo "

$I[rules]

$C[rulestxt]

$I[changelang]"; + foreach($L as $lang=>$name){ + echo " $name"; + } + print_credits(); + print_end(); +} + +function send_error($err){ + global $H, $I; + print_start('body{color:#FF0033;}'); + echo "

$I[error] $err

$H[backtologin]"; + print_end(); +} + +function print_chatters(){ + global $U, $M, $H, $G, $I, $mysqli; + echo ''; + if($U['status']>=5 && get_setting('guestaccess')==3){ + $result=mysqli_query($mysqli, 'SELECT COUNT(*) FROM `sessions` WHERE `entry`!=\'0\' AND `status`=\'1\' ORDER BY `entry`'); + $temp=mysqli_fetch_array($result, MYSQLI_NUM); + if($temp[0]>0) echo "'; + } + if(isSet($M[0])){ + echo "'; + if(isSet($G[0])) echo ''; + } + if(isSet($G[0])) echo "'; + echo '
<$H[form]>".hidden('action', 'admin').hidden('do', 'approve').hidden('session', $_REQUEST['session']).submit(sprintf($I['approveguests'], $temp[0])).' $I[members] ".implode('   ', $M).'  $I[guests] ".implode('   ', $G).'
'; +} + +function print_memberslist(){ + global $A; + read_members(); + array_multisort(array_map('strtolower', array_keys($A)), SORT_ASC, SORT_STRING, $A); + foreach($A as $member){ + echo "'; + } +} + +// session management + +function create_session(){ + global $U, $C, $I, $mysqli; + $U['nickname']=cleanup_nick($_REQUEST['nick']); + $U['passhash']=md5(sha1(md5($U['nickname'].$_REQUEST['pass']))); + $U['colour']=$_REQUEST['colour']; + $U['status']=1; + if(!valid_nick($U['nickname'])) send_error(sprintf($I['invalnick'], $C['maxname'])); + check_member(); + add_user_defaults(); + if($C['enablecaptcha'] && ($U['status']==1 || !$C['dismemcaptcha'])){ + $captcha=explode(',', openssl_decrypt(base64_decode($_REQUEST['challenge']), 'aes-128-cbc', $C['captchapass'], 0, '1234567890123456')); + if(current($captcha)!==$_REQUEST['captcha']) send_error($I['wrongcaptcha']); + $stmt=mysqli_prepare($mysqli, 'SELECT * FROM `captcha` WHERE `id`=?'); + mysqli_stmt_bind_param($stmt, 'd', end($captcha)); + mysqli_stmt_execute($stmt); + mysqli_stmt_store_result($stmt); + if(mysqli_stmt_num_rows($stmt)==0) send_error($I['captchatime']); + mysqli_stmt_free_result($stmt); + mysqli_stmt_close($stmt); + $stmt=mysqli_prepare($mysqli, 'DELETE FROM `captcha` WHERE `id`=? OR `time`<\''.(time()-60*10)."'"); + mysqli_stmt_bind_param($stmt, 'd', end($captcha)); + mysqli_stmt_execute($stmt); + mysqli_stmt_close($stmt); + } + if($U['status']==1){ + if(!allowed_nick($U['nickname'])) send_error(sprintf($I['invalnick'], $C['maxname'])); + $ga=get_setting('guestaccess'); + if($ga==0) send_error($I['noguests']); + } + write_new_session(); +} + +function write_new_session(){ + global $U, $C, $I, $mysqli; + // read and update current sessions + $lines=parse_sessions(); + $sids; $inuse=0; $reentry=0; + if(isSet($lines)){ + foreach($lines as $temp){ + $sids[$temp['session']]=1;// collect all existing ids + if($temp['nickname']==$U['nickname']){// nick already here? + if($U['passhash']==$temp['passhash']){ + $U=$temp; + add_user_defaults(); + setcookie($C['cookiename'], $U['session']); + $reentry=1; + }else{ + $inuse=1; + } + } + } + } + // create new session: + if($inuse==0 && $reentry==0){ + do{ + $U['session']=md5(time().rand().$U['nickname']); + }while(isSet($sids[$U['session']]));// check for hash collision + $stmt=mysqli_prepare($mysqli, 'INSERT INTO `sessions`(`session`, `nickname`, `displayname`, `status`, `refresh`, `fontinfo`, `style`, `lastpost`, `passhash`, `postid`, `boxwidth`, `boxheight`, `useragent`, `bgcolour`, `notesboxwidth`, `notesboxheight`, `entry`, `timestamps`, `embed`) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)'); + mysqli_stmt_bind_param($stmt, 'sssddssdsdddssddddd', $U['session'], $U['nickname'], $U['displayname'], $U['status'], $U['refresh'], $U['fontinfo'], $U['style'], $U['lastpost'], $U['passhash'], $U['postid'], $U['boxwidth'], $U['boxheight'], $U['useragent'], $U['bgcolour'], $U['notesboxwidth'], $U['notesboxheight'], $U['entry'], $U['timestamps'], $U['embed']); + mysqli_stmt_execute($stmt); + mysqli_stmt_close($stmt); + setcookie($C['cookiename'], $U['session']); + if($C['msglogin'] && $U['status']>=3) add_system_message(sprintf(get_setting('msgenter'), $U['displayname'])); + }elseif($inuse){ + send_error($I['invalpass']); + }elseif($U['status']==0){ + setcookie($C['cookiename'], false); + send_error("$I[kicked]
$U[kickmessage]"); + } +} + +function approve_session(){ + global $mysqli; + if(isSet($_REQUEST['what'])){ + if($_REQUEST['what']=='allowchecked' && isSet($_REQUEST['csid'])){ + $stmt=mysqli_prepare($mysqli, 'UPDATE `sessions` SET `entry`=\'0\' WHERE `nickname`=?'); + foreach($_REQUEST['csid'] as $nick){ + mysqli_stmt_bind_param($stmt, 's', $nick); + mysqli_stmt_execute($stmt); + } + mysqli_stmt_close($stmt); + }elseif($_REQUEST['what']=='allowall' && isSet($_REQUEST['alls'])){ + $stmt=mysqli_prepare($mysqli, 'UPDATE `sessions` SET `entry`=\'0\' WHERE `nickname`=?'); + foreach($_REQUEST['alls'] as $nick){ + mysqli_stmt_bind_param($stmt, 's', $nick); + mysqli_stmt_execute($stmt); + } + mysqli_stmt_close($stmt); + }elseif($_REQUEST['what']=='denychecked' && isSet($_REQUEST['csid'])){ + $stmt=mysqli_prepare($mysqli, 'UPDATE `sessions` SET `lastpost`=\''.(60*($C['kickpenalty']-$C['guestsexpire'])+time()).'\', `status`=\'0\', `kickmessage`=? WHERE `nickname`=? AND `status`=\'1\''); + foreach($_REQUEST['csid'] as $nick){ + mysqli_stmt_bind_param($stmt, 'ss', $_REQUEST['kickmessage'], $nick); + mysqli_stmt_execute($stmt); + } + mysqli_stmt_close($stmt); + }elseif($_REQUEST['what']=='denyall' && isSet($_REQUEST['alls'])){ + $stmt=mysqli_prepare($mysqli, 'UPDATE `sessions` SET `lastpost`=\''.(60*($C['kickpenalty']-$C['guestsexpire'])+time()).'\', `status`=\'0\', `kickmessage`=? WHERE `nickname`=? AND `status`=\'1\''); + foreach($_REQUEST['alls'] as $nick){ + mysqli_stmt_bind_param($stmt, 'ss', $_REQUEST['kickmessage'], $nick); + mysqli_stmt_execute($stmt); + } + mysqli_stmt_close($stmt); + } + } +} + +function check_login(){ + global $mysqli, $C, $U, $I, $M; + if(isSet($_POST['session'])){ + $stmt=mysqli_prepare($mysqli, 'SELECT `session`, `nickname`, `displayname`, `status`, `refresh`, `fontinfo`, `style`, `lastpost`, `passhash`, `postid`, `boxwidth`, `boxheight`, `useragent`, `kickmessage`, `bgcolour`, `notesboxheight`, `notesboxwidth`, `entry`, `timestamps`, `embed` FROM `sessions` WHERE `session`=?'); + mysqli_stmt_bind_param($stmt, 's', $_POST['session']); + mysqli_stmt_execute($stmt); + mysqli_stmt_bind_result($stmt, $U['session'], $U['nickname'], $U['displayname'], $U['status'], $U['refresh'], $U['fontinfo'], $U['style'], $U['lastpost'], $U['passhash'], $U['postid'], $U['boxwidth'], $U['boxheight'], $U['useragent'], $U['kickmessage'], $U['bgcolour'], $U['notesboxheight'], $U['notesboxwidth'], $U['entry'], $U['timestamps'], $U['embed']); + if(mysqli_stmt_fetch($stmt)){ + if($U['status']==0){ + setcookie($C['cookiename'], false); + send_error("$I[kicked]
$U[kickmessage]"); + }else{ + setcookie($C['cookiename'], $U['session']); + } + }else{ + setcookie($C['cookiename'], false); + send_error($I['expire']); + + } + mysqli_stmt_close($stmt); + }else{ + create_session(); + } + if($U['status']==1){ + $ga=get_setting('guestaccess'); + if(($ga==2 || $ga==3) && count($M)>0){ + $stmt=mysqli_prepare($mysqli, 'UPDATE `sessions` SET `entry`=\''.time().'\' WHERE `session`=?'); + mysqli_stmt_bind_param($stmt, 's', $U['session']); + mysqli_stmt_execute($stmt); + mysqli_stmt_close($stmt); + $_REQUEST['session']=$U['session']; + send_waiting_room(); + } + } +} + +function kill_session(){ + global $U, $C, $I, $mysqli; + parse_sessions(); + setcookie($C['cookiename'], false); + if(!isSet($U['session'])) send_error($I['expire']); + if($U['status']==0) send_error("$I[kicked]
$U[kickmessage]"); + $stmt=mysqli_prepare($mysqli, 'DELETE FROM `sessions` WHERE `session`=?'); + mysqli_stmt_bind_param($stmt, 's', $U['session']); + mysqli_stmt_execute($stmt); + mysqli_stmt_close($stmt); + if($U['status']==1){ + $stmt=mysqli_prepare($mysqli, 'UPDATE `messages` SET `poster`=\'\' WHERE `poster`=? AND `poststatus`=\'9\''); + mysqli_stmt_bind_param($stmt, 's', $U['nickname']); + mysqli_stmt_execute($stmt); + mysqli_stmt_close($stmt); + $stmt=mysqli_prepare($mysqli, 'UPDATE `messages` SET `recipient`=\'\' WHERE `recipient`=? AND `poststatus`=\'9\''); + mysqli_stmt_bind_param($stmt, 's', $U['nickname']); + mysqli_stmt_execute($stmt); + mysqli_stmt_close($stmt); + } + elseif($C['msglogout'] && $U['status']>=3) add_system_message(sprintf(get_setting('msgexit'), $U['displayname'])); +} + +function kick_chatter($names, $mes){ + global $C, $U, $P, $mysqli; + $lonick=''; + $lines=parse_sessions(); + $stmt=mysqli_prepare($mysqli, 'UPDATE `sessions` SET `lastpost`=\''.(60*($C['kickpenalty']-$C['guestsexpire'])+time()).'\', `status`=\'0\', `kickmessage`=? WHERE `session`=? AND `status`!=\'0\''); + $i=0; + if(isSet($lines)){ + foreach($names as $name){ + foreach($lines as $temp){ + if(($temp['nickname']==$U['nickname'] && $U['nickname']==$name) || ($U['status']>$temp['status'] && (($temp['nickname']==$name && $temp['status']>0) || ($name=='&' && $temp['status']==1)))){ + mysqli_stmt_bind_param($stmt, 'ss', $mes, $temp['session']); + mysqli_stmt_execute($stmt); + $lonick.="$temp[displayname], "; + $i++; + unset($P[$name]); + } + } + } + } + mysqli_stmt_close($stmt); + if($C['msgkick']){ + if($names[0]=='&'){ + add_system_message(get_setting('msgallkick')); + }else{ + $lonick=preg_replace('/\,\s$/','',$lonick); + if($lonick!==''){ + if($i>1){ + add_system_message(sprintf(get_setting('msgmultikick'), $lonick)); + }else{ + add_system_message(sprintf(get_setting('msgkick'), $lonick)); + } + } + } + } +} + +function logout_chatter($names){ + global $U, $P, $mysqli; + $lines=parse_sessions(); + $stmt=mysqli_prepare($mysqli, 'DELETE FROM `sessions` WHERE `session`=? AND `status`$U[kickmessage]"); + } +} + +function get_nowchatting(){ + global $M, $G, $P, $I; + parse_sessions(); + return sprintf($I['curchat'], count($P)).'
'.implode('   ', $M).'   '.implode('   ', $G); +} + +function parse_sessions(){ + global $U, $P, $M, $G, $C, $mysqli, $countmods; + $result=mysqli_query($mysqli, 'SELECT `nickname`, `status` FROM `sessions` WHERE (`lastpost`<\''.(time()-60*$C['guestsexpire']).'\' AND `status`<=\'2\') OR (`lastpost`<\''.(time()-60*$C['sessionexpire']).'\' AND `status`>\'2\')'); + if(mysqli_num_rows($result)>0){ + $stmt=mysqli_prepare($mysqli, 'DELETE FROM `sessions` WHERE `nickname`=?'); + $stmt1=mysqli_prepare($mysqli, 'UPDATE `messages` SET `poster`=\'\' WHERE `poster`=? AND `poststatus`=\'9\''); + $stmt2=mysqli_prepare($mysqli, 'UPDATE `messages` SET `recipient`=\'\' WHERE `recipient`=? AND `poststatus`=\'9\''); + while($temp=mysqli_fetch_array($result, MYSQLI_ASSOC)){ + mysqli_stmt_bind_param($stmt, 's', $temp['nickname']); + mysqli_stmt_execute($stmt); + if($temp['status']<=1){ + mysqli_stmt_bind_param($stmt1, 's', $temp['nickname']); + mysqli_stmt_bind_param($stmt2, 's', $temp['nickname']); + mysqli_stmt_execute($stmt1); + mysqli_stmt_execute($stmt2); + } + } + mysqli_stmt_close($stmt); + mysqli_stmt_close($stmt1); + mysqli_stmt_close($stmt2); + } + $result=mysqli_query($mysqli, 'SELECT * FROM `sessions` WHERE `entry`=\'0\' ORDER BY `status` DESC, `lastpost` DESC'); + if(mysqli_num_rows($result)>0){ + while($line=mysqli_fetch_array($result, MYSQLI_ASSOC)) $lines[]=$line; + if(isSet($_REQUEST['session'])){ + foreach($lines as $temp){ + if($temp['session']==$_REQUEST['session']){ + $U=$temp; + add_user_defaults(); + } + } + } + $countmods=0; + $G=array(); + $M=array(); + $P=array(); + foreach($lines as $temp){ + if($temp['status']==1 || $temp['status']==2){ + $P[$temp['nickname']]=[$temp['nickname'], $temp['status'], $temp['style']]; + $G[]=$temp['displayname']; + }elseif($temp['status']>2){ + $P[$temp['nickname']]=[$temp['nickname'], $temp['status'], $temp['style']]; + $M[]=$temp['displayname']; + if($temp['status']>=5) $countmods++; + } + } + return $lines; + } + return; +} + +// member handling + +function check_member(){ + global $U, $I, $mysqli; + $stmt=mysqli_prepare($mysqli, 'SELECT `nickname`, `passhash`, `status`, `refresh`, `colour`, `bgcolour`, `fontface`, `fonttags`, `boxwidth`, `boxheight`, `notesboxwidth`, `notesboxheight`, `lastlogin`, `timestamps`, `embed` FROM `members` WHERE `nickname`=?'); + mysqli_stmt_bind_param($stmt, 's', $U['nickname']); + mysqli_stmt_execute($stmt); + mysqli_stmt_bind_result($stmt, $temp['nickname'], $temp['passhash'], $temp['status'], $temp['refresh'], $temp['colour'], $temp['bgcolour'], $temp['fontface'], $temp['fonttags'], $temp['boxwidth'], $temp['boxheight'], $temp['notesboxwidth'], $temp['notesboxheight'], $temp['lastlogin'], $temp['timestamps'], $temp['embed']); + if(mysqli_stmt_fetch($stmt)){ + mysqli_stmt_close($stmt); + if($temp['passhash']==$U['passhash']){ + $U=$temp; + $stmt=mysqli_prepare($mysqli, 'UPDATE `members` SET `lastlogin`=? WHERE `nickname`=?'); + mysqli_stmt_bind_param($stmt, 'ds', time(), $U['nickname']); + mysqli_stmt_execute($stmt); + mysqli_stmt_close($stmt); + }else{ + send_error($I['invalpass']); + } + }else{ + mysqli_stmt_close($stmt); + } +} + +function read_members(){ + global $A, $F, $mysqli; + $result=mysqli_query($mysqli, 'SELECT * FROM `members`'); + if(mysqli_num_rows($result)>0){ + while($temp=mysqli_fetch_array($result, MYSQLI_ASSOC)){ + $A[$temp['nickname']][0]=$temp['nickname']; + $A[$temp['nickname']][1]=$temp['status']; + $A[$temp['nickname']][2]=@get_style("#$temp[colour] {$F[$temp['fontface']]} <$temp[fonttags]>"); + } + } +} + +function register_guest($status){ + global $P, $U, $C, $I, $mysqli; + if($_REQUEST['name']=='') send_admin(); + if(!isSet($P[$_REQUEST['name']])) send_admin(sprintf($I['cantreg'], $_REQUEST['name'])); + $stmt=mysqli_prepare($mysqli, 'SELECT `session`, `nickname`, `displayname`, `passhash`, `refresh`, `fontinfo`, `bgcolour`, `boxwidth`, `boxheight`, `notesboxwidth`, `notesboxheight`, `timestamps`, `embed` FROM `sessions` WHERE `nickname`=? AND `status`=\'1\''); + mysqli_stmt_bind_param($stmt, 's', $_REQUEST['name']); + mysqli_stmt_execute($stmt); + mysqli_stmt_bind_result($stmt, $reg['session'], $reg['nickname'], $reg['displayname'], $reg['passhash'], $reg['refresh'], $reg['fontinfo'], $reg['bgcolour'], $reg['boxwidth'], $reg['boxheight'], $reg['notesboxwidth'], $reg['notesboxheight'], $reg['timestamps'], $reg['embed']); + if(mysqli_stmt_fetch($stmt)){ + mysqli_stmt_close($stmt); + $reg['status']=$status; + if(preg_match('/#([a-f0-9]{6})/i', $reg['fontinfo'], $match)) $reg['colour']=$match[1]; + else $reg['colour']=$C['coltxt']; + $stmt=mysqli_prepare($mysqli, 'UPDATE `sessions` SET `status`=? WHERE `session`=?'); + mysqli_stmt_bind_param($stmt, 'ds', $reg['status'], $reg['session']); + mysqli_stmt_execute($stmt); + mysqli_stmt_close($stmt); + }else{ + mysqli_stmt_close($stmt); + } + if(!isSet($reg['status'])) send_admin(sprintf($I['cantreg'], $_REQUEST['name'])); + $stmt=mysqli_prepare($mysqli, 'SELECT * FROM `members` WHERE `nickname`=?'); + mysqli_stmt_bind_param($stmt, 's', $_REQUEST['name']); + mysqli_stmt_execute($stmt); + mysqli_stmt_store_result($stmt); + if(mysqli_stmt_num_rows($stmt)>0) send_admin(sprintf($I['alreadyreged'], $_REQUEST['name'])); + mysqli_stmt_free_result($stmt); + mysqli_stmt_close($stmt); + $stmt=mysqli_prepare($mysqli, 'INSERT INTO `members`(`nickname`, `passhash`, `status`, `refresh`, `colour`, `bgcolour`, `boxwidth`, `boxheight`, `notesboxwidth`, `notesboxheight`, `regedby`, `timestamps`, `embed`) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)'); + mysqli_stmt_bind_param($stmt, 'ssddssddddsdd', $reg['nickname'], $reg['passhash'], $reg['status'], $reg['refresh'], $reg['colour'], $reg['bgcolour'], $reg['boxwidth'], $reg['boxheight'], $reg['notesboxwidth'], $reg['notesboxheight'], $U['nickname'], $reg['timestamps'], $reg['embed']); + mysqli_stmt_execute($stmt); + mysqli_stmt_close($stmt); + if($reg['status']==3) add_system_message(sprintf(get_setting('msgmemreg'), $reg['displayname'])); + else add_system_message(sprintf(get_setting('msgsureg'), $reg['displayname'])); +} + +function register_new(){ + global $C, $U, $P, $I, $mysqli; + $_REQUEST['name']=cleanup_nick($_REQUEST['name']); + if($_REQUEST['name']=='') send_admin(); + if(isSet($P[$_REQUEST['name']])) send_admin(sprintf($I['cantreg'], $_REQUEST['name'])); + if(!valid_nick($_REQUEST['name'])) send_admin(sprintf($I['invalnick'], $C['maxname'])); + $stmt=mysqli_prepare($mysqli, 'SELECT * FROM `members` WHERE `nickname`=?'); + mysqli_stmt_bind_param($stmt, 's', $_REQUEST['name']); + mysqli_stmt_execute($stmt); + mysqli_stmt_store_result($stmt); + if(mysqli_stmt_num_rows($stmt)>0) send_admin(sprintf($I['alreadyreged'], $_REQUEST['name'])); + mysqli_stmt_free_result($stmt); + mysqli_stmt_close($stmt); + $reg=array( + 'nickname' =>$_REQUEST['name'], + 'passhash' =>md5(sha1(md5($_REQUEST['name'].$_REQUEST['pass']))), + 'status' =>3, + 'refresh' =>$C['defaultrefresh'], + 'colour' =>$C['coltxt'], + 'bgcolour' =>$C['colbg'], + 'boxwidth' =>$C['boxwidth'], + 'boxheight' =>$C['boxheight'], + 'notesboxwidth' =>$C['notesboxwidth'], + 'notesboxheight'=>$C['notesboxheight'], + 'regedby' =>$U['nickname'], + 'timestamps' =>$C['timestamps'], + 'embed' =>$C['embed'] + ); + $stmt=mysqli_prepare($mysqli, 'INSERT INTO `members`(`nickname`, `passhash`, `status`, `refresh`, `colour`, `bgcolour`, `boxwidth`, `boxheight`,`notesboxwidth`, `notesboxheight`, `regedby`, `timestamps`, `embed`) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)'); + mysqli_stmt_bind_param($stmt, 'ssddssddddsdd', $reg['nickname'], $reg['passhash'], $reg['status'], $reg['refresh'], $reg['colour'], $reg['bgcolour'], $reg['boxwidth'], $reg['boxheight'], $reg['notesboxwidth'], $reg['notesboxheight'], $reg['regedby'], $reg['timestamps'], $reg['embed']); + mysqli_stmt_execute($stmt); + mysqli_stmt_close($stmt); + send_admin(sprintf($I['successreg'], $reg['nickname'])); +} + +function change_status(){ + global $U, $I, $mysqli; + if(!isSet($_REQUEST['name']) || $_REQUEST['name']=='') send_admin(); + if($U['status']<=$_REQUEST['set'] || !preg_match('/^[023567\-]$/', $_REQUEST['set'])) send_admin(sprintf($I['cantchgstat'], $_REQUEST['name'])); + $stmt=mysqli_prepare($mysqli, 'SELECT * FROM `members` WHERE `nickname`=? AND `status`0){ + mysqli_stmt_free_result($stmt); + mysqli_stmt_close($stmt); + if($_REQUEST['set']=='-'){ + $stmt=mysqli_prepare($mysqli, 'DELETE FROM `members` WHERE `nickname`=?'); + mysqli_stmt_bind_param($stmt, 's', $_REQUEST['name']); + mysqli_stmt_execute($stmt); + mysqli_stmt_close($stmt); + $stmt=mysqli_prepare($mysqli, 'UPDATE `sessions` SET `status`=\'1\' WHERE `nickname`=?'); + mysqli_stmt_bind_param($stmt, 's', $_REQUEST['name']); + mysqli_stmt_execute($stmt); + mysqli_stmt_close($stmt); + send_admin(sprintf($I['succdel'], $_REQUEST['name'])); + }else{ + $stmt=mysqli_prepare($mysqli, 'UPDATE `members` SET `status`=? WHERE `nickname`=?'); + mysqli_stmt_bind_param($stmt, 'ds', $_REQUEST['set'], $_REQUEST['name']); + mysqli_stmt_execute($stmt); + mysqli_stmt_close($stmt); + $stmt=mysqli_prepare($mysqli, 'UPDATE `sessions` SET `status`=? WHERE `nickname`=?'); + mysqli_stmt_bind_param($stmt, 'ds', $_REQUEST['set'], $_REQUEST['name']); + mysqli_stmt_execute($stmt); + mysqli_stmt_close($stmt); + send_admin(sprintf($I['succchg'], $_REQUEST['name'])); + } + }else{ + send_admin(sprintf($I['cantchgstat'], $_REQUEST['name'])); + mysqli_stmt_free_result($stmt); + mysqli_stmt_close($stmt); + } +} + +function amend_profile(){ + global $U, $F, $C; + if(isSet($_REQUEST['refresh'])) $U['refresh']=$_REQUEST['refresh']; + else $U['refresh']=$C['defaultrefresh']; + if($U['refresh']<20) $U['refresh']=20; + if($U['refresh']>150) $U['refresh']=150; + if(preg_match('/^[a-f0-9]{6}$/i', $_REQUEST['colour'])) $U['colour']=$_REQUEST['colour']; + else $U['colour']=$C['coltxt']; + if(preg_match('/^[a-f0-9]{6}$/i', $_REQUEST['bgcolour'])) $U['bgcolour']=$_REQUEST['bgcolour']; + else $U['bgcolour']=$C['colbg']; + $U['fonttags']=''; + if($U['status']>=3 && isSet($_REQUEST['bold'])) $U['fonttags'].='b'; + if($U['status']>=3 && isSet($_REQUEST['italic'])) $U['fonttags'].='i'; + if($U['status']>=3 && isSet($F[$_REQUEST['font']])) $U['fontface']=$_REQUEST['font']; + @$U['fontinfo']="#$U[colour] {$F[$U['fontface']]} <$U[fonttags]>"; + if(!isSet($U['fontinfo'])) $U['fontinfo']=''; + $U['style']=get_style($U['fontinfo']); + $U['displayname']=style_this($U['nickname'], $U['fontinfo']); + if($_REQUEST['boxwidth']>0) $U['boxwidth']=$_REQUEST['boxwidth']; + if($_REQUEST['boxheight']>0) $U['boxheight']=$_REQUEST['boxheight']; + if(isSet($_REQUEST['notesboxwidth']) && $_REQUEST['notesboxwidth']>0) $U['notesboxwidth']=$_REQUEST['notesboxwidth']; + if(isSet($_REQUEST['notesboxheight']) && $_REQUEST['notesboxheight']>0) $U['notesboxheight']=$_REQUEST['notesboxheight']; + if(isSet($_REQUEST['timestamps'])) $U['timestamps']=true; + else $U['timestamps']=false; + if(isSet($_REQUEST['embed'])) $U['embed']=true; + else $U['embed']=false; + if($U['boxwidth']>=1000) $U['boxwidth']=40; + if($U['boxheight']>=1000) $U['boxheight']=3; + if($U['notesboxwidth']>=1000) $U['notesboxwidth']=80; + if($U['notesboxheight']>=1000) $U['notesboxheight']=30; +} + +function save_profile(){ + global $U, $C, $I, $mysqli; + if(isSet($_REQUEST['oldpass']) && $_REQUEST['oldpass']=='' && ($_REQUEST['newpass']!=='' || $_REQUEST['confirmpass']!=='')){ + send_profile($I['wrongpass']); + }elseif(isSet($_REQUEST['newpass']) && $_REQUEST['newpass']!==$_REQUEST['confirmpass']){ + send_profile($I['noconfirm']); + } + // check and rewrite session + if(isSet($_REQUEST['oldpass']) && $_REQUEST['oldpass']!==''){ + $U['oldhash']=md5(sha1(md5($U['nickname'].$_REQUEST['oldpass']))); + }else{ + $U['oldhash']=$U['passhash']; + } + if(isSet($_REQUEST['newpass']) && $_REQUEST['newpass']!==''){ + $U['newhash']=md5(sha1(md5($U['nickname'].$_REQUEST['newpass']))); + }else{ + $U['newhash']=$U['passhash']; + } + $U['orihash']=$U['passhash']; + $stmt=mysqli_prepare($mysqli, 'SELECT * FROM `sessions` WHERE `session`=? AND `passhash`=?'); + mysqli_stmt_bind_param($stmt, 'ss', $U['session'], $U['oldhash']); + mysqli_stmt_execute($stmt); + mysqli_stmt_store_result($stmt); + if(mysqli_stmt_num_rows($stmt)>0){ + mysqli_stmt_free_result($stmt); + mysqli_stmt_close($stmt); + amend_profile(); + $U['passhash']=$U['newhash']; + $stmt=mysqli_prepare($mysqli, 'UPDATE `sessions` SET `refresh`=?, `displayname`=?, `fontinfo`=?, `style`=?, `passhash`=?, `boxwidth`=?, `boxheight`=?, `bgcolour`=?, `notesboxwidth`=?, `notesboxheight`=?, `timestamps`=?, `embed`=? WHERE `session`=?'); + mysqli_stmt_bind_param($stmt, 'dssssddsdddds', $U['refresh'], $U['displayname'], $U['fontinfo'], $U['style'], $U['passhash'], $U['boxwidth'], $U['boxheight'], $U['bgcolour'], $U['notesboxwidth'], $U['notesboxheight'], $U['timestamps'], $U['embed'], $U['session']); + mysqli_stmt_execute($stmt); + mysqli_stmt_close($stmt); + }else{ + mysqli_stmt_free_result($stmt); + mysqli_stmt_close($stmt); + } + if($U['orihash']!==$U['oldhash']) send_profile($I['wrongpass']); + // rewrite member file + if($U['status']>=2){ + $err=''; + $stmt=mysqli_prepare($mysqli, 'SELECT `passhash`, `status` FROM `members` WHERE `nickname`=?'); + mysqli_stmt_bind_param($stmt, 's', $U['nickname']); + mysqli_stmt_execute($stmt); + mysqli_stmt_bind_result($stmt, $temp['passhash'], $temp['status']); + if(mysqli_stmt_fetch($stmt)){ + mysqli_stmt_close($stmt); + $U['sessionstatus']=$U['status']; + $U['status']=$temp['status']; + if($temp['passhash']!==$U['orihash']){ + $err=$I['wrongpass']; + }else{ + $stmt=mysqli_prepare($mysqli, 'UPDATE `members` SET `passhash`=?, `refresh`=?, `colour`=?, `bgcolour`=?, `fontface`=?, `fonttags`=?, `boxwidth`=?, `boxheight`=?, `notesboxwidth`=?, `notesboxheight`=?, `timestamps`=?, `embed`=? WHERE `nickname`=?'); + mysqli_stmt_bind_param($stmt, 'sdssssdddddds', $U['passhash'], $U['refresh'], $U['colour'], $U['bgcolour'], $U['fontface'], $U['fonttags'], $U['boxwidth'], $U['boxheight'], $U['notesboxwidth'], $U['notesboxheight'], $U['timestamps'], $U['embed'], $U['nickname']); + mysqli_stmt_execute($stmt); + mysqli_stmt_close($stmt); + } + $U['status']=$U['sessionstatus']; + }else{ + mysqli_stmt_close($stmt); + } + if($err!=='') send_profile($err); + } + send_profile($I['succprofile']); +} + +function add_user_defaults(){ + global $U, $F, $C, $H; + if(isSet($_SERVER['HTTP_USER_AGENT'])) $U['useragent']=htmlspecialchars($_SERVER['HTTP_USER_AGENT']); + else $U['useragent']=''; + if(!isSet($U['refresh'])) $U['refresh']=$C['defaultrefresh']; + if(!isSet($U['fontinfo'])){ + if(!preg_match('/^[a-f0-9]{6}$/i', $U['colour'])){ + $U['colour']=$C['coltxt']; + do{ + $U['colour']=sprintf('%02X', rand(0, 256)).sprintf('%02X', rand(0, 256)).sprintf('%02X', rand(0, 256)); + }while(abs(greyval($U['colour'])-greyval($C['colbg']))<75); + } + $U['fontinfo']="#$U[colour]"; + @$U['fontinfo'].=" {$F[$U['fontface']]} <$U[fonttags]>"; + } + if(!isSet($U['bgcolour']) || !preg_match('/^[a-f0-9]{6}$/i', $U['bgcolour'])) $U['bgcolour']=$C['colbg']; + $H['begin_body']="\n\n"; + if(!isSet($U['colour'])){ + preg_match('/([0-9a-f]{6})/i', $U['fontinfo'], $matches); + $U['colour']=$matches[0]; + } + if(!isSet($U['style'])) $U['style']=get_style($U['fontinfo']); + if(!isSet($U['boxwidth'])) $U['boxwidth']=40; + if(!isSet($U['boxheight'])) $U['boxheight']=3; + if(!isSet($U['notesboxwidth'])) $U['notesboxwidth']=80; + if(!isSet($U['notesboxheight'])) $U['notesboxheight']=30; + if(!isSet($U['timestamps'])) $U['timestamps']=$C['timestamps']; + if(!isSet($U['embed'])) $U['embed']=$C['embed']; + if(!isSet($U['lastpost'])) $U['lastpost']=time(); + if(!isSet($U['entry'])) $U['entry']=0; + if(!isSet($U['postid'])) $U['postid']='OOOOOO'; + if(!isSet($U['displayname'])) $U['displayname']=style_this($U['nickname'], $U['fontinfo']); +} + +// message handling + +function validate_input(){ + global $U, $P, $C; + $U['message']=substr($_REQUEST['message'], 0, $C['maxmessage']); + if(!isSet($U['rejected'])) $U['rejected']=substr($_REQUEST['message'], $C['maxmessage']); + if(preg_match('/&[^;]{0,8}$/', $U['message']) && preg_match('/^([^;]{0,8};)/', $U['rejected'], $match)){ + $U['message'].=$match[0]; + $U['rejected']=preg_replace("/^$match[0]", '', $U['rejected']); + } + if($U['rejected']){ + $U['rejected']=htmlspecialchars($U['rejected']); + $U['rejected']=preg_replace('/
(
)+/', '

', $U['rejected']); + $U['rejected']=preg_replace('/

$/', '
', $U['rejected']); + $U['rejected']=preg_replace('/
/', "\n", $U['rejected']); + $U['rejected']=preg_replace('/^\s+|\s+$/', '', $U['rejected']); + } + $U['message']=htmlspecialchars($U['message']); + $U['message']=preg_replace("/\r\n/", '
', $U['message']); + $U['message']=preg_replace("/\n/", '
', $U['message']); + $U['message']=preg_replace("/\r/", '
', $U['message']); + if($_REQUEST['multi']=='on'){ + $U['message']=preg_replace('/
(
)+/', '

', $U['message']); + $U['message']=preg_replace('/

$/', '
', $U['message']); + $U['message']=preg_replace('/ /', '  ', $U['message']); + $U['message']=preg_replace('/
/', '
 ', $U['message']); + }else{ + $U['message']=preg_replace('/
/', ' ', $U['message']); + $U['message']=preg_replace('/^\s+|\s+$/', '', $U['message']); + $U['message']=preg_replace('/\s+/', ' ', $U['message']); + } + $U['delstatus']=$U['status']; + $U['recipient']=''; + if($_REQUEST['sendto']=='*'){ + $U['poststatus']='1'; + $U['displaysend']="$U[displayname] - "; + }elseif($_REQUEST['sendto']=='?' && $U['status']>=3){ + $U['poststatus']='3'; + $U['displaysend']="[M] $U[displayname] - "; + }elseif($_REQUEST['sendto']=='#' && $U['status']>=5){ + $U['poststatus']='5'; + $U['displaysend']="[Staff] $U[displayname] - "; + }elseif($_REQUEST['sendto']=='&' && $U['status']>=6){ + $U['poststatus']='6'; + $U['displaysend']="[Admin] $U[displayname] - "; + }else{// known nick in room? + foreach($P as $chatter){ + if($_REQUEST['sendto']==$chatter[0]){ + $U['recipient']=$chatter[0]; + $U['displayrecp']=style_this($chatter[0], $chatter[2]); + } + } + if($U['recipient']!==''){ + $U['poststatus']='9'; + $U['delstatus']='9'; + $U['displaysend']="[$U[displayname] to $U[displayrecp]] - "; + }else{// nick left already + $U['message']=''; + $U['rejected']=''; + } + } + if(isSet($U['poststatus'])){ + update_session(); + if($U['poststatus']==9) apply_filter(true); + else apply_filter(false); + create_hotlinks(); + } +} + +function apply_filter($pm){ + global $U, $I, $mysqli; + $result=mysqli_query($mysqli, 'SELECT * FROM `filter`'); + if(mysqli_num_rows($result)>0){ + while($filter=mysqli_fetch_array($result, MYSQLI_ASSOC)){ + if(!$pm) $U['message']=preg_replace("/$filter[match]/i", $filter['replace'], $U['message'], -1, $count); + elseif(!$filter['allowinpm']) $U['message']=preg_replace("/$filter[match]/i", $filter['replace'], $U['message'], -1, $count); + if($count>0 && $filter['kick']){ + kick_chatter(array($U['nickname']), ''); + send_error("$I[kicked]"); + } + } + } +} + +function create_hotlinks(){ + global $U, $C; + //Make hotlinks for URLs, redirect through dereferrer script to prevent session leakage + // 1. all explicit schemes with whatever xxx://yyyyyyy + $U['message']=preg_replace('~(\w*://[^\s<>]+)~i', "<<$1>>", $U['message']); + // 2. valid URLs without scheme: + $U['message']=preg_replace('~((?:[^\s<>]*:[^\s<>]*@)?[a-z0-9\-]+(?:\.[a-z0-9\-]+)+(?::\d*)?/[^\s<>]*)(?![^<>]*>)~i', "<<$1>>", $U['message']); // server/path given + $U['message']=preg_replace('~((?:[^\s<>]*:[^\s<>]*@)?[a-z0-9\-]+(?:\.[a-z0-9\-]+)+:\d+)(?![^<>]*>)~i', "<<$1>>", $U['message']); // server:port given + $U['message']=preg_replace('~([^\s<>]*:[^\s<>]*@[a-z0-9\-]+(?:\.[a-z0-9\-]+)+(?::\d+)?)(?![^<>]*>)~i', "<<$1>>", $U['message']); // au:th@server given + // 3. likely servers without any hints but not filenames like *.rar zip exe etc. + $U['message']=preg_replace('~((?:[a-z0-9\-]+\.)*[a-z0-9]{16}\.onion)(?![^<>]*>)~i', "<<$1>>", $U['message']);// *.onion + $U['message']=preg_replace('~([a-z0-9\-]+(?:\.[a-z0-9\-]+)+(?:\.(?!rar|zip|exe|gz|7z|bat|doc)[a-z]{2,}))(?=[^a-z0-9\-\.]|$)(?![^<>]*>)~i', "<<$1>>", $U['message']);// xxx.yyy.zzz + // Convert every <<....>> into proper links: + $U['message']=preg_replace_callback('/<<([^<>]+)>>/', function ($matches){if(strpos($matches[1], '://')==false){ return "$matches[1]";}else{ return "$matches[1]"; }}, $U['message']); + if($C['imgembed']) $U['message']=preg_replace_callback('/\[img\](.*?(?=<\/a>))<\/a>/i', function ($matched){ return "

";}, $U['message']); + if($C['vidembed']) $U['message']=preg_replace_callback('/\[vid\](.*?(?=<\/a>))<\/a>/i', function ($matched){ return "

";}, $U['message']); + if($C['forceredirect']) $U['message']=preg_replace_callback('/(.*?(?=<\/a>))<\/a>/', function ($matched){ global $C; return "$matched[2]";}, $U['message']); + if(preg_match_all('/(.*?(?=<\/a>))<\/a>/', $U['message'], $matches)){ + foreach($matches[1] as $match){ + if(!preg_match('~^http(s)?://~', $match)){ + $U['message']=preg_replace_callback('/(.*?(?=<\/a>))<\/a>/', function ($matched){ global $C; return "$matched[2]";}, $U['message']); + break; + } + } + } +} + +function add_message(){ + global $U; + if($U['message']=='') return; + $newmessage=array( + 'postdate' =>time(), + 'postid' =>$U['postid'], + 'poststatus'=>$U['poststatus'], + 'poster' =>$U['nickname'], + 'recipient' =>$U['recipient'], + 'text' =>$U['displaysend'].style_this($U['message'], $U['fontinfo']), + 'delstatus' =>$U['delstatus'] + ); + write_message($newmessage); +} + +function add_system_message($mes){ + $sysmessage=array( + 'postdate' =>time(), + 'postid' =>substr(rand(), -6), + 'poststatus' =>1, + 'poster' =>'', + 'recipient' =>'', + 'text' =>$mes, + 'delstatus' =>9 + ); + write_message($sysmessage); +} + +function write_message($message){ + global $C, $mysqli; + $stmt=mysqli_prepare($mysqli, 'INSERT INTO `messages`(`postdate`, `postid`, `poststatus`, `poster`, `recipient`, `text`, `delstatus`) VALUES (?, ?, ?, ?, ?, ?, ?)'); + mysqli_stmt_bind_param($stmt, 'dddsssd', $message['postdate'], $message['postid'], $message['poststatus'], $message['poster'], $message['recipient'], $message['text'], $message['delstatus']); + mysqli_stmt_execute($stmt); + mysqli_stmt_close($stmt); + $stmt=mysqli_prepare($mysqli, 'DELETE FROM `messages` WHERE `id` NOT IN (SELECT `id` FROM (SELECT `id` FROM `messages` ORDER BY `postdate` DESC LIMIT ?) t )'); + mysqli_stmt_bind_param($stmt, 'd', $limit=$C['keeplimit']*$C['messagelimit']); + mysqli_stmt_execute($stmt); + mysqli_stmt_close($stmt); + if($C['sendmail'] && $message['poststatus']<9){ + $subject = 'New Chat message'; + $headers = "From: $C[mailsender]\r\nX-Mailer: PHP/".phpversion()."\r\nContent-Type: text/html; charset=UTF-8\r\n"; + mail($C['mailreceiver'], $subject, $message['text'], $headers); + } +} + +function clean_room(){ + global $C, $mysqli; + mysqli_query($mysqli, 'DELETE FROM `messages`'); + $sysmessage=array( + 'postdate' =>time(), + 'postid' =>substr(rand(), -6), + 'poster' =>'', + 'recipient' =>'', + 'poststatus' =>1, + 'text' =>sprintf(get_setting('msgclean'), $C['chatname']), + 'delstatus' =>9 + ); + write_message($sysmessage); +} + +function clean_selected(){ + global $C, $mysqli; + if(isSet($_REQUEST['mid'])){ + foreach($_REQUEST['mid'] as $mid) $mids[$mid]=1; + } + $result=mysqli_query($mysqli, 'SELECT * FROM `messages` ORDER BY `postdate` DESC'); + if(mysqli_num_rows($result)>0){ + $stmt=mysqli_prepare($mysqli, 'DELETE FROM `messages` WHERE `postdate`=? AND `postid`=?'); + while($temp=mysqli_fetch_array($result, MYSQLI_ASSOC)){ + if(isSet($mids[$temp['postdate'].$temp['postid']])){ + mysqli_stmt_bind_param($stmt, 'dd', $temp['postdate'], $temp['postid']); + mysqli_stmt_execute($stmt); + } + } + mysqli_stmt_close($stmt); + } +} + +function del_all_messages($nick){ + global $mysqli; + $stmt=mysqli_prepare($mysqli, 'DELETE FROM `messages` WHERE `poster`=?'); + mysqli_stmt_bind_param($stmt, 's', $nick); + mysqli_stmt_execute($stmt); + mysqli_stmt_close($stmt); +} + +function del_last_message(){ + global $U, $mysqli; + $stmt=mysqli_prepare($mysqli, 'DELETE FROM `messages` WHERE `poster`=? ORDER BY `postdate` DESC LIMIT 1'); + mysqli_stmt_bind_param($stmt, 's', $U['nickname']); + mysqli_stmt_execute($stmt); + mysqli_stmt_close($stmt); +} + +function print_messages($delstatus=''){ + global $U, $C, $mysqli; + mysqli_query($mysqli, 'DELETE FROM `messages` WHERE `postdate`<=\''.(time()-60*$C['messageexpire'])."'"); + $stmt=mysqli_prepare($mysqli, 'SELECT `postdate`, `postid`, `text`, `delstatus` FROM `messages` WHERE `id` IN (SELECT * FROM (SELECT `id` FROM `messages` WHERE `poststatus`=\'1\' ORDER BY `postdate` DESC LIMIT ?) AS t) OR (`poststatus`>\'1\' AND `poststatus`<=?) OR (`poststatus`=\'9\' AND (`poster`=? OR `recipient`=?)) ORDER BY `postdate` DESC'); + mysqli_stmt_bind_param($stmt, 'ddss', $C['messagelimit'], $U['status'], $U['nickname'], $U['nickname']); + mysqli_stmt_execute($stmt); + mysqli_stmt_bind_result($stmt, $message['postdate'], $message['postid'], $message['text'], $message['delstatus']); + while(mysqli_stmt_fetch($stmt)){ + if($delstatus!==''){ + if($U['status']>$message['delstatus']){ + echo "
"; + } + }else{ + if(!isSet($_COOKIE[$C['cookiename']]) && !$C['forceredirect']){ + $message['text']=preg_replace_callback('/(.*?(?=<\/a>))<\/a>/', function ($matched){ global $C; return "$matched[2]";}, $message['text']); + } + if(!$U['embed'] && preg_match('/<(img|video) src="(.*?(?="))">/', $message['text'], $matches)){ + $message['text']=preg_replace_callback("/<$matches[1] src=\"(.*?(?=\"))\">/", function ($matched){ return $matched[1];}, $message['text']); + } + if($U['timestamps']) echo ''.date('m-d H:i:s', $message['postdate']).' - '; + echo "$message[text]
"; + } + } + mysqli_stmt_close($stmt); +} + +// this and that + +function valid_admin(){ + global $mysqli; + if(isSet($_REQUEST['nick']) && isSet($_REQUEST['pass'])){ + $stmt=mysqli_prepare($mysqli, 'SELECT * FROM `members` WHERE `nickname`=? AND `passhash`=? AND `status`>=\'7\''); + mysqli_stmt_bind_param($stmt, 'ss', $_REQUEST['nick'], $pass=md5(sha1(md5($_REQUEST['nick'].$_REQUEST['pass'])))); + mysqli_stmt_execute($stmt); + mysqli_stmt_store_result($stmt); + if(mysqli_stmt_num_rows($stmt)>0) return true; + mysqli_stmt_free_result($stmt); + mysqli_stmt_close($stmt); + } + return false; +} + +function valid_nick($nick){ + return preg_match('/^[a-z0-9]*$/i', $nick); +} + +function allowed_nick($nick){ + global $C; + return preg_match("/^.{1,$C[maxname]}$/", $nick); +} + +function cleanup_nick($nick){ + $nick=preg_replace('/\s+/', '', $nick); + return $nick; +} + +function get_timeout($lastpost, $status){ // lastpost, status + global $C; + if($status>2) $expire=$C['sessionexpire']; + else $expire=$C['guestsexpire']; + $s=($lastpost+60*$expire)-time(); + $m=$s/60;$m=floor($m);$s-=$m*60; + $h=$m/60;$h=floor($h);$m-=$h*60; + $s=substr('0'.$s, -2, 2); + if($h>0){ + $m=substr('0'.$m, -2, 2); + return "$h:$m:$s"; + } + return "$m:$s"; +} + +function print_colours(){ + global $C, $I; + // Prints a short list with selected named HTML colours and filters out illegible text colours for the given background. + // It's a simple comparison of weighted grey values. This is not very accurate but gets the job done well enough. + $colours=array('Beige'=>'F5F5DC', 'Black'=>'000000', 'Blue'=>'0000FF', 'BlueViolet'=>'8A2BE2', 'Brown'=>'A52A2A', 'Cyan'=>'00FFFF', 'DarkBlue'=>'00008B', 'DarkGreen'=>'006400', 'DarkRed'=>'8B0000', 'DarkViolet'=>'9400D3', 'DeepSkyBlue'=>'00BFFF', 'Gold'=>'FFD700', 'Grey'=>'808080', 'Green'=>'008000', 'HotPink'=>'FF69B4', 'Indigo'=>'4B0082', 'LightBlue'=>'ADD8E6', 'LightGreen'=>'90EE90', 'LimeGreen'=>'32CD32', 'Magenta'=>'FF00FF', 'Olive'=>'808000', 'Orange'=>'FFA500', 'OrangeRed'=>'FF4500', 'Purple'=>'800080', 'Red'=>'FF0000', 'RoyalBlue'=>'4169E1', 'SeaGreen'=>'2E8B57', 'Sienna'=>'A0522D', 'Silver'=>'C0C0C0', 'Tan'=>'D2B48C', 'Teal'=>'008080', 'Violet'=>'EE82EE', 'White'=>'FFFFFF', 'Yellow'=>'FFFF00', 'YellowGreen'=>'9ACD32'); + $greybg=greyval($C['colbg']); + foreach($colours as $name=>$colour){ + if(abs($greybg-greyval($colour))>75) echo ""; + } +} + +function greyval($colour){ + return hexdec(substr($colour, 0, 2))*.3+hexdec(substr($colour, 2, 2))*.59+hexdec(substr($colour, 4, 2))*.11; +} + +function get_style($styleinfo){ + $fbold=preg_match('/(|:bold)/', $styleinfo); + $fitalic=preg_match('/(|:italic)/', $styleinfo); + $fsmall=preg_match('/(size="-1"|:smaller)/', $styleinfo); + preg_match('/(#.{6})/', $styleinfo, $match); + if(isSet($match[0])) $fcolour=$match[0]; + preg_match('/face=\'([^"]+)\'/', $styleinfo, $match); + if(isSet($match[1])) $fface=$match[1]; + preg_match('/font-family:([^;]+);/', $styleinfo, $match); + if(isSet($match[1])) $sface=$match[1]; + if(isSet($fface)){ + $sface=$fface; + $sface=preg_replace('/^/', "'", $sface); + $sface=preg_replace('/$/', "'", $sface); + $sface=preg_replace('/,/', "','", $sface); + }elseif(isSet($sface)){ + $fface=$sface; + $fface=preg_replace("/'/", '', $fface); + } + $fstyle=''; + if(isSet($fcolour)) $fstyle.="color:$fcolour;"; + if(isSet($sface)) $fstyle.="font-family:$sface;"; + if($fsmall) $fstyle.='font-size:smaller;'; + if($fitalic) $fstyle.='font-style:italic;'; + if($fbold) $fstyle.='font-weight:bold;'; + return $fstyle; +} + +function style_this($text, $styleinfo){ + $fbold=preg_match('/(|:bold)/', $styleinfo); + $fitalic=preg_match('/(|:italic)/', $styleinfo); + $fsmall=preg_match('/(size="-1"|:smaller)/', $styleinfo); + preg_match('/(#.{6})/', $styleinfo, $match); + if(isSet($match[0]))$fcolour=$match[0]; + preg_match('/face=\'([^"]+)\'/', $styleinfo, $match); + if(isSet($match[1]))$fface=$match[1]; + preg_match('/font-family:([^;]+);/', $styleinfo, $match); + if(isSet($match[1]))$sface=$match[1]; + if(isSet($fface)){ + $sface=$fface; + $sface=preg_replace('/^/', "'", $sface); + $sface=preg_replace('/$/', "'", $sface); + $sface=preg_replace('/,/', "','", $sface); + }elseif(isSet($sface)){ + $fface=$sface; + $fface=preg_replace("/'/", '', $fface); + } + $fstyle=''; + if(isSet($fcolour)) $fstyle.="color:$fcolour;"; + if(isSet($sface)) $fstyle.="font-family:$sface;"; + if($fsmall) $fstyle.='font-size:smaller;'; + if($fitalic)$fstyle.='font-style:italic;'; + if($fbold) $fstyle.='font-weight:bold;'; + $fstart='0){ + $suwrite=$I['initsuexist']; + } + }elseif(!valid_nick($_REQUEST['sunick']) || $_REQUEST['sunick']==''){ + $suwrite=sprintf($I['invalnick'], $C['maxname']); + }elseif($_REQUEST['supass']!==$_REQUEST['supassc']){ + $suwrite=$I['noconfirm']; + }else{ + mysqli_multi_query($mysqli, 'CREATE TABLE IF NOT EXISTS `captcha` (`id` int(10) unsigned NOT NULL, `time` int(10) unsigned NOT NULL) ENGINE=InnoDB DEFAULT CHARSET=utf8; '. + 'CREATE TABLE IF NOT EXISTS `filter` (`id` tinyint(3) unsigned NOT NULL, `match` tinytext NOT NULL, `replace` text NOT NULL, `allowinpm` tinyint(1) unsigned NOT NULL, `regex` tinyint(1) unsigned NOT NULL, `kick` tinyint(1) unsigned NOT NULL) ENGINE=InnoDB DEFAULT CHARSET=utf8; '. + 'CREATE TABLE IF NOT EXISTS `members` (`id` tinyint(3) unsigned NOT NULL, `nickname` tinytext CHARACTER SET utf8 COLLATE utf8_bin NOT NULL, `passhash` tinytext NOT NULL, `status` tinyint(3) unsigned NOT NULL, `refresh` tinyint(3) unsigned NOT NULL, `colour` tinytext NOT NULL, `bgcolour` tinytext NOT NULL, `fontface` tinytext NOT NULL, `fonttags` tinytext NOT NULL, `boxwidth` tinyint(3) unsigned NOT NULL, `boxheight` tinyint(3) unsigned NOT NULL, `notesboxheight` tinyint(3) unsigned NOT NULL, `notesboxwidth` tinyint(3) unsigned NOT NULL, `regedby` tinytext CHARACTER SET utf8 COLLATE utf8_bin NOT NULL, `lastlogin` int(10) unsigned NOT NULL, `timestamps` tinyint(1) unsigned NOT NULL, `embed` tinyint(1) unsigned NOT NULL) ENGINE=InnoDB DEFAULT CHARSET=utf8; '. + 'CREATE TABLE IF NOT EXISTS `messages` (`id` int(10) unsigned NOT NULL, `postdate` int(10) unsigned NOT NULL, `postid` int(10) unsigned NOT NULL, `poststatus` tinyint(3) unsigned NOT NULL, `poster` tinytext CHARACTER SET utf8 COLLATE utf8_bin NOT NULL, `recipient` tinytext CHARACTER SET utf8 COLLATE utf8_bin NOT NULL, `text` text NOT NULL, `delstatus` tinyint(3) unsigned NOT NULL) ENGINE=InnoDB DEFAULT CHARSET=utf8; '. + 'CREATE TABLE IF NOT EXISTS `notes` (`id` int(10) unsigned NOT NULL, `type` tinytext NOT NULL, `lastedited` int(10) unsigned NOT NULL, `editedby` tinytext CHARACTER SET utf8 COLLATE utf8_bin NOT NULL, `text` text NOT NULL) ENGINE=InnoDB DEFAULT CHARSET=utf8; '. + 'CREATE TABLE IF NOT EXISTS `sessions` (`id` int(10) unsigned NOT NULL, `session` tinytext NOT NULL, `nickname` tinytext CHARACTER SET utf8 COLLATE utf8_bin NOT NULL, `displayname` text NOT NULL, `status` tinyint(3) unsigned NOT NULL, `refresh` tinyint(3) unsigned NOT NULL, `fontinfo` tinytext NOT NULL, `style` text NOT NULL, `lastpost` int(10) unsigned NOT NULL, `passhash` tinytext NOT NULL, `postid` int(10) unsigned NOT NULL, `boxwidth` tinyint(3) unsigned NOT NULL, `boxheight` tinyint(3) unsigned NOT NULL, `useragent` text NOT NULL, `kickmessage` text NOT NULL, `bgcolour` tinytext NOT NULL, `notesboxheight` tinyint(3) unsigned NOT NULL, `notesboxwidth` tinyint(3) unsigned NOT NULL, `entry` int(10) unsigned NOT NULL, `timestamps` tinyint(1) unsigned NOT NULL, `embed` tinyint(1) unsigned NOT NULL) ENGINE=InnoDB DEFAULT CHARSET=utf8; '. + 'CREATE TABLE IF NOT EXISTS `settings` (`id` tinyint(3) unsigned NOT NULL, `setting` tinytext NOT NULL, `value` tinytext NOT NULL) ENGINE=InnoDB DEFAULT CHARSET=utf8; '. + 'ALTER TABLE `captcha` ADD UNIQUE KEY `id` (`id`); '. + 'ALTER TABLE `filter` ADD PRIMARY KEY (`id`); '. + 'ALTER TABLE `members` ADD PRIMARY KEY (`id`); '. + 'ALTER TABLE `messages` ADD PRIMARY KEY (`id`); '. + 'ALTER TABLE `notes` ADD PRIMARY KEY (`id`); '. + 'ALTER TABLE `sessions` ADD PRIMARY KEY (`id`); '. + 'ALTER TABLE `settings` ADD PRIMARY KEY (`id`); '. + 'ALTER TABLE `filter` MODIFY `id` tinyint(3) unsigned NOT NULL AUTO_INCREMENT; '. + 'ALTER TABLE `members` MODIFY `id` tinyint(3) unsigned NOT NULL AUTO_INCREMENT; '. + 'ALTER TABLE `messages` MODIFY `id` int(10) unsigned NOT NULL AUTO_INCREMENT; '. + 'ALTER TABLE `notes` MODIFY `id` int(10) unsigned NOT NULL AUTO_INCREMENT; '. + 'ALTER TABLE `sessions` MODIFY `id` int(10) unsigned NOT NULL AUTO_INCREMENT; '. + 'ALTER TABLE `settings` MODIFY `id` tinyint(3) unsigned NOT NULL AUTO_INCREMENT; '. + 'INSERT INTO `settings` (`setting`,`value`) VALUES (\'guestaccess\',\'0\'); '. + 'INSERT INTO `settings` (`setting`,`value`) VALUES (\'msgenter\',\'%s entered the chat.\'); '. + 'INSERT INTO `settings` (`setting`,`value`) VALUES (\'msgexit\',\'%s left the chat.\'); '. + 'INSERT INTO `settings` (`setting`,`value`) VALUES (\'msgmemreg\',\'%s is now a registered member.\'); '. + 'INSERT INTO `settings` (`setting`,`value`) VALUES (\'msgsureg\',\'%s is now a registered applicant.\'); '. + 'INSERT INTO `settings` (`setting`,`value`) VALUES (\'msgkick\',\'%s has been kicked.\'); '. + 'INSERT INTO `settings` (`setting`,`value`) VALUES (\'msgmultikick\',\'%s have been kicked.\'); '. + 'INSERT INTO `settings` (`setting`,`value`) VALUES (\'msgallkick\',\'All chatters have been kicked.\'); '. + 'INSERT INTO `settings` (`setting`,`value`) VALUES (\'msgclean\',\'%s has been cleaned.\'); '. + 'INSERT INTO `settings` (`setting`,`value`) VALUES (\'dbversion\',\''.$C['dbversion'].'\');'); + while(mysqli_next_result($mysqli)) {;} + $reg=array( + 'nickname' =>$_REQUEST['sunick'], + 'passhash' =>md5(sha1(md5($_REQUEST['sunick'].$_REQUEST['supass']))), + 'status' =>8, + 'refresh' =>$C['defaultrefresh'], + 'colour' =>$C['coltxt'], + 'bgcolour' =>$C['colbg'], + 'boxwidth' =>$C['boxwidth'], + 'boxheight' =>$C['boxheight'], + 'notesboxwidth' =>$C['notesboxwidth'], + 'notesboxheight'=>$C['notesboxheight'], + 'timestamps' =>$C['timestamps'], + 'embed' =>$C['embed'] + ); + $stmt=mysqli_prepare($mysqli, 'INSERT INTO `members` (`nickname`, `passhash`, `status`, `refresh`, `colour`, `bgcolour`, `boxwidth`, `boxheight`, `notesboxwidth`, `notesboxheight`, `timestamps`, `embed`) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)'); + mysqli_stmt_bind_param($stmt, 'ssddssdddddd', $reg['nickname'], $reg['passhash'], $reg['status'], $reg['refresh'], $reg['colour'], $reg['bgcolour'], $reg['boxwidth'], $reg['boxheight'], $reg['notesboxwidth'], $reg['notesboxheight'], $reg['timestamps'], $reg['embed']); + mysqli_stmt_execute($stmt); + mysqli_stmt_close($stmt); + $suwrite=$I['susuccess']; + } + print_start(); + print "

$I[init]


$I[sulogin]

$suwrite


"; + print "<$H[form]>".hidden('action', 'setup').hidden('nick', $_REQUEST['sunick']).hidden('pass', $_REQUEST['supass']).submit($I['initgosetup']).''; + print_credits(); + print_end(); +} + +function update_db(){ + global $C, $mysqli; + $dbversion=get_setting('dbversion'); + if($dbversion<$C['dbversion']){ + update_setting('dbversion', $C['dbversion']); + } +} + +function update_messages(){ + global $C; + update_setting('msgenter', $_REQUEST['msgenter']); + update_setting('msgexit', $_REQUEST['msgexit']); + update_setting('msgmemreg', $_REQUEST['msgmemreg']); + if($C['suguests']) update_setting('msgsureg', $_REQUEST['msgsureg']); + update_setting('msgkick', $_REQUEST['msgkick']); + update_setting('msgmultikick', $_REQUEST['msgmultikick']); + update_setting('msgallkick', $_REQUEST['msgallkick']); + update_setting('msgclean', $_REQUEST['msgclean']); +} + +function get_setting($setting){ + global $mysqli; + $stmt=mysqli_prepare($mysqli, 'SELECT `value` FROM `settings` WHERE `setting`=?'); + mysqli_stmt_bind_param($stmt, 's', $setting); + mysqli_stmt_execute($stmt); + mysqli_stmt_bind_result($stmt, $value); + mysqli_stmt_fetch($stmt); + mysqli_stmt_close($stmt); + return $value; +} + +function update_setting($setting, $value){ + global $mysqli; + $stmt=mysqli_prepare($mysqli, 'UPDATE `settings` SET `value`=? WHERE `setting`=?'); + mysqli_stmt_bind_param($stmt, 'ss', $value, $setting); + mysqli_stmt_execute($stmt); + mysqli_stmt_close($stmt); +} + +// configuration, defaults and internals + +function load_fonts(){ + global $F; + $F=array( + 'Arial' =>" face='Arial,Helvetica,sans-serif'", + 'Book Antiqua' =>" face='Book Antiqua,MS Gothic'", + 'Comic' =>" face='Comic Sans MS,Papyrus'", + 'Comic small' =>" face='Comic Sans MS,Papyrus' size=\"-1\"", + 'Courier' =>" face='Courier New,Courier,monospace'", + 'Cursive' =>" face='Cursive,Papyrus'", + 'Fantasy' =>" face='Fantasy,Futura,Papyrus'", + 'Garamond' =>" face='Garamond,Palatino,serif'", + 'Georgia' =>" face='Georgia,Times New Roman,Times,serif'", + 'Serif' =>" face='MS Serif,New York,serif'", + 'System' =>" face='System,Chicago,sans-serif'", + 'Times New Roman' =>" face='Times New Roman,Times,serif'", + 'Verdana' =>" face='Verdana,Geneva,Arial,Helvetica,sans-serif'", + 'Verdana small' =>" face='Verdana,Geneva,Arial,Helvetica,sans-serif' size=\"-1\"" + ); +} + +function load_html(){ + global $H, $C, $I; + $H=array(// default HTML + 'begin_body' =>"\n\n", + 'form' =>"form action=\"$_SERVER[SCRIPT_NAME]\" method=\"post\" style=\"margin:0;padding:0;\"", + 'meta_html' =>"$C[chatname]\n\n\n" + ); + $H=$H+array( + 'backtologin' =>"<$H[form] target=\"_parent\">".submit($I['backtologin'], ' style="background-color:#004400;color:#FFFFFF;"').'', + 'backtochat' =>"<$H[form]>".hidden('action', 'view').@hidden('session', $_REQUEST['session']).submit($I['backtochat'], ' style="background-color:#004400;color:#FFFFFF;"').'' + ); +} + +function check_db(){ + global $mysqli, $C, $I; + $mysqli=mysqli_connect($C['dbhost'], $C['dbuser'], $C['dbpass'], $C['dbname']); + if(mysqli_connect_errno($mysqli)){ + if($_REQUEST['action']=='setup'){ + die($I['nosetupdb']); + }else{ + die($I['nodb']); + } + } +} + +function load_lang(){ + global $C, $I, $L; + $L=array( + 'de' =>'Deutsch', + 'en' =>'English' + ); + if(isSet($_REQUEST['lang']) && array_key_exists($_REQUEST['lang'], $L)){ + $C['lang']=$_REQUEST['lang']; + setcookie('language', $C['lang']); + }elseif(isSet($_COOKIE['language']) && array_key_exists($_COOKIE['language'], $L)){ + $C['lang']=$_COOKIE['language']; + } + include('lang_en.php'); //always include English + if($C['lang']!=='en') include("lang_$C[lang].php"); //replace with translation if available +} + +function load_config(){ + global $C; + $C=array( + 'version' =>'1.0', // Script version + 'dbversion' =>1, // Database version + 'showcredits' =>true, // Allow showing credits + 'colbg' =>'000000', // Background colour + 'coltxt' =>'FFFFFF', // Default text colour + 'collnk' =>'0000FF', // Link colour + 'colvis' =>'B33CB4', // Visited link colour + 'colact' =>'FF0033', // Clicked link colour + 'sessionexpire' =>60, // Minutes until a member session expires + 'guestsexpire' =>15, // Minutes until a guest session expires + 'kickpenalty' =>10, // Minutes a nickname is blocked when it got kicked + 'entrywait' =>120, // Seconds to wait in the waiting room after login + 'cookiename' =>'chat_session', // Cookie name storing the session information + 'chatname' =>'My Chat', // Chat Name + 'messageexpire' =>14400, // Minutes until a message expires + 'messagelimit' =>150, // Max messages displayed + 'keeplimit' =>3, // Numer of messages to keep in the database multiplied with max messages displayed - increase if you have many private messages + 'defaultrefresh'=>30, // Seconds to refresh the messages + 'maxmessage' =>2000, // Longest number of characters for a message + 'maxname' =>20, // Longest number of chatacters for a name + 'boxwidth' =>40, // Default post box width + 'boxheight' =>3, // Default post box height + 'notesboxwidth' =>80, // Default notes box width + 'notesboxheight'=>30, // Default notes box height + 'dbhost' =>'p:localhost', // Database host + 'dbuser' =>'www-data', // Database user + 'dbpass' =>'YOUR_DB_PASS', // Database password + 'dbname' =>'public_chat', // Database + 'captchapass' =>'YOUR_PASS', // Password used for captcha encryption + 'enablecaptcha' =>true, // Enable captcha? ture/false + 'dismemcaptcha' =>true, // Disable captcha for members? ture/false + 'embed' =>true, // Default for displaying embedded imgs/vids or turn them into links true/false + 'imgembed' =>true, // Allow image embedding in chat using [img] tag? ture/false Warning: this might leak session data to the image hoster when cookies are disabled. + 'vidembed' =>true, // Allow video embedding in chat using [vid] tag? ture/false Warning: this might leak session data to the video hoster when cookies are disabled. + 'suguests' =>false, // Adds option to add applicants. They will have a reserved nick protected with a password, but don't count as member true/false + 'timestamps' =>true, // Display timestamps in front of the messages by default true/false + 'forceredirect' =>false, // Force redirect script or only use when no cookies available? ture/false + 'msglogout' =>false, // Add a message on member logout + 'msglogin' =>true, // Add a message on member login + 'msgkick' =>true, // Add a message when kicking someone + 'sendmail' =>false, // Send mail on new message - only activate on low traffic chat or your inbox will fill up very fast! + 'mailsender' =>'www-data ', // Send mail using this e-Mail address + 'mailreceiver' =>'Webmaster ', // Send mail to this e-Mail address + 'redirect' =>"$_SERVER[SCRIPT_NAME]?action=redirect&url=", // Redirect script default: "$_SERVER[SCRIPT_NAME]?action=redirect&url=" + 'lang' =>'en', // Default language + 'rulestxt' =>'1. YOUR_RULS
2. YOUR_RULES' // Rules - divide multiple rules by
to make them appear in a new line + ); +} +?> diff --git a/lang_de.php b/lang_de.php new file mode 100644 index 0000000..ab57573 --- /dev/null +++ b/lang_de.php @@ -0,0 +1,232 @@ + +* +* 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 . +*/ + +$I=array( + 'nodb' => 'Keine Verbindung zur Datenbank!', + 'nodsetupb' => 'Keine Verbindung zur Datenbank, bitte erstelle eine Datenbank und bearbeite das Skript, um die korrekte Datenbank mit angegebenem Benutzernamen und Passwort zu benutzen.', + 'changelang' => 'Sprache ändern:', + 'expire' => 'Ungültige/abgelaufene Sitzung', + 'kicked' => 'Rausgeschmissen!', + 'invalnick' => 'Ungültiger Nickname (Maximal %d Zeichen, keine Sonderzeichen erlaubt)', + 'invalpass' => 'Falsches Passwort!', + 'noconfirm' => 'Passwordbestätigung stimmt nicht überein!', + 'incorregex' => 'Ungültiger regulärer Ausdruck!', + 'bottom' => 'Unten', + 'top' => 'Oben', + 'choose' => '(auswählen)', + 'setup' => 'Chat Einrichtung', + 'init' => 'Erste Einrichtung', + 'sulogin' => 'Superadmin Anmeldung', + 'sunick' => 'Superadmin Nickname:', + 'supass' => 'Superadmin Passwort:', + 'suconfirm' => 'Passowrt bestätigen:', + 'susuccess' => 'Erfolgreich registriert!', + 'initbtn' => 'Chat initalisieren', + 'initdbexist' => 'Datenbanktabellen existieren bereits! Um vortzufahren, musst du diese Tabellen zuerst manuell löschen.', + 'initsuexist' => 'Ein Superadmin existiert bereits!', + 'initgosetup' => 'Zur Einrichtungsseite gehen', + 'dbupdate' => 'Datenbank aktualisieren', + 'update' => 'Aktualisieren', + 'sysmessages' => 'Systemnachrichten', + 'msgenter' => 'Eintritt', + 'msgexit' => 'Verlassen', + 'msgmemreg' => 'Mitglied registriert', + 'msgsureg' => 'Anwerber registriert', + 'msgkick' => 'Rauswurf', + 'msgmultikick' => 'Mehrere rausgeworfen', + 'msgallkick' => 'Alle rausgeworfen', + 'msgclean' => 'Raum geleert', + 'nick' => 'Nickname:', + 'pass' => 'Passwort:', + 'login' => 'Anmelden', + 'admfunc' => 'Administrative Funktionen', + 'allguests' => 'Alle Gäste', + 'cleanmsgs' => 'Nachrichten löschen', + 'room' => 'Gesamten Raum', + 'selection' => 'Auswahl', + 'clean' => 'Löschen', + 'kickchat' => 'Teilnehmer rausschmeißen (%d Minuten)', + 'kickmsg' => 'Begründung:', + 'kickpurge' => 'Nachrichten löschen', + 'kick' => 'Rausschmeißen', + 'logoutinact' => 'Inaktive Teilnehmer abmelden', + 'logout' => 'Abmelden', + 'viewsess' => 'Aktive Sitzungen anzeigen', + 'view' => 'Anzeigen', + 'filter' => 'Filter', + 'guestacc' => 'Gastzugriff ändern', + 'guestallow' => 'Erlauben', + 'guestwait' => 'Mit Warteraum erlauben', + 'adminallow' => 'Moderator-Erlaubnis benötigen', + 'guestdisallow' => 'Verweigern', + 'addsuguest' => 'Anwerber hinzufügen', + 'register' => 'Registrieren', + 'admmembers' => 'Mitglieder', + 'memdel' => 'Aus der Datenbank löschen', + 'memdeny' => 'Zugriff verweigern (!)', + 'memsuguest' => 'Zu Anwerber machen (G)', + 'memreg' => 'Zu regulärem Mitglied machen', + 'memmod' => 'Zu Moderator machen (M)', + 'memsumod' => 'Zu Supermod machen (M)', + 'memadm' => 'Zu Admin machen (A)', + 'change' => 'Ändern', + 'regguest' => 'Gast registrieren', + 'regmem' => 'Mitglied registrieren', + 'sessact' => 'Aktive Sitzungen', + 'sessnick' => 'Nickname', + 'sesstimeout' => 'Ablauf in', + 'sessua' => 'User-Agent', + 'fid' => 'Filter ID:', + 'match' => 'Entsprechung', + 'replace' => 'Ersetzen', + 'allowpm' => 'In PM zulassen', + 'regex' => 'Regex', + 'apply' => 'Anwenden', + 'newfilter' => 'Neuer Filter:', + 'add' => 'Hinzufügen', + 'noframes' => 'Dieser Chat benutzt Frames. Bitte aktiviere Frames in deinem Browser oder benutze einen dafür geeigneten!', + 'delselmes' => 'Ausgewählte Nachrichten löschen', + 'staffnotes' => 'Moderatornotizen', + 'adminnotes' => 'Adminnotizen', + 'notessaved' => 'Notizen gespeichert!', + 'lastedited' => 'Zuletzt bearbeitet von %1$s um %2$s', + 'savenotes' => 'Notizen speichern', + 'waitingroom' => 'Warteraum', + 'waittext' => 'Wilkommen %1$s, deine Anmeldung wurde verzögert, du kannst den Chat in %2$d Sekunden benutzen.', + 'admwaittext' => 'Wilkommen %1$s, deine Anmeldung wurde verzögert, du kannst den Chat benutzen, sobald ein Moderator dich hereinlässt.', + 'waitreload' => 'Wenn diese Seite sich nicht alle %d Sekunden aktualisiert, benutze den Knopf unten, um die Seite manuell neu zu laden!', + 'reload' => 'Aktualisieren', + 'rules' => 'Regeln', + 'talkto' => 'Senden an', + 'toall' => 'Alle Teilnehmer', + 'tomem' => 'Nur Mitglieder', + 'tostaff' => 'Nur Moderatoren', + 'toadmin' => 'Nur Admins', + 'alsopurge' => 'Auch Nachrichten löschen', + 'dellast' => 'Letzte Nachricht löschen', + 'delall' => 'Alle Nachrichten löschen', + 'switchsingle' => 'Zu Einzel-Zeile wechseln', + 'switchmulti' => 'Zu Mehrfach-Zeilen wechseln', + 'help' => 'Hilfe', + 'helpguest' => 'Alle Funktionen sollten recht selbsterklärend sein, benutze einfach die Knöpfe. In deinem Profil kannst du die Aktualisierungsrate, Schriftfarbe und deine gewünschte Postboxgröße anpassen.
Hinweis: Dies ist ein Chat, wenn du also nichts schreibst, wirst du automatisch nach einiger Zeit abgemaldet.', + 'helpembed' => 'Wenn du ein Bild einbetten möchtest, füge einfach ein [img] vor die Adresse deines Bildes. Beispiel: [img]http://example.com/images/file.jpg bettet das Bild in deinen Beitrag ein. Für Videos gilt das gleiche, nur mit [vid] davor.', + 'helpmem' => 'Mitglieder: Du wirst einige zusätzliche Optionen in deinem Profil haben. Du kannst deine Schriftart ändern und du kannst dein Passwort jederzeit ändern.', + 'helpmod' => 'Moderatoren: Achte auf den Admin-Knof unten. Er bringt eine Seite auf, auf der du Nachrichten löschen kannst, Teilnehmer rausschmeißen kannst, alle aktive Sitzungen anzeigen lassen kannst und den Gastzugriff deaktivieren kannst, falls dies nötig sein sollte.', + 'helpadm' => 'Admins: Du wirst zusätzlich in der Lage sein Gäste zu registrieren, Mitglieder zu verwalten und neue Nicknanem zu registrieren, ohne dass sie im Raum sind.', + 'profile' => 'Dein Profil', + 'refreshrate' => 'Aktualisierungsrate (20-150 Sekunden)', + 'fontcolour' => 'Schriftfarbe', + 'viewexample' => 'Beispiele anzeigen', + 'bgcolour' => 'Hintergrundfarbe', + 'fontface' => 'Schriftart', + 'roomdefault' => 'Raumstandard', + 'bold' => 'Fett', + 'italic' => 'Kursiv', + 'fontexample' => 'Beispiel für deine gewählte Schrift', + 'timestamps' => 'Zeitstempel anzeigen', + 'embed' => 'Bilder/Videos einbetten', + 'pbsize' => 'Postboxgröße', + 'nbsize' => 'Notizboxgröße', + 'width' => 'Breite:', + 'height' => 'Höhe:', + 'changepass' => 'Passwort ändern', + 'oldpass' => 'Altes Passwort:', + 'newpass' => 'Neues Passwort:', + 'confirmpass' => 'Passwort bestätigen:', + 'savechanges' => 'Änderungen speichern', + 'reloadpb' => 'Postbox neu laden', + 'reloadmsgs' => 'Nachrichten neu laden', + 'chgprofile' => 'Profil ändern', + 'adminbtn' => 'Admin', + 'admnotes' => 'Adminnotizen', + 'notes' => 'Notizen', + 'clone' => 'Klonen', + 'randh' => 'Regeln & Hilfe', + 'exit' => 'Chat verlassen', + 'bye' => 'Auf Wiedersehen %s, besuche uns bald wieder!', + 'colourtable' => 'Farbtabelle', + 'backtoprofile' => 'Zurück zu deinem Profil', + 'copy' => 'Kopiere:', + 'choosecol' => 'Gast, such dir eine Farbe aus:', + 'randomcol' => 'Zufällige Farbe', + 'enter' => 'Chat beitreten', + 'error' => 'Fehler:', + 'members' => 'Mitglieder:', + 'guests' => 'Gäste:', + 'approveguests' => '%d neue Gäste zum Hereinlassen', + 'allowchecked' => 'Ausgewählte erlauben', + 'allowall' => 'Alle erlauben', + 'denychecked' => 'Ausgewählte abweisen', + 'denyall' => 'Alle abweisen', + 'denymessage' => 'Nachricht an abgewiesene senden:', + 'butallowdeny' => 'Senden', + 'waitempty' => 'Keine weiteren Beitrittsanfragen zu akzeptieren.', + 'wrongcaptcha' => 'Falsches Captcha', + 'captchatime' => 'Captcha wurde bereits verwendet oder ist abgelaufen.', + 'noguests' => 'Keine Gäste zugelassen!', + 'curchat' => 'Zurzeit sind %d Teilnehmer im Raum:', + 'cantreg' => '%s kann nicht registriert werden', + 'alreadyreged' => '%s ist bereits registriert.', + 'successreg' => '%s wurde erfolgreich registriert.', + 'cantchgstat' => 'Der Status von %s kann nicht geändert werden.', + 'succdel' => '%s wurde erfolgriech aus der Datenbank gelöscht.', + 'succchg' => 'Status of %s successfully changed.', + 'wrongpass' => 'Passwort ist falsch.', + 'succprofile' => 'Dein Profil wurde erfolgreich gespeichert.', + 'backtologin' => 'Zurück zur Anmeldeseite.', + 'backtochat' => 'Zurück zum Chat.', + 'Beige' => 'Beige', + 'Black' => 'Schwarz', + 'Blue' => 'Blau', + 'BlueViolet' => 'Blauviolett', + 'Brown' => 'Braun', + 'Cyan' => 'Türkis', + 'DarkBlue' => 'Dunkelblau', + 'DarkGreen' => 'Dunkelgrün', + 'DarkRed' => 'Dunkelrot', + 'DarkViolet' => 'Dunkelviolett', + 'DeepSkyBlue' => 'Himmelsblau', + 'Gold' => 'Gold', + 'Grey' => 'Grau', + 'Green' => 'Grün', + 'HotPink' => 'Pink', + 'Indigo' => 'Indigoblau', + 'LightBlue' => 'Hellblau', + 'LightGreen' => 'Hellgrün', + 'LimeGreen' => 'Lindgrün', + 'Magenta' => 'Magenta', + 'Olive' => 'Oliv', + 'Orange' => 'Orange', + 'OrangeRed' => 'Orangerot', + 'Purple' => 'Lila', + 'Red' => 'Rot', + 'RoyalBlue' => 'Königsblau', + 'SeaGreen' => 'Seegrün', + 'Sienna' => 'Siena', + 'Silver' => 'Silber', + 'Tan' => 'Hellbraun', + 'Teal' => 'Blaugrün', + 'Violet' => 'Violett', + 'White' => 'Weiß', + 'Yellow' => 'Gelb', + 'YellowGreen' => 'Gelbgrün', + 'contributors' => 'Mitwirkende' +); +?> diff --git a/lang_en.php b/lang_en.php new file mode 100644 index 0000000..2600d4b --- /dev/null +++ b/lang_en.php @@ -0,0 +1,233 @@ + +* +* 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 . +*/ + +//Language: English +$I=array( + 'nodb' => 'No Connection to Database!', + 'nodsetupb' => 'No Connection to Database, please create a database and edit the script to use the correct database with given username and password!', + 'changelang' => 'Change language:', + 'expire' => 'Invalid/expired session', + 'kicked' => 'Kicked!', + 'invalnick' => 'Invalid nickname (%d characters maximum, no special characters allowed)', + 'invalpass' => 'Invalid password!', + 'noconfirm' => 'Password confirmation does not match!', + 'incorregex' => 'Incorrect regular expression!', + 'bottom' => 'Bottom', + 'top' => 'Top', + 'choose' => '(choose)', + 'setup' => 'Chat Setup', + 'init' => 'Initial Setup', + 'sulogin' => 'Superadmin Login', + 'sunick' => 'Superadmin Nickname:', + 'supass' => 'Superadmin Password:', + 'suconfirm' => 'Confirm Passowrd:', + 'susuccess' => 'Successfully registered!', + 'initbtn' => 'Initalise Chat', + 'initdbexist' => 'Database tables already exist! To continue, you have to delete these tables manually first.', + 'initsuexist' => 'A Superadmin already exists!', + 'initgosetup' => 'Go to the Setup-Page', + 'nick' => 'Nickname:', + 'pass' => 'Password:', + 'login' => 'Login', + 'dbupdate' => 'Update database', + 'update' => 'Update', + 'sysmessages' => 'System messages', + 'msgenter' => 'Entrance', + 'msgexit' => 'Leaving', + 'msgmemreg' => 'Member registered', + 'msgsureg' => 'Applicant registered', + 'msgkick' => 'Kicked', + 'msgmultikick' => 'Multiple kicked', + 'msgallkick' => 'All kicked', + 'msgclean' => 'Room cleaned', + 'admfunc' => 'Administrative functions', + 'allguests' => 'All guests', + 'cleanmsgs' => 'Clean messages', + 'room' => 'Whole room', + 'selection' => 'Selection', + 'clean' => 'Clean', + 'kickchat' => 'Kick Chatter (%d minutes)', + 'kickmsg' => 'Kickmessage:', + 'kickpurge' => 'Purge messages', + 'kick' => 'Kick', + 'logoutinact' => 'Logout inactive Chatter', + 'logout' => 'Logout', + 'viewsess' => 'View active sessions', + 'view' => 'View', + 'filter' => 'Filter', + 'guestacc' => 'Change Guestaccess', + 'guestallow' => 'Allow', + 'guestwait' => 'Allow with waitingroom', + 'adminallow' => 'Require moderator approval', + 'guestdisallow' => 'Disallow', + 'addsuguest' => 'Add applicant', + 'register' => 'Register', + 'admmembers' => 'Members', + 'memdel' => 'Delete from database', + 'memdeny' => 'Deny access (!)', + 'memsuguest' => 'Set to applicant (G)', + 'memreg' => 'Set to regular member', + 'memmod' => 'Set to moderator (M)', + 'memsumod' => 'Set to supermod (M)', + 'memadm' => 'Set to admin (A)', + 'change' => 'Change', + 'regguest' => 'Register Guest', + 'regmem' => 'Register new Member', + 'sessact' => 'Active Sessions', + 'sessnick' => 'Nickname', + 'sesstimeout' => 'Timeout in', + 'sessua' => 'User-Agent', + 'fid' => 'Filter ID:', + 'match' => 'Match', + 'replace' => 'Replace', + 'allowpm' => 'Allow in PM', + 'regex' => 'Regex', + 'apply' => 'Apply', + 'newfilter' => 'New filter:', + 'add' => 'Add', + 'noframes' => 'This chat uses frames. Please enable frames in your browser or use a suitable one!', + 'delselmes' => 'Delete selected messages', + 'staffnotes' => 'Staff notes', + 'adminnotes' => 'Admin notes', + 'notessaved' => 'Notes saved!', + 'lastedited' => 'Last edited by %1$s at %2$s', + 'savenotes' => 'Save Notes', + 'waitingroom' => 'Waiting room', + 'waittext' => 'Welcome %1$s, your login has been delayed, you can access the chat in %2$d seconds.', + 'admwaittext' => 'Welcome %1$s, your login has been delayed, you can access the chat as soon, as a moderator lets you in.', + 'waitreload' => 'If this page doesn\'t refresh every %d seconds, use the button below to reload it manually!', + 'reload' => 'Reload', + 'rules' => 'Rules', + 'talkto' => 'Talk to', + 'toall' => 'All chatters', + 'tomem' => 'Members only', + 'tostaff' => 'Staff only', + 'toadmin' => 'Admin only', + 'alsopurge' => 'Also purge messages', + 'dellast' => 'Delete last message', + 'delall' => 'Delete all messages', + 'switchsingle' => 'Switch to single-line', + 'switchmulti' => 'Switch to multi-line', + 'help' => 'Help', + 'helpguest' => 'All functions should be pretty much self-explaining, just use the buttons. In your profile you can adjust the refresh rate, font colour and your preferred input box size.
Note: This is a chat, so if you don\'t keep talking, you will be automatically logged out after a while.', + 'helpembed' => 'If you want to embed an image in your post, simply put [img] in front of your image URL. Example: [img]http://example.com/images/file.jpg will embed the image in your post. For videos applies the same only with [vid].', + 'helpmem' => 'Members: You\'ll have some more options in your profile. You can adjust your font face and you can change your password anytime.', + 'helpmod' => 'Moderators: Notice the Admin-button at the bottom. It\'ll bring up a page where you can clean the room, kick chatters, view all active sessions and disable guest access completely if needed.', + 'helpadm' => 'Admins: You\'ll be furthermore able to register guests, edit members and register new nicks without them beeing in the room.', + 'profile' => 'Your Profile', + 'refreshrate' => 'Refresh rate (20-150 seconds)', + 'fontcolour' => 'Font colour', + 'viewexample' => 'View examples', + 'bgcolour' => 'Background colour', + 'fontface' => 'Fontface', + 'roomdefault' => 'Room Default', + 'bold' => 'Bold', + 'italic' => 'Italic', + 'fontexample' => 'Example for your chosen font', + 'timestamps' => 'Show Timestamps', + 'embed' => 'Embed images/videos', + 'pbsize' => 'Post box size', + 'nbsize' => 'Notes box size', + 'width' => 'Width:', + 'height' => 'Height:', + 'changepass' => 'Change Password', + 'oldpass' => 'Old password:', + 'newpass' => 'New password:', + 'confirmpass' => 'Confirm new password:', + 'savechanges' => 'Save changes', + 'reloadpb' => 'Reload Post Box', + 'reloadmsgs' => 'Reload Messages', + 'chgprofile' => 'Change Profile', + 'adminbtn' => 'Admin', + 'admnotes' => 'Admin Notes', + 'notes' => 'Notes', + 'clone' => 'Clone', + 'randh' => 'Rules & Help', + 'exit' => 'Exit Chat', + 'bye' => 'Bye %s, visit again soon!', + 'colourtable' => 'Colourtable', + 'backtoprofile' => 'Back to your Profile', + 'copy' => 'Copy:', + 'choosecol' => 'Guests, choose a colour:', + 'randomcol' => 'Random Colour', + 'enter' => 'Enter Chat', + 'error' => 'Error:', + 'members' => 'Members:', + 'guests' => 'Guests:', + 'approveguests' => '%d new guests to approve', + 'allowchecked' => 'Allow checked', + 'allowall' => 'Allow all', + 'denychecked' => 'Deny checked', + 'denyall' => 'Deny all', + 'denymessage' => 'Send message to denied:', + 'butallowdeny' => 'Submit', + 'waitempty' => 'No more entry requests to approve.', + 'wrongcaptcha' => 'Wrong Captcha', + 'captchatime' => 'Captcha already used or timed out.', + 'noguests' => 'No guests allowed!', + 'curchat' => 'Currently %d chatter(s) in room:', + 'cantreg' => 'Can\'t register %s', + 'alreadyreged' => '%s is already registered.', + 'successreg' => '%s successfully registered.', + 'cantchgstat' => 'Can\'t change status of %s', + 'succdel' => '%s successfully deleted from database.', + 'succchg' => 'Status of %s successfully changed.', + 'wrongpass' => 'Password is wrong.', + 'succprofile' => 'Your profile has successfully been saved.', + 'backtologin' => 'Back to the login page.', + 'backtochat' => 'Back to the chat.', + 'Beige' => 'Beige', + 'Black' => 'Black', + 'Blue' => 'Blue', + 'BlueViolet' => 'Blue violet', + 'Brown' => 'Brown', + 'Cyan' => 'Cyan', + 'DarkBlue' => 'Dark blue', + 'DarkGreen' => 'Dark green', + 'DarkRed' => 'Dark red', + 'DarkViolet' => 'Dark violet', + 'DeepSkyBlue' => 'Sky blue', + 'Gold' => 'Gold', + 'Grey' => 'Grey', + 'Green' => 'Green', + 'HotPink' => 'Hot pink', + 'Indigo' => 'Indigo', + 'LightBlue' => 'Light blue', + 'LightGreen' => 'Light green', + 'LimeGreen' => 'Lime green', + 'Magenta' => 'Magenta', + 'Olive' => 'Olive', + 'Orange' => 'Orange', + 'OrangeRed' => 'Orange red', + 'Purple' => 'Purple', + 'Red' => 'Red', + 'RoyalBlue' => 'Royal blue', + 'SeaGreen' => 'Sea green', + 'Sienna' => 'Sienna', + 'Silver' => 'Silver', + 'Tan' => 'Tan', + 'Teal' => 'Teal', + 'Violet' => 'Violet', + 'White' => 'White', + 'Yellow' => 'Yellow', + 'YellowGreen' => 'Yellow green', + 'contributors' => 'Contributors', +); +?>