diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..86b6ded --- /dev/null +++ b/.editorconfig @@ -0,0 +1,12 @@ +# This file is for unifying the coding style for different editors and IDEs +# editorconfig.org + +root = true + +[*] +charset = utf-8 +end_of_line = lf +insert_final_newline = true +trim_trailing_whitespace = true +indent_style = space +indent_size = 4 diff --git a/.gitignore b/.gitignore index fc917f9..8b65ddf 100644 --- a/.gitignore +++ b/.gitignore @@ -34,9 +34,6 @@ src/private/INSTALLER_LOCK .AppleDouble .LSOverride -# Icon must end with two \r -Icon - # Thumbnails ._* diff --git a/.jshintrc b/.jshintrc new file mode 100644 index 0000000..7558507 --- /dev/null +++ b/.jshintrc @@ -0,0 +1,6 @@ +{ + "strict": true, + "browser": true, + "jquery": true, + "asi": true +} diff --git a/LICENSE.txt b/LICENSE.txt new file mode 100644 index 0000000..f288702 --- /dev/null +++ b/LICENSE.txt @@ -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/src/404.php b/src/404.php new file mode 100644 index 0000000..3e6292a --- /dev/null +++ b/src/404.php @@ -0,0 +1,7 @@ +renderErrorTemplate("404", "Page not found"); diff --git a/src/admin/index.html b/src/admin/index.html new file mode 100644 index 0000000..7a89042 --- /dev/null +++ b/src/admin/index.html @@ -0,0 +1,4 @@ +

Oops!

+This is a dev release of ts-website. There is no admin panel yet.
+Modify the database directly to change the configuration.
+Go back diff --git a/src/api/getclientinfo.php b/src/api/getclientinfo.php new file mode 100644 index 0000000..c60ff33 --- /dev/null +++ b/src/api/getclientinfo.php @@ -0,0 +1,87 @@ + false, "message" => "No CLDBID provided"]; +} else { + $cldbid = (int) $_GET["cldbid"]; + $clientList = CacheManager::i()->getClientList(); + $clientData = null; + + foreach ($clientList as $client) { + if ($client["client_database_id"] === $cldbid) { + $clientData = $client; + break; + } + } + + if ($clientData !== null) { + $returnJson = [ + "success" => true, + "timenow" => time(), + "data" => buildInfoArray($clientData) + ]; + } else { + $returnJson = ["success" => false, "message" => "Client not found"]; + } +} + +header("Content-Type: application/json"); +echo json_encode($returnJson); + +// Helper function + +function buildInfoArray($clientData) { + $ret = []; + + $fields = [ + "clid", + "cid", + "client_database_id", + "client_nickname", + "client_type", + "client_away", + "client_away_message", + "client_flag_talking", + "client_input_muted", + "client_output_muted", + "client_input_hardware", + "client_output_hardware", + "client_talk_power", + "client_is_talker", + "client_is_priority_speaker", + "client_is_recording", + "client_is_channel_commander", + "client_unique_identifier", + "client_servergroups", + "client_channel_group_id", + "client_channel_group_inherited_channel_id", + "client_version", + "client_platform", + "client_idle_time", + "client_created", + "client_lastconnected", + "client_icon_id", + "client_country", + "client_badges" + ]; + + // Get wanted fields from the clientData, convert TS String Objects + // into normal strings and put everything into returnData + foreach ($fields as $field) { + $val = $clientData[$field]; + + if ($val instanceof TeamSpeak3_Helper_String) { + $val = (string) $val; + } + + $ret[$field] = $val; + } + + $ret["client_version_short"] = (string) TeamSpeak3_Helper_Convert::versionShort($ret["client_version"]); + $ret["client_servergroups_list"] = array_map("intval", explode(",", $ret["client_servergroups"])); + return $ret; +} diff --git a/src/api/geticon.php b/src/api/geticon.php new file mode 100644 index 0000000..531c5c4 --- /dev/null +++ b/src/api/geticon.php @@ -0,0 +1,40 @@ +getServerInfo(true); // Server info + cache meta +$sinfo = $sinfoMeta["data"]; // Server info array + +$returnJson = ["success" => false, "generated" => $sinfoMeta["time"]]; + +if ($sinfo !== null) { + // START Online Record + $onlineNow = $sinfo["virtualserver_clientsonline"] - $sinfo["virtualserver_queryclientsonline"]; + $onlineRecord = (int) Config::get("onlinerecord_value"); + $onlineRecordDate = (int) Config::get("onlinerecord_date"); + + if ($onlineNow > $onlineRecord) { + $onlineRecord = $onlineNow; + $onlineRecordDate = time(); + + Config::i()->setValue("onlinerecord_value", $onlineRecord); + Config::i()->setValue("onlinerecord_date", $onlineRecordDate); + } + // END Online Record + + $returnJson["success"] = true; + $returnJson["data"] = [ + "uid" => (string) $sinfo["virtualserver_unique_identifier"], + "name" => (string) $sinfo["virtualserver_name"], + "nicknames" => (string) $sinfo["virtualserver_nickname"], + "channelCount" => $sinfo["virtualserver_channelsonline"], + "serverIconId" => $sinfo["virtualserver_icon_id"], + "clientsOnline" => $onlineNow, + "maxClients" => $sinfo["virtualserver_maxclients"], + "reservedSlots" => $sinfo["virtualserver_reserved_slots"], + "onlineRecord" => $onlineRecord, + "onlineRecordDate" => $onlineRecordDate, + "version" => (string) TeamSpeak3_Helper_Convert::versionShort($sinfo["virtualserver_version"]), + "platform" => (string) $sinfo["virtualserver_platform"], + "uptime" => $sinfo["virtualserver_uptime"], + "uptimeFormatted" => describeSeconds($sinfo["virtualserver_uptime"]), + "averagePacketloss" => (float) ((string) $sinfo["virtualserver_total_packetloss_total"]), + "averagePing" => (float) ((string) $sinfo["virtualserver_total_ping"]) + ]; +} + +header("Content-Type: application/json"); +echo json_encode($returnJson); + +function describeSeconds($seconds) { + return TeamSpeak3_Helper_Convert::seconds($seconds, false, "%dd %02dh %02dm"); +} diff --git a/src/api/getviewerhtml.php b/src/api/getviewerhtml.php new file mode 100644 index 0000000..befb0c2 --- /dev/null +++ b/src/api/getviewerhtml.php @@ -0,0 +1,14 @@ +checkRequiredData()) { + $html = $viewerRenderer->renderViewer(); +} + +echo $html; diff --git a/src/api/login.php b/src/api/login.php new file mode 100644 index 0000000..ab055b8 --- /dev/null +++ b/src/api/login.php @@ -0,0 +1,59 @@ + $users]); + } +} else if ($method === "selectaccount") { + $cldbid = (int) ApiUtils::getPostParam("cldbid"); + + if (!Auth::checkClientIp($cldbid)) { + ApiUtils::jsonError("User not found", "USER_NOT_FOUND"); + exit; + } + + if (Auth::getConfirmationCode($cldbid) !== null) { + ApiUtils::jsonError("Code is already generated for this user", "CODE_ALREADY_GENERATED"); + exit; + } + + $code = Auth::generateConfirmationCode($cldbid); + + if ($code === null) { + ApiUtils::jsonError("User not found", "USER_NOT_FOUND"); + } else if ($code === false) { + ApiUtils::jsonError("Error sending code. Try again.", "ERROR_SENDING_CODE"); + } else { + ApiUtils::jsonSuccess(); + } +} else if ($method === "login") { + if (Auth::isLoggedIn()) { + ApiUtils::jsonError("You are already logged in", "ALREADY_AUTHENTICATED"); + exit; + } + + $code = ApiUtils::getPostParam("code"); + $cldbid = (int) ApiUtils::getPostParam("cldbid"); + + if (Auth::checkCodeAndLogin($cldbid, $code)) { + ApiUtils::jsonSuccess(); + } else { + ApiUtils::jsonError("Invalid or expired code", "INVALID_CODE"); + } +} else { + ApiUtils::jsonError("Invalid method name", "INVALID_METHOD"); +} diff --git a/src/api/setlang.php b/src/api/setlang.php new file mode 100644 index 0000000..12b693c --- /dev/null +++ b/src/api/setlang.php @@ -0,0 +1,33 @@ +getLanguageByCode($_POST["lang"]); + +if ($lang === null) { + http_response_code(400); + echo 'Invalid language code'; + exit; +} + +setcookie("tswebsite_language", $lang->getLanguageCode(), time() + (60 * 60 * 24) * 60, "/"); // 60 days +$_SESSION["userlanguageid"] = $lang->getLanguageId(); + +$returnTo = "../"; + +if (!empty($_POST["return-to"])) { + // Check if the address start with a "/" and is not for example with "http://evilwebsite.com" + if (mb_strpos($_POST["return-to"], "/") === 0) { + $returnTo = $_POST["return-to"]; + } +} + +header("Location: $returnTo"); diff --git a/src/assigner.php b/src/assigner.php new file mode 100644 index 0000000..08d1b29 --- /dev/null +++ b/src/assigner.php @@ -0,0 +1,35 @@ + Auth::isLoggedIn()]; + +if (Auth::isLoggedIn()) { + if (isset($_POST["assigner"])) { + $groups = array_keys($_POST["assigner"]); // get all group ids + $groups = array_filter($groups, "is_int"); // only keep integers + + $changeGroups = Assigner::changeGroups($groups); + $data["groupChangeStatus"] = $changeGroups; + + if ($changeGroups === 0) { + // if groups have been successfully updated, + // invalidate the cache + Auth::invalidateUserGroupCache(); + } + } + + try { + $assignerConfig = Assigner::getAssignerArray(); + $assignerConfig = array_chunk($assignerConfig, 2); + } catch (\Exception $e) {} + + // suppress warnings - might be null on exception + $data["assignerConfig"] = @$assignerConfig; +} + +TemplateUtils::i()->renderTemplate("assigner", $data); diff --git a/src/bans.php b/src/bans.php new file mode 100644 index 0000000..98195b0 --- /dev/null +++ b/src/bans.php @@ -0,0 +1,58 @@ +getBanList(); +$data = null; +$ipbanned = false; + +if ($banlist !== null) { + $data = []; + + foreach ($banlist as $ban) { + + $name = "(cannot determine a name)"; + + if ($ban["lastnickname"]) { + $name = (string)$ban["lastnickname"]; + } else if ($ban["uid"]) { + $name = new Html("" . $ban["uid"] . ""); + } else if ($ban["name"]) { + $name = (string)$ban["name"]; + } else if ($ban["ip"]) { + $ip = str_replace("\\", "", (string) $ban["ip"]); + + try { + $name = Utils::censorIpAddress($ip); + } catch (\Exception $e) {} + + if ($ip === Utils::getClientIp()) { + $ipbanned = [ + "invoker" => (string)$ban["invokername"], + "reason" => (string)$ban["reason"] + ]; + } + } + + $data[] = [ + "name" => $name, + "reason" => (string)$ban["reason"], + "invoker" => (string)$ban["invokername"], + "created" => $ban["created"], + "duration" => $ban["duration"] + ]; + } +} + +TemplateUtils::i()->renderTemplate("bans", [ + "banlist" => $data, + "ipbanned" => $ipbanned +]); diff --git a/src/composer.json b/src/composer.json new file mode 100644 index 0000000..318ad8f --- /dev/null +++ b/src/composer.json @@ -0,0 +1,24 @@ +{ + "config": { + "vendor-dir": "private/vendor" + }, + "require": { + "roave/security-advisories": "dev-master", + "php": ">=5.6.0", + "ext-mbstring": "*", + "ext-json": "*", + "ext-tokenizer": "*", + "planetteamspeak/ts3-php-framework": "1.1.32", + "latte/latte": "^2.4", + "wruczek/php-file-cache": "^0", + "simplepie/simplepie": "^1.5", + "catfan/medoo": "^1.5" + }, + "suggest": { + "ext-pdo_mysql": "*", + "ext-pdo_sqlite": "*" + }, + "autoload": { + "psr-4": {"Wruczek\\TSWebsite\\": "private/php"} + } +} diff --git a/src/css/cookiealert.css b/src/css/cookiealert.css new file mode 100644 index 0000000..7260ad6 --- /dev/null +++ b/src/css/cookiealert.css @@ -0,0 +1,29 @@ +.cookiealert { + position: fixed; + bottom: 0; + left: 0; + width: 100%; + margin: 0 !important; + z-index: 999; + opacity: 0; + border-radius: 0; + background: #212327 url("../img/cubes.png"); + transform: translateY(100%); + transition: all 500ms ease-out; + color: #ecf0f1; +} + +.cookiealert.show { + opacity: 1; + transform: translateY(0%); + transition-delay: 1000ms; +} + +.cookiealert a { + text-decoration: underline +} + +.cookiealert .acceptcookies { + margin-left: 10px; + vertical-align: baseline; +} diff --git a/src/css/dev.css b/src/css/dev.css new file mode 100644 index 0000000..cddfcec --- /dev/null +++ b/src/css/dev.css @@ -0,0 +1,10 @@ +/* FOR DEVELOPMENT */ + +.xdebug-var-dump { + background: #fff; + padding: 15px; +} + +debug-step { + display: none; +} diff --git a/src/css/flags/famfamfam-flags.min.css b/src/css/flags/famfamfam-flags.min.css new file mode 100644 index 0000000..d39f81e --- /dev/null +++ b/src/css/flags/famfamfam-flags.min.css @@ -0,0 +1 @@ +.famfamfam-flags{background:url(famfamfam-flags.png) no-repeat;display: inline-block;background-size:224px 199px}.famfamfam-flags.me{width:16px;height:12px;background-position:0 0}.famfamfam-flags.ky{width:16px;height:11px;background-position:-16px 0}.famfamfam-flags.af{width:16px;height:11px;background-position:0 -12px}.famfamfam-flags.ag{width:16px;height:11px;background-position:-16px -12px}.famfamfam-flags.ai{width:16px;height:11px;background-position:-32px 0}.famfamfam-flags.al{width:16px;height:11px;background-position:-32px -11px}.famfamfam-flags.am{width:16px;height:11px;background-position:0 -23px}.famfamfam-flags.an{width:16px;height:11px;background-position:-16px -23px}.famfamfam-flags.ao{width:16px;height:11px;background-position:-32px -23px}.famfamfam-flags.ar{width:16px;height:11px;background-position:0 -34px}.famfamfam-flags.as{width:16px;height:11px;background-position:-16px -34px}.famfamfam-flags.at{width:16px;height:11px;background-position:-32px -34px}.famfamfam-flags.au{width:16px;height:11px;background-position:-48px 0}.famfamfam-flags.aw{width:16px;height:11px;background-position:-48px -11px}.famfamfam-flags.ax{width:16px;height:11px;background-position:-48px -22px}.famfamfam-flags.az{width:16px;height:11px;background-position:-48px -33px}.famfamfam-flags.ba{width:16px;height:11px;background-position:0 -45px}.famfamfam-flags.bb{width:16px;height:11px;background-position:-16px -45px}.famfamfam-flags.bd{width:16px;height:11px;background-position:-32px -45px}.famfamfam-flags.be{width:16px;height:11px;background-position:-48px -45px}.famfamfam-flags.bf{width:16px;height:11px;background-position:-64px 0}.famfamfam-flags.bg{width:16px;height:11px;background-position:-64px -11px}.famfamfam-flags.bh{width:16px;height:11px;background-position:-64px -22px}.famfamfam-flags.bi{width:16px;height:11px;background-position:-64px -33px}.famfamfam-flags.bj{width:16px;height:11px;background-position:-64px -44px}.famfamfam-flags.bm{width:16px;height:11px;background-position:0 -56px}.famfamfam-flags.bn{width:16px;height:11px;background-position:-16px -56px}.famfamfam-flags.bo{width:16px;height:11px;background-position:-32px -56px}.famfamfam-flags.br{width:16px;height:11px;background-position:-48px -56px}.famfamfam-flags.bs{width:16px;height:11px;background-position:-64px -56px}.famfamfam-flags.bt{width:16px;height:11px;background-position:0 -67px}.famfamfam-flags.bv{width:16px;height:11px;background-position:-16px -67px}.famfamfam-flags.bw{width:16px;height:11px;background-position:-32px -67px}.famfamfam-flags.by{width:16px;height:11px;background-position:-48px -67px}.famfamfam-flags.bz{width:16px;height:11px;background-position:-64px -67px}.famfamfam-flags.ca{width:16px;height:11px;background-position:-80px 0}.famfamfam-flags.catalonia{width:16px;height:11px;background-position:-80px -11px}.famfamfam-flags.cc{width:16px;height:11px;background-position:-80px -22px}.famfamfam-flags.cd{width:16px;height:11px;background-position:-80px -33px}.famfamfam-flags.cf{width:16px;height:11px;background-position:-80px -44px}.famfamfam-flags.cg{width:16px;height:11px;background-position:-80px -55px}.famfamfam-flags.zm{width:16px;height:11px;background-position:-80px -66px}.famfamfam-flags.ci{width:16px;height:11px;background-position:0 -78px}.famfamfam-flags.ck{width:16px;height:11px;background-position:-16px -78px}.famfamfam-flags.cl{width:16px;height:11px;background-position:-32px -78px}.famfamfam-flags.cm{width:16px;height:11px;background-position:-48px -78px}.famfamfam-flags.cn{width:16px;height:11px;background-position:-64px -78px}.famfamfam-flags.co{width:16px;height:11px;background-position:-80px -78px}.famfamfam-flags.cr{width:16px;height:11px;background-position:-96px 0}.famfamfam-flags.cs{width:16px;height:11px;background-position:-96px -11px}.famfamfam-flags.cu{width:16px;height:11px;background-position:-96px -22px}.famfamfam-flags.cv{width:16px;height:11px;background-position:-96px -33px}.famfamfam-flags.cx{width:16px;height:11px;background-position:-96px -44px}.famfamfam-flags.cy{width:16px;height:11px;background-position:-96px -55px}.famfamfam-flags.cz{width:16px;height:11px;background-position:-96px -66px}.famfamfam-flags.de{width:16px;height:11px;background-position:-96px -77px}.famfamfam-flags.dj{width:16px;height:11px;background-position:0 -89px}.famfamfam-flags.dk{width:16px;height:11px;background-position:-16px -89px}.famfamfam-flags.dm{width:16px;height:11px;background-position:-32px -89px}.famfamfam-flags.do{width:16px;height:11px;background-position:-48px -89px}.famfamfam-flags.dz{width:16px;height:11px;background-position:-64px -89px}.famfamfam-flags.ec{width:16px;height:11px;background-position:-80px -89px}.famfamfam-flags.ee{width:16px;height:11px;background-position:-96px -89px}.famfamfam-flags.eg{width:16px;height:11px;background-position:0 -100px}.famfamfam-flags.eh{width:16px;height:11px;background-position:-16px -100px}.famfamfam-flags.england{width:16px;height:11px;background-position:-32px -100px}.famfamfam-flags.er{width:16px;height:11px;background-position:-48px -100px}.famfamfam-flags.es{width:16px;height:11px;background-position:-64px -100px}.famfamfam-flags.et{width:16px;height:11px;background-position:-80px -100px}.famfamfam-flags.europeanunion{width:16px;height:11px;background-position:-96px -100px}.famfamfam-flags.fam{width:16px;height:11px;background-position:-112px 0}.famfamfam-flags.fi{width:16px;height:11px;background-position:-112px -11px}.famfamfam-flags.fj{width:16px;height:11px;background-position:-112px -22px}.famfamfam-flags.fk{width:16px;height:11px;background-position:-112px -33px}.famfamfam-flags.fm{width:16px;height:11px;background-position:-112px -44px}.famfamfam-flags.fo{width:16px;height:11px;background-position:-112px -55px}.famfamfam-flags.fr,.famfamfam-flags.gp,.famfamfam-flags.mf,.famfamfam-flags.re,.famfamfam-flags.yt{width:16px;height:11px;background-position:-112px -66px}.famfamfam-flags.ga{width:16px;height:11px;background-position:-112px -77px}.famfamfam-flags.gb{width:16px;height:11px;background-position:-112px -88px}.famfamfam-flags.gd{width:16px;height:11px;background-position:-112px -99px}.famfamfam-flags.ge{width:16px;height:11px;background-position:0 -111px}.famfamfam-flags.gf{width:16px;height:11px;background-position:-16px -111px}.famfamfam-flags.gg{width:16px;height:11px;background-position:-32px -111px}.famfamfam-flags.gh{width:16px;height:11px;background-position:-48px -111px}.famfamfam-flags.gi{width:16px;height:11px;background-position:-64px -111px}.famfamfam-flags.gl{width:16px;height:11px;background-position:-80px -111px}.famfamfam-flags.gm{width:16px;height:11px;background-position:-96px -111px}.famfamfam-flags.gn{width:16px;height:11px;background-position:-112px -111px}.famfamfam-flags.gp{width:16px;height:11px;background-position:-128px 0}.famfamfam-flags.gq{width:16px;height:11px;background-position:-128px -11px}.famfamfam-flags.gr{width:16px;height:11px;background-position:-128px -22px}.famfamfam-flags.gs{width:16px;height:11px;background-position:-128px -33px}.famfamfam-flags.gt{width:16px;height:11px;background-position:-128px -44px}.famfamfam-flags.gu{width:16px;height:11px;background-position:-128px -55px}.famfamfam-flags.gw{width:16px;height:11px;background-position:-128px -66px}.famfamfam-flags.gy{width:16px;height:11px;background-position:-128px -77px}.famfamfam-flags.hk{width:16px;height:11px;background-position:-128px -88px}.famfamfam-flags.hm{width:16px;height:11px;background-position:-128px -99px}.famfamfam-flags.hn{width:16px;height:11px;background-position:-128px -110px}.famfamfam-flags.hr{width:16px;height:11px;background-position:0 -122px}.famfamfam-flags.ht{width:16px;height:11px;background-position:-16px -122px}.famfamfam-flags.hu{width:16px;height:11px;background-position:-32px -122px}.famfamfam-flags.id{width:16px;height:11px;background-position:-48px -122px}.famfamfam-flags.ie{width:16px;height:11px;background-position:-64px -122px}.famfamfam-flags.il{width:16px;height:11px;background-position:-80px -122px}.famfamfam-flags.in{width:16px;height:11px;background-position:-96px -122px}.famfamfam-flags.io{width:16px;height:11px;background-position:-112px -122px}.famfamfam-flags.iq{width:16px;height:11px;background-position:-128px -122px}.famfamfam-flags.ir{width:16px;height:11px;background-position:0 -133px}.famfamfam-flags.is{width:16px;height:11px;background-position:-16px -133px}.famfamfam-flags.it{width:16px;height:11px;background-position:-32px -133px}.famfamfam-flags.je{width:16px;height:11px;background-position:-48px -133px}.famfamfam-flags.jm{width:16px;height:11px;background-position:-64px -133px}.famfamfam-flags.jo{width:16px;height:11px;background-position:-80px -133px}.famfamfam-flags.jp{width:16px;height:11px;background-position:-96px -133px}.famfamfam-flags.ke{width:16px;height:11px;background-position:-112px -133px}.famfamfam-flags.kg{width:16px;height:11px;background-position:-128px -133px}.famfamfam-flags.kh{width:16px;height:11px;background-position:-144px 0}.famfamfam-flags.ki{width:16px;height:11px;background-position:-144px -11px}.famfamfam-flags.km{width:16px;height:11px;background-position:-144px -22px}.famfamfam-flags.kn{width:16px;height:11px;background-position:-144px -33px}.famfamfam-flags.kp{width:16px;height:11px;background-position:-144px -44px}.famfamfam-flags.kr{width:16px;height:11px;background-position:-144px -55px}.famfamfam-flags.kw{width:16px;height:11px;background-position:-144px -66px}.famfamfam-flags.ae{width:16px;height:11px;background-position:-144px -77px}.famfamfam-flags.kz{width:16px;height:11px;background-position:-144px -88px}.famfamfam-flags.la{width:16px;height:11px;background-position:-144px -99px}.famfamfam-flags.lb{width:16px;height:11px;background-position:-144px -110px}.famfamfam-flags.lc{width:16px;height:11px;background-position:-144px -121px}.famfamfam-flags.li{width:16px;height:11px;background-position:-144px -132px}.famfamfam-flags.lk{width:16px;height:11px;background-position:0 -144px}.famfamfam-flags.lr{width:16px;height:11px;background-position:-16px -144px}.famfamfam-flags.ls{width:16px;height:11px;background-position:-32px -144px}.famfamfam-flags.lt{width:16px;height:11px;background-position:-48px -144px}.famfamfam-flags.lu{width:16px;height:11px;background-position:-64px -144px}.famfamfam-flags.lv{width:16px;height:11px;background-position:-80px -144px}.famfamfam-flags.ly{width:16px;height:11px;background-position:-96px -144px}.famfamfam-flags.ma{width:16px;height:11px;background-position:-112px -144px}.famfamfam-flags.mc{width:16px;height:11px;background-position:-128px -144px}.famfamfam-flags.md{width:16px;height:11px;background-position:-144px -144px}.famfamfam-flags.ad{width:16px;height:11px;background-position:-160px 0}.famfamfam-flags.mg{width:16px;height:11px;background-position:-160px -11px}.famfamfam-flags.mh{width:16px;height:11px;background-position:-160px -22px}.famfamfam-flags.mk{width:16px;height:11px;background-position:-160px -33px}.famfamfam-flags.ml{width:16px;height:11px;background-position:-160px -44px}.famfamfam-flags.mm{width:16px;height:11px;background-position:-160px -55px}.famfamfam-flags.mn{width:16px;height:11px;background-position:-160px -66px}.famfamfam-flags.mo{width:16px;height:11px;background-position:-160px -77px}.famfamfam-flags.mp{width:16px;height:11px;background-position:-160px -88px}.famfamfam-flags.mq{width:16px;height:11px;background-position:-160px -99px}.famfamfam-flags.mr{width:16px;height:11px;background-position:-160px -110px}.famfamfam-flags.ms{width:16px;height:11px;background-position:-160px -121px}.famfamfam-flags.mt{width:16px;height:11px;background-position:-160px -132px}.famfamfam-flags.mu{width:16px;height:11px;background-position:-160px -143px}.famfamfam-flags.mv{width:16px;height:11px;background-position:0 -155px}.famfamfam-flags.mw{width:16px;height:11px;background-position:-16px -155px}.famfamfam-flags.mx{width:16px;height:11px;background-position:-32px -155px}.famfamfam-flags.my{width:16px;height:11px;background-position:-48px -155px}.famfamfam-flags.mz{width:16px;height:11px;background-position:-64px -155px}.famfamfam-flags.na{width:16px;height:11px;background-position:-80px -155px}.famfamfam-flags.nc{width:16px;height:11px;background-position:-96px -155px}.famfamfam-flags.ne{width:16px;height:11px;background-position:-112px -155px}.famfamfam-flags.nf{width:16px;height:11px;background-position:-128px -155px}.famfamfam-flags.ng{width:16px;height:11px;background-position:-144px -155px}.famfamfam-flags.ni{width:16px;height:11px;background-position:-160px -155px}.famfamfam-flags.bq,.famfamfam-flags.nl{width:16px;height:11px;background-position:-176px 0}.famfamfam-flags.no{width:16px;height:11px;background-position:-176px -11px}.famfamfam-flags.za{width:16px;height:11px;background-position:-176px -22px}.famfamfam-flags.nr{width:16px;height:11px;background-position:-176px -33px}.famfamfam-flags.nu{width:16px;height:11px;background-position:-176px -44px}.famfamfam-flags.nz{width:16px;height:11px;background-position:-176px -55px}.famfamfam-flags.om{width:16px;height:11px;background-position:-176px -66px}.famfamfam-flags.pa{width:16px;height:11px;background-position:-176px -77px}.famfamfam-flags.pe{width:16px;height:11px;background-position:-176px -88px}.famfamfam-flags.pf{width:16px;height:11px;background-position:-176px -99px}.famfamfam-flags.pg{width:16px;height:11px;background-position:-176px -110px}.famfamfam-flags.ph{width:16px;height:11px;background-position:-176px -121px}.famfamfam-flags.pk{width:16px;height:11px;background-position:-176px -132px}.famfamfam-flags.pl{width:16px;height:11px;background-position:-176px -143px}.famfamfam-flags.pm{width:16px;height:11px;background-position:-176px -154px}.famfamfam-flags.pn{width:16px;height:11px;background-position:0 -166px}.famfamfam-flags.pr{width:16px;height:11px;background-position:-16px -166px}.famfamfam-flags.ps{width:16px;height:11px;background-position:-32px -166px}.famfamfam-flags.pt{width:16px;height:11px;background-position:-48px -166px}.famfamfam-flags.pw{width:16px;height:11px;background-position:-64px -166px}.famfamfam-flags.py{width:16px;height:11px;background-position:-80px -166px}.famfamfam-flags.qa{width:16px;height:11px;background-position:-96px -166px}.famfamfam-flags.re{width:16px;height:11px;background-position:-112px -166px}.famfamfam-flags.ro{width:16px;height:11px;background-position:-128px -166px}.famfamfam-flags.rs{width:16px;height:11px;background-position:-144px -166px}.famfamfam-flags.ru{width:16px;height:11px;background-position:-160px -166px}.famfamfam-flags.rw{width:16px;height:11px;background-position:-176px -166px}.famfamfam-flags.sa{width:16px;height:11px;background-position:0 -177px}.famfamfam-flags.sb{width:16px;height:11px;background-position:-16px -177px}.famfamfam-flags.sc{width:16px;height:11px;background-position:-32px -177px}.famfamfam-flags.scotland{width:16px;height:11px;background-position:-48px -177px}.famfamfam-flags.sd{width:16px;height:11px;background-position:-64px -177px}.famfamfam-flags.se{width:16px;height:11px;background-position:-80px -177px}.famfamfam-flags.sg{width:16px;height:11px;background-position:-96px -177px}.famfamfam-flags.sh{width:16px;height:11px;background-position:-112px -177px}.famfamfam-flags.si{width:16px;height:11px;background-position:-128px -177px}.famfamfam-flags.sj{width:16px;height:11px;background-position:-144px -177px}.famfamfam-flags.sk{width:16px;height:11px;background-position:-160px -177px}.famfamfam-flags.sl{width:16px;height:11px;background-position:-176px -177px}.famfamfam-flags.sm{width:16px;height:11px;background-position:-192px 0}.famfamfam-flags.sn{width:16px;height:11px;background-position:-192px -11px}.famfamfam-flags.so{width:16px;height:11px;background-position:-192px -22px}.famfamfam-flags.sr{width:16px;height:11px;background-position:-192px -33px}.famfamfam-flags.st{width:16px;height:11px;background-position:-192px -44px}.famfamfam-flags.sv{width:16px;height:11px;background-position:-192px -55px}.famfamfam-flags.sy{width:16px;height:11px;background-position:-192px -66px}.famfamfam-flags.sz{width:16px;height:11px;background-position:-192px -77px}.famfamfam-flags.tc{width:16px;height:11px;background-position:-192px -88px}.famfamfam-flags.td{width:16px;height:11px;background-position:-192px -99px}.famfamfam-flags.tf{width:16px;height:11px;background-position:-192px -110px}.famfamfam-flags.tg{width:16px;height:11px;background-position:-192px -121px}.famfamfam-flags.th{width:16px;height:11px;background-position:-192px -132px}.famfamfam-flags.tj{width:16px;height:11px;background-position:-192px -143px}.famfamfam-flags.tk{width:16px;height:11px;background-position:-192px -154px}.famfamfam-flags.tl{width:16px;height:11px;background-position:-192px -165px}.famfamfam-flags.tm{width:16px;height:11px;background-position:-192px -176px}.famfamfam-flags.tn{width:16px;height:11px;background-position:0 -188px}.famfamfam-flags.to{width:16px;height:11px;background-position:-16px -188px}.famfamfam-flags.tr{width:16px;height:11px;background-position:-32px -188px}.famfamfam-flags.tt{width:16px;height:11px;background-position:-48px -188px}.famfamfam-flags.tv{width:16px;height:11px;background-position:-64px -188px}.famfamfam-flags.tw{width:16px;height:11px;background-position:-80px -188px}.famfamfam-flags.tz{width:16px;height:11px;background-position:-96px -188px}.famfamfam-flags.ua{width:16px;height:11px;background-position:-112px -188px}.famfamfam-flags.ug{width:16px;height:11px;background-position:-128px -188px}.famfamfam-flags.um{width:16px;height:11px;background-position:-144px -188px}.famfamfam-flags.us{width:16px;height:11px;background-position:-160px -188px}.famfamfam-flags.uy{width:16px;height:11px;background-position:-176px -188px}.famfamfam-flags.uz{width:16px;height:11px;background-position:-192px -188px}.famfamfam-flags.va{width:16px;height:11px;background-position:-208px 0}.famfamfam-flags.vc{width:16px;height:11px;background-position:-208px -11px}.famfamfam-flags.ve{width:16px;height:11px;background-position:-208px -22px}.famfamfam-flags.vg{width:16px;height:11px;background-position:-208px -33px}.famfamfam-flags.vi{width:16px;height:11px;background-position:-208px -44px}.famfamfam-flags.vn{width:16px;height:11px;background-position:-208px -55px}.famfamfam-flags.vu{width:16px;height:11px;background-position:-208px -66px}.famfamfam-flags.wales{width:16px;height:11px;background-position:-208px -77px}.famfamfam-flags.wf{width:16px;height:11px;background-position:-208px -88px}.famfamfam-flags.ws{width:16px;height:11px;background-position:-208px -99px}.famfamfam-flags.ye{width:16px;height:11px;background-position:-208px -110px}.famfamfam-flags.yt{width:16px;height:11px;background-position:-208px -121px}.famfamfam-flags.zw{width:16px;height:11px;background-position:-208px -132px}.famfamfam-flags.ch{width:11px;height:11px;background-position:-208px -143px}.famfamfam-flags.np{width:9px;height:11px;background-position:-208px -154px} diff --git a/src/css/flags/famfamfam-flags.png b/src/css/flags/famfamfam-flags.png new file mode 100644 index 0000000..c820e3b Binary files /dev/null and b/src/css/flags/famfamfam-flags.png differ diff --git a/src/css/loader.css b/src/css/loader.css new file mode 100644 index 0000000..2477c18 --- /dev/null +++ b/src/css/loader.css @@ -0,0 +1,94 @@ +/*! + * # Semantic UI 2.3.3 - Loader + * http://github.com/semantic-org/semantic-ui/ + * + * Released under the MIT license + * http://opensource.org/licenses/MIT + */ + +/* Standard Size */ +.loader { + position: absolute; + top: 50%; + left: 50%; + margin: 0; + text-align: center; + z-index: 1000; + transform: translateX(-50%) translateY(-50%); + + width: 2.28571429rem; + height: 2.28571429rem; + font-size: 1em; +} + +/* Static Shape */ +.loader:before { + position: absolute; + content: ''; + top: 0; + left: 50%; + width: 100%; + height: 100%; + border-radius: 500rem; + border: 0.2em solid rgba(0, 0, 0, 0.1); +} + +/* Active Shape */ +.loader:after { + position: absolute; + content: ''; + top: 0; + left: 50%; + width: 100%; + height: 100%; + animation: loader 0.6s linear; + animation-iteration-count: infinite; + border-radius: 500rem; + border: 0.2em solid transparent; + border-top-color: #767676; + box-shadow: 0 0 0 1px transparent; +} + +.loader:before, +.loader:after { + width: 2.28571429rem; + height: 2.28571429rem; + margin: 0 0 0 -1.14285714rem; +} + +/* Active Animation */ +@keyframes loader { + from { + transform: rotate(0deg); + } + + to { + transform: rotate(360deg); + } +} + +/* States */ + +.loader.indeterminate:after { + animation-direction: reverse; + animation-duration: 1.2s; +} + +.loader.disabled, +.loader.hidden { + display: none; +} + +/* Inverted */ + +.loader.inverted { + color: rgba(255, 255, 255, 0.9); +} + +.loader.inverted:before { + border-color: rgba(255, 255, 255, 0.15); +} + +.loader.inverted:after { + border-top-color: #FFFFFF; +} diff --git a/src/css/style.css b/src/css/style.css new file mode 100644 index 0000000..bef501a --- /dev/null +++ b/src/css/style.css @@ -0,0 +1,400 @@ +/*! + * This file is a part of ts-website 2 + * https://github.com/Wruczek/ts-website + * (c) Wruczek 2017 - 2019 + */ + +body { + position: relative; + padding-top: 90px; + padding-bottom: 6rem; + min-height: 100vh; + font-size: 15px; +} + +.connectionproblems { + margin-top: 1rem; +} + +.fa, .fas, .fab, .far, .fal { + margin-right: 0.5em +} + +.language-switcher .dropdown-item { + cursor: pointer; +} + +.card { + margin-bottom: 1rem; +} + +.accordion .card { + margin-bottom: 0; +} + +.accordion .card .card-header { + padding: .5rem !important; +} + +.card .card-header * { + margin-bottom: 0; +} + +.bottom-error-alert { + position: fixed; + bottom: 0; + left: 0; + right: 0; + margin: 0; + border-radius: 0; + text-align: center; + z-index: 998; +} + +.card-titleblock { + margin-bottom: 1.5rem !important; +} + +.card-titleblock .card-header { + text-align: center; + border: 0; + font-size: 1.2rem; +} + +.footer { + position: absolute; + right: 0; + bottom: 0; + left: 0; + + background-color: #f8f9fa; + padding: 0.8rem; + font-size: 1rem; + line-height: 2em; +} + +.footer .footer-copyright { + font-size: 0.75rem; +} + +/* Fixes https://github.com/twbs/bootstrap/issues/23374 */ +@media (max-width: 991px) { + .nav-fix-scroll { + overflow: auto; + max-height: 85vh; + align-items: unset; + } +} + +/* Reimplement the btn-xs that was removed in Bootstrap 4 */ +/* https://github.com/twbs/bootstrap/issues/21881#issuecomment-341972830 */ +.btn-group-xs > .btn, .btn-xs { + padding : .25rem .4rem; + font-size : .875rem; + line-height : .5; + border-radius : .2rem; +} + +/* ACCORDION */ + +.accordion .card .card-header { + display: flex; + justify-content: space-between; + align-items: center; +} + +.accordion .card .card-header .btn-link { + text-decoration: none; + text-align: inherit; + white-space: normal; +} + +.accordion .card .card-header .copy-faq-url { + transition: opacity ease 250ms; + margin: 0 0.75rem 0 0; + cursor: pointer; +} + +.accordion .card:not(:hover) .card-header .copy-faq-url { + opacity: 0; +} + +/* Page/element specific */ + +.badge.error-badge { + white-space: normal; + font-size: 1em; + font-weight: normal; +} + +/* Server status */ + +.server-status.loaded .status-loader { + display: none; +} + +.server-status p { + display: flex; + justify-content: space-between; + align-items: center; + + margin-bottom: 0.1rem; +} + +.server-status .data span:first-child { + white-space: nowrap; +} + +.server-status .data span:last-child { + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; +} + +#loginModal .select-account .list-group .list-group-item { + cursor: pointer; + display: flex; + justify-content: space-between; + align-items: center; +} + +.login-button { + max-width: 150px; +} + +#loginModal-codeconfirm .invalid-feedback { + margin-top: 0.5rem; + font-size: 100%; +} + +/* Bans page */ + +.ban-alert { + margin-bottom: 2rem; +} + +.ban-alert.banned { + display: flex; + align-items: center; +} + +/* Responsive datatables styles */ + +table.dataTable>tbody>tr.child ul.dtr-details>li:first-child { + padding-top: 0; +} + +table.dataTable > tbody > tr.child span.dtr-title { + display: inline-block; + min-width: 75px; + font-weight: bold; +} + +table.dataTable>tbody>tr.child ul.dtr-details { + display: inline-block; + list-style-type: none; + margin: 0; + padding: 0; +} + +table.dataTable>tbody>tr.child ul.dtr-details>li { + padding: 0.5em 0; +} + +table.dataTable > tbody > tr.parent td { + background-color: #282840 +} + +table.dataTable > tbody > tr.child td.child { + background-color: #2d2d4b +} + +.dataTables_info { + white-space: normal !important +} + +/* Viewer */ + +.viewer-container { + font-size: 14px; +} + +.viewer-container .channel-container:not(.is-server), .viewer-container .client-container { + margin-left: 1.4em; +} + +.viewer-container .channel-container:not(.is-spacer) .channel, .viewer-container .client-container { + display: flex; + justify-content: space-between; + align-items: center; +} + +.viewer-container .channel-container:not(.is-spacer) > .channel > .channel-name, +.viewer-container .channel-container:not(.is-spacer) > .channel > .channel-icons, +.viewer-container .client-name, .viewer-container .client-icons { + display: flex; + align-items: center; +} + +.viewer-container .channel-container:not(.is-spacer) > .channel > .channel-name, +.viewer-container .client-name { + word-break: break-all; /* For all browsers */ + word-break: break-word; /* For some browsers that support it - unofficial! */ +} + +.viewer-container .client-icons { + flex-wrap: wrap; + justify-content: flex-end; +} + +.viewer-container .client-icons .icon, +.viewer-container .client-icons .icon-flag, +.viewer-container .channel-icons .icon { + margin-left: 0.5em; +} + +.viewer-container .channel-container:not(.is-spacer) .channel, +.viewer-container .client-container { + position: relative; + z-index: 0; + cursor: pointer; +} + +.viewer-container .channel-container:not(.is-spacer) .channel::after, +.viewer-container .client-container::after { + content: ""; + z-index: -1; + + position: absolute; + top: -3px; + left: -10px; + bottom: -3px; + right: -10px; + + border-radius: 4px; + background-color: rgba(0, 0, 0, .15); + opacity: 0; + transition: opacity ease 300ms; +} + +.viewer-container .channel-container:not(.is-spacer) .channel:hover::after, +.viewer-container .client-container:hover::after, +.viewer-container .channel-container:not(.is-spacer) .channel:focus::after, +.viewer-container .client-container:focus::after { + opacity: 1; +} + +.viewer-container .channel-name .icon, .viewer-container .client-name .icon { + margin-right: 0.5em; +} + +.viewer-container .icon { + height: 16px; + max-width: 16px; +} + +.viewer-container .channel-container.spacer-left > .channel { + text-align: left; +} + +.viewer-container .channel-container.spacer-center > .channel { + text-align: center; +} + +.viewer-container .channel-container.spacer-right > .channel { + text-align: right; +} + +.viewer-container .channel-container.spacer-repeat > .channel { + overflow: hidden; + white-space: nowrap; +} + +/* Admin status sidebar */ + +.admin-status.admin-status-grouped .group-name { + /* Center icon with text (vertical & horizontal) */ + display: flex; + justify-content: center; + align-items: center; + + font-family: var(--font-family-main); + font-size: 1.3em; +} + +.admin-status.admin-status-grouped .group-name { + margin: 1em 0 0.1em 0; +} + +.admin-status.admin-status-grouped .empty-group { + text-align: center; + font-style: italic; +} + +/* No top spacing on the first group */ +/* Thats why I've put that extra DIV that wraps all groups */ +.admin-status.admin-status-grouped div:first-child .group-name { + margin-top: 0; +} + +.admin-status.admin-status-grouped .group-name img, +.admin-status.admin-status-list .nickname img { + height: 16px; + max-width: 16px; + margin-right: 0.25em; +} + +.admin-status.admin-status-list .group-separator { + margin: 1.25em 0; +} + +.admin-status .status-container { + display: flex; + justify-content: space-between; + align-items: center; + margin-bottom: 0.1em; +} + +.admin-status .status-container .nickname { + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; +} + +/* Group assigner */ + +.group-assigner .list-group-item { + display: flex; + justify-content: space-between; + align-items: center; +} + +.group-assigner .list-group-item > div { + display: flex; + align-items: center; +} + +/* The "icon-margin" is used when there is no icon, */ +/* its used to align it with other groups */ +.group-assigner .assigner-icon, .group-assigner .assigner-icon-margin { + width: 16px; + max-height: 16px; + margin-right: 0.3em; +} + +.group-assigner .list-group-item:not(.assigner-header) { + cursor: pointer; +} + +.group-assigner .assigner-category { + margin-bottom: 1.5rem; +} + +.group-assigner .assigner-save { + width: 200px; + max-width: 100%; +} + +.group-assigner .assigner-header .badge.badge-invalid { + background-color: red !important +} diff --git a/src/css/themes/dark.css b/src/css/themes/dark.css new file mode 100644 index 0000000..dda0e7c --- /dev/null +++ b/src/css/themes/dark.css @@ -0,0 +1,647 @@ +/*! + * This file is a part of ts-website 2 + * https://github.com/Wruczek/ts-website + * (c) Wruczek 2017 - 2019 + */ + +@import url('https://fonts.googleapis.com/css?family=Exo+2'); + +:root { + --site-background: #1e202f; + --site-secondary-color: #a61f67; + --site-accent-color: #f92552; + --site-text: #9e9caa; + --site-scrollbar-color: #1c88cc; + + --font-family-sans-serif: -apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,"Helvetica Neue",Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji"; + --font-family-main: "Exo 2", "Roboto", sans-serif; +} + +body { + background-color: var(--site-background); + color: var(--site-text); + font-family: var(--font-family-main); +} + +h1, h2, h3, h4, h5, h6 { + color: #fff; +} + +.font-reading { + font-family: var(--font-family-sans-serif); +} + +p, tbody { + font-family: var(--font-family-sans-serif); +} + +.btn, thead, .dataTables_wrapper { + font-family: var(--font-family-main); +} + +a { + color: #fff; + transition: color 0.3s ease; +} + +a:hover { + color: var(--site-secondary-color); + text-decoration: none; +} + +::selection { + background-color: var(--site-secondary-color); +} + + +/* ============ */ +/* NAVBAR STUFF */ +/* ============ */ + +#main-navbar { + background-color: #323150 !important; + border-bottom: 1px solid #3c3b5b; +} + +#main-navbar .nav-item { + padding: 0.5rem 0; + transition: background-color 0.5s ease; +} + +#main-navbar .navbar-nav .nav-link { + color: rgba(255, 255, 255, 0.8); + text-transform: uppercase; +} + +#main-navbar .nav-item.active, +#main-navbar .nav-item:hover, +#main-navbar .nav-item.dropdown.show { + background-color: #282840; +} + +#main-navbar .nav-item.active .nav-link, +#main-navbar .nav-item:hover .nav-link, +#main-navbar .nav-item.dropdown.show .nav-link { + color: #fff; +} + +@media (max-width: 991px) { + #main-navbar .navbar-collapse { + margin-left: -1rem; + margin-right: -1rem; + } + + #main-navbar .navbar-nav .nav-link { + padding-left: 1rem; + padding-right: 1rem; + color: rgba(255, 255, 255, 0.65); + } +} + +@media (min-width: 992px) { + /* Remove padding from navbar and add it later to navbar items */ + #main-navbar { + padding: 0; + } + + #main-navbar .navbar-nav { + border-left: 1px solid #3c3b5b; + } + + #main-navbar .navbar-nav li { + border-right: 1px solid #3c3b5b; + } + + /* Add bigger padding between navbar items */ + #main-navbar .navbar-nav .nav-link { + padding-right: .9rem; + padding-left: .9rem; + } + + /* ================================ */ + /* Navbar underline hover effect */ + /* Taken from http://bit.ly/2xkPi0k */ + /* ================================ */ + #main-navbar .nav-item { + position: relative; + } + + #main-navbar .nav-item:after { + content: ""; + position: absolute; + top: calc(100% - 0.1rem); + border-bottom: 0.125rem solid var(--site-accent-color); + left: 50%; + right: 50%; + transition: left 0.5s ease, right 0.5s ease; + } + + #main-navbar .nav-item:hover::after, + #main-navbar .nav-item.active::after, + #main-navbar .nav-item.show::after { + left: 0; + right: 0; + } + + /* =============================== */ + /* Hover effect for dropdown items */ + /* =============================== */ + .dropdown-item { + border-left: 0 solid var(--site-accent-color); + transition: border-left-width 0.1s ease, padding-left 0.1s ease, background-color 0.5s ease; + } + + .dropdown-item:hover, + .dropdown-item.active { + border-left-width: 2px; + padding-left: calc(1.5rem - 2px); + } +} + +/* ========= */ +/* DROPDOWNS */ +/* ========= */ + +.dropdown-menu { + background-color: #323150; + color: inherit; +} + +.dropdown-item { + color: rgba(255, 255, 255, 0.8); +} + +.dropdown-item.active, +.dropdown-item:focus, +.dropdown-item:hover { + color: #fff; + background-color: #282840; +} + +/* ======= */ +/* BUTTONS */ +/* ======= */ + +.btn-primary, .btn-primary.disabled, .btn-primary:disabled { + background-color: var(--site-secondary-color); + border-color: var(--site-secondary-color); +} + +.btn-primary:hover { + background-color: #861953; + border-color: #861953; +} + +.btn-primary:not(:disabled):not(.disabled).active, +.btn-primary:not(:disabled):not(.disabled):active, +.show > .btn-primary.dropdown-toggle { + background-color: #69182d; + border-color: #69182d; +} + +.btn-primary.focus, .btn-primary:focus, +.btn-primary:not(:disabled):not(.disabled).active:focus, +.btn-primary:not(:disabled):not(.disabled):active:focus, +.show > .btn-primary.dropdown-toggle:focus { + box-shadow: 0 0 0 0.2rem rgba(166, 31, 103, 0.5); /* secondary color with 50% opacity */ +} + +/* ====== */ +/* INPUTS */ +/* ====== */ + +.form-control, .custom-select { + color: #fff; + background-color: #282840; + border-color: #282840; +} + +.form-control:focus, .custom-select:focus { + color: #fff; + background-color: #282840; + + border-color: var(--site-secondary-color); + box-shadow: 0 0 0 0.2rem rgba(166, 31, 103, 0.30); /* secondary color with 30% opacity */ +} + +.form-control::-webkit-input-placeholder { + color: var(--site-text); +} + +.form-control::-moz-placeholder { + color: var(--site-text); +} + +.form-control:-ms-input-placeholder { + color: var(--site-text); +} + +.form-control::-ms-input-placeholder { + color: var(--site-text); +} + +.form-control::placeholder { + color: var(--site-text); +} + +.form-control[disabled], +.input-text[disabled], +select[disabled], +.form-control[readonly], +.input-text[readonly], +select[readonly], +fieldset[disabled] .form-control, +fieldset[disabled] .input-text, +fieldset[disabled] select, +.custom-select[disabled] { + background-color: #212135; + border-color: transparent; +} + +.form-control-plaintext { + color: var(--site-text); +} + +.input-group-text { + color: var(--site-text); + background-color: #212135; + border: none; +} + +.custom-control-label::before, +.custom-control-input:disabled~.custom-control-label::before { + background-color: #212135; +} + +.custom-control-input:checked~.custom-control-label::before { + background-color: var(--site-secondary-color) !important; +} + +/* Lighter on a list group item */ + +.list-group-item .custom-control-label::before, +.list-group-item .custom-control-input:disabled~.custom-control-label::before { + background-color: #323150; +} + +/* ======================================= */ +/* ALERTS */ +/* taken from Bootswatch Darkly */ +/* Bootswatch is (c) 2012-2018 Thomas Park */ +/* ======================================= */ + +.alert { + border: none; + color: #fff; +} + +.alert a, +.alert .alert-link { + color: #fff; + text-decoration: underline; +} + +.alert-primary { + background-color: #375a7f; +} + +.alert-secondary { + background-color: #444; +} + +.alert-success { + background-color: #00bc8c; +} + +.alert-info { + background-color: #3498DB; +} + +.alert-warning { + background-color: #F39C12; +} + +.alert-danger { + background-color: #E74C3C; +} + +.alert-light { + background-color: #303030; +} + +.alert-dark { + background-color: #adb5bd; +} + +.alert-dismissible .close { + padding: 0.5rem 1rem; +} + +.alert code { + background-color: var(--site-background); + padding: 0.15em; +} + +/* ========== */ +/* PAGINATION */ +/* ========== */ + +.page-link { + color: var(--site-text); + background-color: #282840; + border-color: #3c3b5b; +} + +.page-link:hover { + color: var(--site-text); + background-color: #212135; + border-color: #212135; +} + +.page-link.light-hover:hover { + color: var(--site-text); + background-color: #323150; + border-color: #323150; +} + +.page-link:focus { + box-shadow: 0 0 0 0.2rem rgba(166, 31, 103, 0.30); /* secondary color with 30% opacity */ +} + +.page-item.active .page-link { + color: #fff; + background-color: var(--site-secondary-color); + border-color: var(--site-secondary-color); +} + +.page-item.disabled .page-link { + color: #5d666e; + background-color: #212135; + border-color: #212135; +} + +/* ===== */ +/* CARDS */ +/* ===== */ + +.card { + background-color: transparent; + border-color: transparent; +} + +.card { + border: 1px solid #3c3b5b; + background-color: #323150; +} + +.card .card-body { + font-family: var(--font-family-sans-serif); + padding: 1rem; +} + +.card.card-accent > .card-header { + position: relative; + overflow: hidden; + color: #fff; +} + +.card.card-accent > .card-header::before { + content: ""; + display: block; + position: absolute; + left: 0; + top: 0; + right: 0; + height: 2px; + background-color: var(--site-accent-color); +} + +.card.card-titleblock { + text-transform: uppercase; +} + +.card .card-header { + padding-left: 1rem; + padding-right: 1rem; + background-color: rgba(0, 0, 0, .15); +} + +.card .card-header.bigger-title { + font-size: 1.15rem +} + +.card .card-header a { + text-decoration: none !important; +} + +.card .card-body p:last-child { + margin-bottom: 0; +} + +/* ===== */ +/* MODAL */ +/* ===== */ + +.modal .modal-content { + border: 1px solid #3c3b5b; + background-color: #323150; +} + +.modal .modal-header { + background-color: rgba(0, 0, 0, .15); + border-bottom: 1px solid rgba(0, 0, 0, .125); +} + +.modal .modal-body { + font-family: var(--font-family-sans-serif); +} + +.modal .modal-header .close { + color: #fff !important; + font-family: var(--font-family-sans-serif); +} + +/* ========== */ +/* LIST-GROUP */ +/* ========== */ + +.list-group-item { + color: #fff; + background-color: #282840; +} + +.list-group-item-action:focus, +.list-group-item-action:hover, +.list-group-item-action:active { + color: #fff; + background-color: #232338; +} + +/* ========= */ +/* ACCORDION */ +/* ========= */ + +.accordion .card .card-header { + font-family: var(--font-family-main); +} + +.accordion .card .card-header .btn-link { + color: #fff; +} + +/* ====== */ +/* TABLES */ +/* ====== */ + +.table { + font-size: 0.85em; +} + +.table thead th { + border-bottom: none; + color: #fff; + text-transform: uppercase; + white-space: nowrap; +} + +.table td, .table th { + border-top-color: #494770; + padding: .65rem; +} + +/* ============= */ +/* PROGRESS BARS */ +/* ============= */ + +.progress { + background-color: #2c2e3e; +} + +/* ======== */ +/* POPOVERS */ +/* ======== */ + +/* +.popover {bgcolor, border} + .popover-header {bgcolor, border} + .popover-body {color} +*/ + +.popover { + border: 1px solid #3c3b5b; + background-color: #323150; +} + +.popover-header { + background-color: rgba(0, 0, 0, .15); + border-bottom: 1px solid #3c3b5b; + color: #fff; + font-family: var(--font-family-main); +} + +.popover-body { + color: rgba(255, 255, 255, 0.8) +} + +/* ====== */ +/* FOOTER */ +/* ====== */ + +.footer { + background-color: #282840; +} + +/* =============== */ +/* INVERTED LOADER */ +/* =============== */ + +.loader { + color: rgba(255, 255, 255, 0.9); +} + +.loader:before { + border-color: rgba(255, 255, 255, 0.15); +} + +.loader:after { + border-top-color: #FFFFFF; +} + +/* ========= */ +/* SCROLLBAR */ +/* ========= */ + +::-webkit-scrollbar { + width: 5px; + height: 5px; + background-color: var(--site-background); +} + +::-webkit-scrollbar-thumb { + border-radius: 3px; + background: var(--site-accent-color) +} + +::-webkit-scrollbar-thumb:window-inactive { + background: var(--site-accent-color) +} + +::-webkit-scrollbar-track-piece { + display: none +} + +/* ============ */ +/* ADMIN STATUS */ +/* ============ */ + +.admin-status .status-container .status .badge-success { + background-color: var(--site-secondary-color); +} + +.admin-status .status-container .status .badge-secondary { + background-color: var(--site-background); +} + +.admin-status .status-container .status .badge-secondary { + background-color: var(--site-background); +} + +/* ============== */ +/* GROUP ASSIGNER */ +/* ============== */ + +.group-assigner .assigner-header { + font-size: 1.1em; + background-color: #212135; + font-family: var(--font-family-main); +} + +.group-assigner .assigner-header .badge.badge-primary { + background-color: var(--site-secondary-color); +} + +.group-assigner .assigner-header .badge.badge-invalid { + background-color: red !important +} + + +/* ============= */ +/* PAGE-SPECIFIC */ +/* ============= */ + +a[data-connectionproblem] { + color: #000; +} + +/* Server Status */ + +.server-status .data .badge { + color: #fff; + background-color: var(--site-secondary-color); +} + +/* Login */ + +#loginModal .not-connected .waiting-connect { + color: #fff; +} diff --git a/src/faq.php b/src/faq.php new file mode 100644 index 0000000..86f12a8 --- /dev/null +++ b/src/faq.php @@ -0,0 +1,16 @@ +getDb(); +$qa = $db->select("faq", "*"); + +$data = [ + "additionaltext" => '
If you have any more questions feel free to contact us
', + "qa" => $qa +]; + +TemplateUtils::i()->renderTemplate("faq", $data); diff --git a/src/img/cubes.png b/src/img/cubes.png new file mode 100644 index 0000000..e22ebd0 Binary files /dev/null and b/src/img/cubes.png differ diff --git a/src/img/icons/defaulticon-1024.png b/src/img/icons/defaulticon-1024.png new file mode 100644 index 0000000..e740a73 Binary files /dev/null and b/src/img/icons/defaulticon-1024.png differ diff --git a/src/img/icons/defaulticon-128.png b/src/img/icons/defaulticon-128.png new file mode 100644 index 0000000..85faedc Binary files /dev/null and b/src/img/icons/defaulticon-128.png differ diff --git a/src/img/icons/defaulticon-16.png b/src/img/icons/defaulticon-16.png new file mode 100644 index 0000000..41d0cd2 Binary files /dev/null and b/src/img/icons/defaulticon-16.png differ diff --git a/src/img/icons/defaulticon-256.png b/src/img/icons/defaulticon-256.png new file mode 100644 index 0000000..c914839 Binary files /dev/null and b/src/img/icons/defaulticon-256.png differ diff --git a/src/img/icons/defaulticon-32.png b/src/img/icons/defaulticon-32.png new file mode 100644 index 0000000..945d4d0 Binary files /dev/null and b/src/img/icons/defaulticon-32.png differ diff --git a/src/img/icons/defaulticon-512.png b/src/img/icons/defaulticon-512.png new file mode 100644 index 0000000..80ea968 Binary files /dev/null and b/src/img/icons/defaulticon-512.png differ diff --git a/src/img/icons/defaulticon-64.png b/src/img/icons/defaulticon-64.png new file mode 100644 index 0000000..c80a22f Binary files /dev/null and b/src/img/icons/defaulticon-64.png differ diff --git a/src/img/icons/defaulticon-credits.txt b/src/img/icons/defaulticon-credits.txt new file mode 100644 index 0000000..6b9b3f5 --- /dev/null +++ b/src/img/icons/defaulticon-credits.txt @@ -0,0 +1 @@ +Made by aleixoteixeira, at http://rocketdock.com diff --git a/src/img/ts-icons/3d_sound.svg b/src/img/ts-icons/3d_sound.svg new file mode 100644 index 0000000..88d8f0b --- /dev/null +++ b/src/img/ts-icons/3d_sound.svg @@ -0,0 +1,18 @@ + + + + + + + + + + + + + + + + + + diff --git a/src/img/ts-icons/3d_sound_me.svg b/src/img/ts-icons/3d_sound_me.svg new file mode 100644 index 0000000..3c09623 --- /dev/null +++ b/src/img/ts-icons/3d_sound_me.svg @@ -0,0 +1,17 @@ + + + + + + + + + + + + + + + + + diff --git a/src/img/ts-icons/3d_sound_user.svg b/src/img/ts-icons/3d_sound_user.svg new file mode 100644 index 0000000..bb35daf --- /dev/null +++ b/src/img/ts-icons/3d_sound_user.svg @@ -0,0 +1,17 @@ + + + + + + + + + + + + + + + + + diff --git a/src/img/ts-icons/about.svg b/src/img/ts-icons/about.svg new file mode 100644 index 0000000..df31914 --- /dev/null +++ b/src/img/ts-icons/about.svg @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + + diff --git a/src/img/ts-icons/activate_microphone.svg b/src/img/ts-icons/activate_microphone.svg new file mode 100644 index 0000000..5dbc6cf --- /dev/null +++ b/src/img/ts-icons/activate_microphone.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/img/ts-icons/add.svg b/src/img/ts-icons/add.svg new file mode 100644 index 0000000..5749402 --- /dev/null +++ b/src/img/ts-icons/add.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/img/ts-icons/add_foe.svg b/src/img/ts-icons/add_foe.svg new file mode 100644 index 0000000..1e62d95 --- /dev/null +++ b/src/img/ts-icons/add_foe.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/img/ts-icons/add_folder.svg b/src/img/ts-icons/add_folder.svg new file mode 100644 index 0000000..b72d466 --- /dev/null +++ b/src/img/ts-icons/add_folder.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/img/ts-icons/add_friend.svg b/src/img/ts-icons/add_friend.svg new file mode 100644 index 0000000..a0389e1 --- /dev/null +++ b/src/img/ts-icons/add_friend.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/img/ts-icons/addon-collection.svg b/src/img/ts-icons/addon-collection.svg new file mode 100644 index 0000000..d41efe0 --- /dev/null +++ b/src/img/ts-icons/addon-collection.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/img/ts-icons/addon.svg b/src/img/ts-icons/addon.svg new file mode 100644 index 0000000..35c62f6 --- /dev/null +++ b/src/img/ts-icons/addon.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/img/ts-icons/apply.svg b/src/img/ts-icons/apply.svg new file mode 100644 index 0000000..ad30b5f --- /dev/null +++ b/src/img/ts-icons/apply.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/img/ts-icons/away.svg b/src/img/ts-icons/away.svg new file mode 100644 index 0000000..380cc80 --- /dev/null +++ b/src/img/ts-icons/away.svg @@ -0,0 +1,18 @@ + + + + + + + + + + + + + + + + + + diff --git a/src/img/ts-icons/ban_client.svg b/src/img/ts-icons/ban_client.svg new file mode 100644 index 0000000..47a1a90 --- /dev/null +++ b/src/img/ts-icons/ban_client.svg @@ -0,0 +1,18 @@ + + + + + + + + + + + + + + + + + + diff --git a/src/img/ts-icons/ban_list.svg b/src/img/ts-icons/ban_list.svg new file mode 100644 index 0000000..7de0feb --- /dev/null +++ b/src/img/ts-icons/ban_list.svg @@ -0,0 +1,23 @@ + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/img/ts-icons/bookmark_add.svg b/src/img/ts-icons/bookmark_add.svg new file mode 100644 index 0000000..5815b85 --- /dev/null +++ b/src/img/ts-icons/bookmark_add.svg @@ -0,0 +1,19 @@ + + + + + + + + + + + + + + + + + + + diff --git a/src/img/ts-icons/bookmark_add_folder.svg b/src/img/ts-icons/bookmark_add_folder.svg new file mode 100644 index 0000000..f1d6fb3 --- /dev/null +++ b/src/img/ts-icons/bookmark_add_folder.svg @@ -0,0 +1,18 @@ + + + + + + + + + + + + + + + + + + diff --git a/src/img/ts-icons/bookmark_duplicate.svg b/src/img/ts-icons/bookmark_duplicate.svg new file mode 100644 index 0000000..b235307 --- /dev/null +++ b/src/img/ts-icons/bookmark_duplicate.svg @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + + diff --git a/src/img/ts-icons/bookmark_manager.svg b/src/img/ts-icons/bookmark_manager.svg new file mode 100644 index 0000000..c85fd7c --- /dev/null +++ b/src/img/ts-icons/bookmark_manager.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/img/ts-icons/bookmark_remove.svg b/src/img/ts-icons/bookmark_remove.svg new file mode 100644 index 0000000..54a59d9 --- /dev/null +++ b/src/img/ts-icons/bookmark_remove.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/img/ts-icons/broken_image.svg b/src/img/ts-icons/broken_image.svg new file mode 100644 index 0000000..6f6cdd0 --- /dev/null +++ b/src/img/ts-icons/broken_image.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/img/ts-icons/browse-addon-online.svg b/src/img/ts-icons/browse-addon-online.svg new file mode 100644 index 0000000..b5403fa --- /dev/null +++ b/src/img/ts-icons/browse-addon-online.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/img/ts-icons/capture.svg b/src/img/ts-icons/capture.svg new file mode 100644 index 0000000..90a1518 --- /dev/null +++ b/src/img/ts-icons/capture.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/img/ts-icons/change_nickname.svg b/src/img/ts-icons/change_nickname.svg new file mode 100644 index 0000000..dca25cf --- /dev/null +++ b/src/img/ts-icons/change_nickname.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/img/ts-icons/changelog.svg b/src/img/ts-icons/changelog.svg new file mode 100644 index 0000000..4b65e15 --- /dev/null +++ b/src/img/ts-icons/changelog.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/img/ts-icons/channel_chat.svg b/src/img/ts-icons/channel_chat.svg new file mode 100644 index 0000000..1a5b5d8 --- /dev/null +++ b/src/img/ts-icons/channel_chat.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/img/ts-icons/channel_collapse_all.svg b/src/img/ts-icons/channel_collapse_all.svg new file mode 100644 index 0000000..4410428 --- /dev/null +++ b/src/img/ts-icons/channel_collapse_all.svg @@ -0,0 +1,18 @@ + + + + + + + + + + + + + + + + + + diff --git a/src/img/ts-icons/channel_commander.svg b/src/img/ts-icons/channel_commander.svg new file mode 100644 index 0000000..5c98e04 --- /dev/null +++ b/src/img/ts-icons/channel_commander.svg @@ -0,0 +1,21 @@ + + + + + + + + + + + + + + + + + + + + + diff --git a/src/img/ts-icons/channel_create.svg b/src/img/ts-icons/channel_create.svg new file mode 100644 index 0000000..1dd570c --- /dev/null +++ b/src/img/ts-icons/channel_create.svg @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + diff --git a/src/img/ts-icons/channel_create_sub.svg b/src/img/ts-icons/channel_create_sub.svg new file mode 100644 index 0000000..ddab2cf --- /dev/null +++ b/src/img/ts-icons/channel_create_sub.svg @@ -0,0 +1,18 @@ + + + + + + + + + + + + + + + + + + diff --git a/src/img/ts-icons/channel_default.svg b/src/img/ts-icons/channel_default.svg new file mode 100644 index 0000000..2b1ff03 --- /dev/null +++ b/src/img/ts-icons/channel_default.svg @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + diff --git a/src/img/ts-icons/channel_delete.svg b/src/img/ts-icons/channel_delete.svg new file mode 100644 index 0000000..3b5b59b --- /dev/null +++ b/src/img/ts-icons/channel_delete.svg @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + diff --git a/src/img/ts-icons/channel_edit.svg b/src/img/ts-icons/channel_edit.svg new file mode 100644 index 0000000..5b7bde3 --- /dev/null +++ b/src/img/ts-icons/channel_edit.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/img/ts-icons/channel_expand_all.svg b/src/img/ts-icons/channel_expand_all.svg new file mode 100644 index 0000000..5d2ad6c --- /dev/null +++ b/src/img/ts-icons/channel_expand_all.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/img/ts-icons/channel_green.svg b/src/img/ts-icons/channel_green.svg new file mode 100644 index 0000000..d2d1319 --- /dev/null +++ b/src/img/ts-icons/channel_green.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/img/ts-icons/channel_green_subscribed.svg b/src/img/ts-icons/channel_green_subscribed.svg new file mode 100644 index 0000000..611a943 --- /dev/null +++ b/src/img/ts-icons/channel_green_subscribed.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/img/ts-icons/channel_groups.svg b/src/img/ts-icons/channel_groups.svg new file mode 100644 index 0000000..24111b8 --- /dev/null +++ b/src/img/ts-icons/channel_groups.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/img/ts-icons/channel_private.svg b/src/img/ts-icons/channel_private.svg new file mode 100644 index 0000000..6b44359 --- /dev/null +++ b/src/img/ts-icons/channel_private.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/img/ts-icons/channel_red.svg b/src/img/ts-icons/channel_red.svg new file mode 100644 index 0000000..8002d6b --- /dev/null +++ b/src/img/ts-icons/channel_red.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/img/ts-icons/channel_red_subscribed.svg b/src/img/ts-icons/channel_red_subscribed.svg new file mode 100644 index 0000000..7301b5e --- /dev/null +++ b/src/img/ts-icons/channel_red_subscribed.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/img/ts-icons/channel_subscribed.svg b/src/img/ts-icons/channel_subscribed.svg new file mode 100644 index 0000000..015515e --- /dev/null +++ b/src/img/ts-icons/channel_subscribed.svg @@ -0,0 +1,18 @@ + + + + + + + + + + + + + + + + + + diff --git a/src/img/ts-icons/channel_switch.svg b/src/img/ts-icons/channel_switch.svg new file mode 100644 index 0000000..f02dc11 --- /dev/null +++ b/src/img/ts-icons/channel_switch.svg @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + diff --git a/src/img/ts-icons/channel_unsubscribed.svg b/src/img/ts-icons/channel_unsubscribed.svg new file mode 100644 index 0000000..60f4985 --- /dev/null +++ b/src/img/ts-icons/channel_unsubscribed.svg @@ -0,0 +1,12 @@ + + + + + + + + + + + + diff --git a/src/img/ts-icons/channel_yellow.svg b/src/img/ts-icons/channel_yellow.svg new file mode 100644 index 0000000..8fb3162 --- /dev/null +++ b/src/img/ts-icons/channel_yellow.svg @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + diff --git a/src/img/ts-icons/channel_yellow_subscribed.svg b/src/img/ts-icons/channel_yellow_subscribed.svg new file mode 100644 index 0000000..3250436 --- /dev/null +++ b/src/img/ts-icons/channel_yellow_subscribed.svg @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + + diff --git a/src/img/ts-icons/check_update.svg b/src/img/ts-icons/check_update.svg new file mode 100644 index 0000000..55e0198 --- /dev/null +++ b/src/img/ts-icons/check_update.svg @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + diff --git a/src/img/ts-icons/clear.svg b/src/img/ts-icons/clear.svg new file mode 100644 index 0000000..6877fd5 --- /dev/null +++ b/src/img/ts-icons/clear.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/img/ts-icons/client_hide.svg b/src/img/ts-icons/client_hide.svg new file mode 100644 index 0000000..a4d62a3 --- /dev/null +++ b/src/img/ts-icons/client_hide.svg @@ -0,0 +1,21 @@ + + + + + + + + + + + diff --git a/src/img/ts-icons/client_show.svg b/src/img/ts-icons/client_show.svg new file mode 100644 index 0000000..0f7e9c2 --- /dev/null +++ b/src/img/ts-icons/client_show.svg @@ -0,0 +1,21 @@ + + + + + + + + + + + diff --git a/src/img/ts-icons/close_button.svg b/src/img/ts-icons/close_button.svg new file mode 100644 index 0000000..b55a798 --- /dev/null +++ b/src/img/ts-icons/close_button.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/img/ts-icons/complaint_list.svg b/src/img/ts-icons/complaint_list.svg new file mode 100644 index 0000000..2ed7de6 --- /dev/null +++ b/src/img/ts-icons/complaint_list.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/img/ts-icons/conflict-icon.svg b/src/img/ts-icons/conflict-icon.svg new file mode 100644 index 0000000..7444820 --- /dev/null +++ b/src/img/ts-icons/conflict-icon.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/img/ts-icons/connect.svg b/src/img/ts-icons/connect.svg new file mode 100644 index 0000000..c14c959 --- /dev/null +++ b/src/img/ts-icons/connect.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/img/ts-icons/contact.svg b/src/img/ts-icons/contact.svg new file mode 100644 index 0000000..5e42b0e --- /dev/null +++ b/src/img/ts-icons/contact.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/img/ts-icons/copy.svg b/src/img/ts-icons/copy.svg new file mode 100644 index 0000000..8ef5c78 --- /dev/null +++ b/src/img/ts-icons/copy.svg @@ -0,0 +1,18 @@ + + + + + + + + + + + + + + + + + + diff --git a/src/img/ts-icons/copy_url.svg b/src/img/ts-icons/copy_url.svg new file mode 100644 index 0000000..7f174fe --- /dev/null +++ b/src/img/ts-icons/copy_url.svg @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/img/ts-icons/debug.log b/src/img/ts-icons/debug.log new file mode 100644 index 0000000..e8f4166 --- /dev/null +++ b/src/img/ts-icons/debug.log @@ -0,0 +1 @@ +[1222/083141.088:ERROR:crash_report_database_win.cc(428)] unexpected header diff --git a/src/img/ts-icons/default.svg b/src/img/ts-icons/default.svg new file mode 100644 index 0000000..a5cc0d8 --- /dev/null +++ b/src/img/ts-icons/default.svg @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + diff --git a/src/img/ts-icons/default_for_all_bookmarks.svg b/src/img/ts-icons/default_for_all_bookmarks.svg new file mode 100644 index 0000000..33b1af7 --- /dev/null +++ b/src/img/ts-icons/default_for_all_bookmarks.svg @@ -0,0 +1,13 @@ + + + + + + + + + + + + + diff --git a/src/img/ts-icons/delete.svg b/src/img/ts-icons/delete.svg new file mode 100644 index 0000000..3131f63 --- /dev/null +++ b/src/img/ts-icons/delete.svg @@ -0,0 +1,12 @@ + + + + + + + + + + + + diff --git a/src/img/ts-icons/delete_avatar.svg b/src/img/ts-icons/delete_avatar.svg new file mode 100644 index 0000000..0cc29bd --- /dev/null +++ b/src/img/ts-icons/delete_avatar.svg @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + diff --git a/src/img/ts-icons/disconnect.svg b/src/img/ts-icons/disconnect.svg new file mode 100644 index 0000000..4a48365 --- /dev/null +++ b/src/img/ts-icons/disconnect.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/img/ts-icons/down.svg b/src/img/ts-icons/down.svg new file mode 100644 index 0000000..b3491c2 --- /dev/null +++ b/src/img/ts-icons/down.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/img/ts-icons/download.svg b/src/img/ts-icons/download.svg new file mode 100644 index 0000000..6495508 --- /dev/null +++ b/src/img/ts-icons/download.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/img/ts-icons/edit.svg b/src/img/ts-icons/edit.svg new file mode 100644 index 0000000..f1b6b6c --- /dev/null +++ b/src/img/ts-icons/edit.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/img/ts-icons/edit_friend_foe_status.svg b/src/img/ts-icons/edit_friend_foe_status.svg new file mode 100644 index 0000000..bc65f90 --- /dev/null +++ b/src/img/ts-icons/edit_friend_foe_status.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/img/ts-icons/emoticon.svg b/src/img/ts-icons/emoticon.svg new file mode 100644 index 0000000..f2b781b --- /dev/null +++ b/src/img/ts-icons/emoticon.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/img/ts-icons/error.svg b/src/img/ts-icons/error.svg new file mode 100644 index 0000000..cd29676 --- /dev/null +++ b/src/img/ts-icons/error.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/img/ts-icons/favorite.svg b/src/img/ts-icons/favorite.svg new file mode 100644 index 0000000..83795d7 --- /dev/null +++ b/src/img/ts-icons/favorite.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/img/ts-icons/file_home.svg b/src/img/ts-icons/file_home.svg new file mode 100644 index 0000000..7e8ee77 --- /dev/null +++ b/src/img/ts-icons/file_home.svg @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + diff --git a/src/img/ts-icons/file_refresh.svg b/src/img/ts-icons/file_refresh.svg new file mode 100644 index 0000000..2e03d61 --- /dev/null +++ b/src/img/ts-icons/file_refresh.svg @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + diff --git a/src/img/ts-icons/filetransfer.svg b/src/img/ts-icons/filetransfer.svg new file mode 100644 index 0000000..6c7c0e7 --- /dev/null +++ b/src/img/ts-icons/filetransfer.svg @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + + diff --git a/src/img/ts-icons/find.svg b/src/img/ts-icons/find.svg new file mode 100644 index 0000000..5d8f1d3 --- /dev/null +++ b/src/img/ts-icons/find.svg @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + diff --git a/src/img/ts-icons/folder.svg b/src/img/ts-icons/folder.svg new file mode 100644 index 0000000..63e2dc6 --- /dev/null +++ b/src/img/ts-icons/folder.svg @@ -0,0 +1,12 @@ + + + + + + + + + + + + diff --git a/src/img/ts-icons/folder_up.svg b/src/img/ts-icons/folder_up.svg new file mode 100644 index 0000000..ee99550 --- /dev/null +++ b/src/img/ts-icons/folder_up.svg @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + diff --git a/src/img/ts-icons/group_100.svg b/src/img/ts-icons/group_100.svg new file mode 100644 index 0000000..6c38145 --- /dev/null +++ b/src/img/ts-icons/group_100.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/img/ts-icons/group_200.svg b/src/img/ts-icons/group_200.svg new file mode 100644 index 0000000..b4c1680 --- /dev/null +++ b/src/img/ts-icons/group_200.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/img/ts-icons/group_300.svg b/src/img/ts-icons/group_300.svg new file mode 100644 index 0000000..947aae8 --- /dev/null +++ b/src/img/ts-icons/group_300.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/img/ts-icons/group_500.svg b/src/img/ts-icons/group_500.svg new file mode 100644 index 0000000..6b22814 --- /dev/null +++ b/src/img/ts-icons/group_500.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/img/ts-icons/group_600.svg b/src/img/ts-icons/group_600.svg new file mode 100644 index 0000000..be8debf --- /dev/null +++ b/src/img/ts-icons/group_600.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/img/ts-icons/guisetup.svg b/src/img/ts-icons/guisetup.svg new file mode 100644 index 0000000..7eec755 --- /dev/null +++ b/src/img/ts-icons/guisetup.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/img/ts-icons/hardware_input_muted.svg b/src/img/ts-icons/hardware_input_muted.svg new file mode 100644 index 0000000..d3a13a7 --- /dev/null +++ b/src/img/ts-icons/hardware_input_muted.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/img/ts-icons/hardware_output_muted.svg b/src/img/ts-icons/hardware_output_muted.svg new file mode 100644 index 0000000..d243996 --- /dev/null +++ b/src/img/ts-icons/hardware_output_muted.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/img/ts-icons/hoster_button.svg b/src/img/ts-icons/hoster_button.svg new file mode 100644 index 0000000..0b22c4a --- /dev/null +++ b/src/img/ts-icons/hoster_button.svg @@ -0,0 +1,27 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/img/ts-icons/hotkeys.svg b/src/img/ts-icons/hotkeys.svg new file mode 100644 index 0000000..d94b349 --- /dev/null +++ b/src/img/ts-icons/hotkeys.svg @@ -0,0 +1,13 @@ + + + + + + + + + + + + + diff --git a/src/img/ts-icons/icon-pack.svg b/src/img/ts-icons/icon-pack.svg new file mode 100644 index 0000000..4786071 --- /dev/null +++ b/src/img/ts-icons/icon-pack.svg @@ -0,0 +1,758 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/img/ts-icons/iconsview.svg b/src/img/ts-icons/iconsview.svg new file mode 100644 index 0000000..603f02d --- /dev/null +++ b/src/img/ts-icons/iconsview.svg @@ -0,0 +1,21 @@ + + + + + + + + + + + + + + + + + + + + + diff --git a/src/img/ts-icons/iconviewer.svg b/src/img/ts-icons/iconviewer.svg new file mode 100644 index 0000000..e65a037 --- /dev/null +++ b/src/img/ts-icons/iconviewer.svg @@ -0,0 +1,18 @@ + + + + + + + + + + + + + + + + + + diff --git a/src/img/ts-icons/identity_default.svg b/src/img/ts-icons/identity_default.svg new file mode 100644 index 0000000..38c8f9b --- /dev/null +++ b/src/img/ts-icons/identity_default.svg @@ -0,0 +1,18 @@ + + + + + + + + + + + + + + + + + + diff --git a/src/img/ts-icons/identity_export.svg b/src/img/ts-icons/identity_export.svg new file mode 100644 index 0000000..dbdce91 --- /dev/null +++ b/src/img/ts-icons/identity_export.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/img/ts-icons/identity_import.svg b/src/img/ts-icons/identity_import.svg new file mode 100644 index 0000000..1691254 --- /dev/null +++ b/src/img/ts-icons/identity_import.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/img/ts-icons/identity_manager.svg b/src/img/ts-icons/identity_manager.svg new file mode 100644 index 0000000..b142f54 --- /dev/null +++ b/src/img/ts-icons/identity_manager.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/img/ts-icons/info.svg b/src/img/ts-icons/info.svg new file mode 100644 index 0000000..80a4588 --- /dev/null +++ b/src/img/ts-icons/info.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/img/ts-icons/input_muted.svg b/src/img/ts-icons/input_muted.svg new file mode 100644 index 0000000..5d851fd --- /dev/null +++ b/src/img/ts-icons/input_muted.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/img/ts-icons/input_muted_local.svg b/src/img/ts-icons/input_muted_local.svg new file mode 100644 index 0000000..63cf2c2 --- /dev/null +++ b/src/img/ts-icons/input_muted_local.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/img/ts-icons/invite_buddy.svg b/src/img/ts-icons/invite_buddy.svg new file mode 100644 index 0000000..648aaff --- /dev/null +++ b/src/img/ts-icons/invite_buddy.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/img/ts-icons/is_talker.svg b/src/img/ts-icons/is_talker.svg new file mode 100644 index 0000000..3cd62b6 --- /dev/null +++ b/src/img/ts-icons/is_talker.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/img/ts-icons/kick_channel.svg b/src/img/ts-icons/kick_channel.svg new file mode 100644 index 0000000..d22f3e5 --- /dev/null +++ b/src/img/ts-icons/kick_channel.svg @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + diff --git a/src/img/ts-icons/kick_server.svg b/src/img/ts-icons/kick_server.svg new file mode 100644 index 0000000..89991c6 --- /dev/null +++ b/src/img/ts-icons/kick_server.svg @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + diff --git a/src/img/ts-icons/listview.svg b/src/img/ts-icons/listview.svg new file mode 100644 index 0000000..4a0b9f0 --- /dev/null +++ b/src/img/ts-icons/listview.svg @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + diff --git a/src/img/ts-icons/loading_image.svg b/src/img/ts-icons/loading_image.svg new file mode 100644 index 0000000..b411697 --- /dev/null +++ b/src/img/ts-icons/loading_image.svg @@ -0,0 +1,31 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/img/ts-icons/message_incoming.svg b/src/img/ts-icons/message_incoming.svg new file mode 100644 index 0000000..5e7bca6 --- /dev/null +++ b/src/img/ts-icons/message_incoming.svg @@ -0,0 +1,12 @@ + + + + + + + + + + + + diff --git a/src/img/ts-icons/message_info.svg b/src/img/ts-icons/message_info.svg new file mode 100644 index 0000000..b7fd779 --- /dev/null +++ b/src/img/ts-icons/message_info.svg @@ -0,0 +1,18 @@ + + + + + + + + + + + + + + + + + + diff --git a/src/img/ts-icons/message_outgoing.svg b/src/img/ts-icons/message_outgoing.svg new file mode 100644 index 0000000..f96edbc --- /dev/null +++ b/src/img/ts-icons/message_outgoing.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/img/ts-icons/messages.svg b/src/img/ts-icons/messages.svg new file mode 100644 index 0000000..78366a5 --- /dev/null +++ b/src/img/ts-icons/messages.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/img/ts-icons/moderated.svg b/src/img/ts-icons/moderated.svg new file mode 100644 index 0000000..34c9672 --- /dev/null +++ b/src/img/ts-icons/moderated.svg @@ -0,0 +1 @@ +M \ No newline at end of file diff --git a/src/img/ts-icons/move_client_to_own_channel.svg b/src/img/ts-icons/move_client_to_own_channel.svg new file mode 100644 index 0000000..8392397 --- /dev/null +++ b/src/img/ts-icons/move_client_to_own_channel.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/img/ts-icons/music.svg b/src/img/ts-icons/music.svg new file mode 100644 index 0000000..5012c32 --- /dev/null +++ b/src/img/ts-icons/music.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/img/ts-icons/new_chat.svg b/src/img/ts-icons/new_chat.svg new file mode 100644 index 0000000..8dde8f7 --- /dev/null +++ b/src/img/ts-icons/new_chat.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/img/ts-icons/notifications.svg b/src/img/ts-icons/notifications.svg new file mode 100644 index 0000000..157f5a7 --- /dev/null +++ b/src/img/ts-icons/notifications.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/img/ts-icons/offline_messages.svg b/src/img/ts-icons/offline_messages.svg new file mode 100644 index 0000000..044e0c5 --- /dev/null +++ b/src/img/ts-icons/offline_messages.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/img/ts-icons/on_whisperlist.svg b/src/img/ts-icons/on_whisperlist.svg new file mode 100644 index 0000000..affd444 --- /dev/null +++ b/src/img/ts-icons/on_whisperlist.svg @@ -0,0 +1,22 @@ + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/img/ts-icons/output_muted.svg b/src/img/ts-icons/output_muted.svg new file mode 100644 index 0000000..d3f8d69 --- /dev/null +++ b/src/img/ts-icons/output_muted.svg @@ -0,0 +1,20 @@ + + + + + + + + + + + + + + + + + + + + diff --git a/src/img/ts-icons/permission_channel.svg b/src/img/ts-icons/permission_channel.svg new file mode 100644 index 0000000..3018212 --- /dev/null +++ b/src/img/ts-icons/permission_channel.svg @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + diff --git a/src/img/ts-icons/permission_client.svg b/src/img/ts-icons/permission_client.svg new file mode 100644 index 0000000..f341d0a --- /dev/null +++ b/src/img/ts-icons/permission_client.svg @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + diff --git a/src/img/ts-icons/permission_overview.svg b/src/img/ts-icons/permission_overview.svg new file mode 100644 index 0000000..f2ba296 --- /dev/null +++ b/src/img/ts-icons/permission_overview.svg @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + diff --git a/src/img/ts-icons/permission_server_groups.svg b/src/img/ts-icons/permission_server_groups.svg new file mode 100644 index 0000000..27cd170 --- /dev/null +++ b/src/img/ts-icons/permission_server_groups.svg @@ -0,0 +1,21 @@ + + + + + + + + + + + + + + + + + + + + + diff --git a/src/img/ts-icons/phoneticsnickname.svg b/src/img/ts-icons/phoneticsnickname.svg new file mode 100644 index 0000000..5625157 --- /dev/null +++ b/src/img/ts-icons/phoneticsnickname.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/img/ts-icons/ping_1.svg b/src/img/ts-icons/ping_1.svg new file mode 100644 index 0000000..fde26e8 --- /dev/null +++ b/src/img/ts-icons/ping_1.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/img/ts-icons/ping_2.svg b/src/img/ts-icons/ping_2.svg new file mode 100644 index 0000000..71d42d7 --- /dev/null +++ b/src/img/ts-icons/ping_2.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/img/ts-icons/ping_3.svg b/src/img/ts-icons/ping_3.svg new file mode 100644 index 0000000..c2d3db3 --- /dev/null +++ b/src/img/ts-icons/ping_3.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/img/ts-icons/ping_4.svg b/src/img/ts-icons/ping_4.svg new file mode 100644 index 0000000..aea8ad8 --- /dev/null +++ b/src/img/ts-icons/ping_4.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/img/ts-icons/ping_calculating.svg b/src/img/ts-icons/ping_calculating.svg new file mode 100644 index 0000000..3850815 --- /dev/null +++ b/src/img/ts-icons/ping_calculating.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/img/ts-icons/ping_disconnected.svg b/src/img/ts-icons/ping_disconnected.svg new file mode 100644 index 0000000..cda924e --- /dev/null +++ b/src/img/ts-icons/ping_disconnected.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/img/ts-icons/play.svg b/src/img/ts-icons/play.svg new file mode 100644 index 0000000..f07fa47 --- /dev/null +++ b/src/img/ts-icons/play.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/img/ts-icons/player_chat.svg b/src/img/ts-icons/player_chat.svg new file mode 100644 index 0000000..a8adbad --- /dev/null +++ b/src/img/ts-icons/player_chat.svg @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + diff --git a/src/img/ts-icons/player_commander_off.svg b/src/img/ts-icons/player_commander_off.svg new file mode 100644 index 0000000..8d9f91c --- /dev/null +++ b/src/img/ts-icons/player_commander_off.svg @@ -0,0 +1,17 @@ + + + + + + + + + + + + + + + + + diff --git a/src/img/ts-icons/player_commander_on.svg b/src/img/ts-icons/player_commander_on.svg new file mode 100644 index 0000000..728951c --- /dev/null +++ b/src/img/ts-icons/player_commander_on.svg @@ -0,0 +1,17 @@ + + + + + + + + + + + + + + + + + diff --git a/src/img/ts-icons/player_off.svg b/src/img/ts-icons/player_off.svg new file mode 100644 index 0000000..73babf6 --- /dev/null +++ b/src/img/ts-icons/player_off.svg @@ -0,0 +1,25 @@ + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/img/ts-icons/player_on.svg b/src/img/ts-icons/player_on.svg new file mode 100644 index 0000000..4bc3047 --- /dev/null +++ b/src/img/ts-icons/player_on.svg @@ -0,0 +1,25 @@ + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/img/ts-icons/player_whisper.svg b/src/img/ts-icons/player_whisper.svg new file mode 100644 index 0000000..2b27f11 --- /dev/null +++ b/src/img/ts-icons/player_whisper.svg @@ -0,0 +1,22 @@ + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/img/ts-icons/plugins.svg b/src/img/ts-icons/plugins.svg new file mode 100644 index 0000000..5db4a5b --- /dev/null +++ b/src/img/ts-icons/plugins.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/img/ts-icons/poke.svg b/src/img/ts-icons/poke.svg new file mode 100644 index 0000000..792d4f9 --- /dev/null +++ b/src/img/ts-icons/poke.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/img/ts-icons/present.svg b/src/img/ts-icons/present.svg new file mode 100644 index 0000000..1a99511 --- /dev/null +++ b/src/img/ts-icons/present.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/img/ts-icons/recording_start.svg b/src/img/ts-icons/recording_start.svg new file mode 100644 index 0000000..1ddae6b --- /dev/null +++ b/src/img/ts-icons/recording_start.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/img/ts-icons/recording_stop.svg b/src/img/ts-icons/recording_stop.svg new file mode 100644 index 0000000..05562e6 --- /dev/null +++ b/src/img/ts-icons/recording_stop.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/img/ts-icons/refresh.svg b/src/img/ts-icons/refresh.svg new file mode 100644 index 0000000..ea89ba0 --- /dev/null +++ b/src/img/ts-icons/refresh.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/img/ts-icons/register.svg b/src/img/ts-icons/register.svg new file mode 100644 index 0000000..cda2f01 --- /dev/null +++ b/src/img/ts-icons/register.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/img/ts-icons/reload.svg b/src/img/ts-icons/reload.svg new file mode 100644 index 0000000..5d80daf --- /dev/null +++ b/src/img/ts-icons/reload.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/img/ts-icons/remove_foe.svg b/src/img/ts-icons/remove_foe.svg new file mode 100644 index 0000000..e6ba03b --- /dev/null +++ b/src/img/ts-icons/remove_foe.svg @@ -0,0 +1,18 @@ + + + + + + + + + + + + + + + + + + diff --git a/src/img/ts-icons/remove_friend.svg b/src/img/ts-icons/remove_friend.svg new file mode 100644 index 0000000..a9995e7 --- /dev/null +++ b/src/img/ts-icons/remove_friend.svg @@ -0,0 +1,18 @@ + + + + + + + + + + + + + + + + + + diff --git a/src/img/ts-icons/security.svg b/src/img/ts-icons/security.svg new file mode 100644 index 0000000..02d1af6 --- /dev/null +++ b/src/img/ts-icons/security.svg @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git a/src/img/ts-icons/select_all.svg b/src/img/ts-icons/select_all.svg new file mode 100644 index 0000000..fe327a8 --- /dev/null +++ b/src/img/ts-icons/select_all.svg @@ -0,0 +1,36 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/img/ts-icons/send.svg b/src/img/ts-icons/send.svg new file mode 100644 index 0000000..9239f63 --- /dev/null +++ b/src/img/ts-icons/send.svg @@ -0,0 +1,24 @@ + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/img/ts-icons/send_complaint.svg b/src/img/ts-icons/send_complaint.svg new file mode 100644 index 0000000..f62b0fa --- /dev/null +++ b/src/img/ts-icons/send_complaint.svg @@ -0,0 +1,31 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/img/ts-icons/server_green.svg b/src/img/ts-icons/server_green.svg new file mode 100644 index 0000000..5be59aa --- /dev/null +++ b/src/img/ts-icons/server_green.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/img/ts-icons/server_log.svg b/src/img/ts-icons/server_log.svg new file mode 100644 index 0000000..b888795 --- /dev/null +++ b/src/img/ts-icons/server_log.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/img/ts-icons/server_query.svg b/src/img/ts-icons/server_query.svg new file mode 100644 index 0000000..ce1ce41 --- /dev/null +++ b/src/img/ts-icons/server_query.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/img/ts-icons/settings.svg b/src/img/ts-icons/settings.svg new file mode 100644 index 0000000..3dbe233 --- /dev/null +++ b/src/img/ts-icons/settings.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/img/ts-icons/sort_by_name.svg b/src/img/ts-icons/sort_by_name.svg new file mode 100644 index 0000000..62c7328 --- /dev/null +++ b/src/img/ts-icons/sort_by_name.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/img/ts-icons/sound-pack.svg b/src/img/ts-icons/sound-pack.svg new file mode 100644 index 0000000..bfbb532 --- /dev/null +++ b/src/img/ts-icons/sound-pack.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/img/ts-icons/soundpack.svg b/src/img/ts-icons/soundpack.svg new file mode 100644 index 0000000..0bb4609 --- /dev/null +++ b/src/img/ts-icons/soundpack.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/img/ts-icons/subscribe_mode.svg b/src/img/ts-icons/subscribe_mode.svg new file mode 100644 index 0000000..1c04079 --- /dev/null +++ b/src/img/ts-icons/subscribe_mode.svg @@ -0,0 +1,18 @@ + + + + + + + + + + + + + + + + + + diff --git a/src/img/ts-icons/subscribe_to_all_channels.svg b/src/img/ts-icons/subscribe_to_all_channels.svg new file mode 100644 index 0000000..b6614e7 --- /dev/null +++ b/src/img/ts-icons/subscribe_to_all_channels.svg @@ -0,0 +1,18 @@ + + + + + + + + + + + + + + + + + + diff --git a/src/img/ts-icons/subscribe_to_channel.svg b/src/img/ts-icons/subscribe_to_channel.svg new file mode 100644 index 0000000..6e0d41e --- /dev/null +++ b/src/img/ts-icons/subscribe_to_channel.svg @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + diff --git a/src/img/ts-icons/subscribe_to_channel_family.svg b/src/img/ts-icons/subscribe_to_channel_family.svg new file mode 100644 index 0000000..a880f14 --- /dev/null +++ b/src/img/ts-icons/subscribe_to_channel_family.svg @@ -0,0 +1,18 @@ + + + + + + + + + + + + + + + + + + diff --git a/src/img/ts-icons/switch_advanced.svg b/src/img/ts-icons/switch_advanced.svg new file mode 100644 index 0000000..a5fd538 --- /dev/null +++ b/src/img/ts-icons/switch_advanced.svg @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + diff --git a/src/img/ts-icons/switch_standard.svg b/src/img/ts-icons/switch_standard.svg new file mode 100644 index 0000000..15bf4a9 --- /dev/null +++ b/src/img/ts-icons/switch_standard.svg @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + diff --git a/src/img/ts-icons/sync-disable.svg b/src/img/ts-icons/sync-disable.svg new file mode 100644 index 0000000..f53386b --- /dev/null +++ b/src/img/ts-icons/sync-disable.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/img/ts-icons/sync-enable.svg b/src/img/ts-icons/sync-enable.svg new file mode 100644 index 0000000..94d6e72 --- /dev/null +++ b/src/img/ts-icons/sync-enable.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/img/ts-icons/sync-icon.svg b/src/img/ts-icons/sync-icon.svg new file mode 100644 index 0000000..7406c3e --- /dev/null +++ b/src/img/ts-icons/sync-icon.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/img/ts-icons/tab_close_button.svg b/src/img/ts-icons/tab_close_button.svg new file mode 100644 index 0000000..1eaf954 --- /dev/null +++ b/src/img/ts-icons/tab_close_button.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/img/ts-icons/talk_power_grant.svg b/src/img/ts-icons/talk_power_grant.svg new file mode 100644 index 0000000..078bbb4 --- /dev/null +++ b/src/img/ts-icons/talk_power_grant.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/img/ts-icons/talk_power_grant_next.svg b/src/img/ts-icons/talk_power_grant_next.svg new file mode 100644 index 0000000..cfc5f20 --- /dev/null +++ b/src/img/ts-icons/talk_power_grant_next.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/img/ts-icons/talk_power_request.svg b/src/img/ts-icons/talk_power_request.svg new file mode 100644 index 0000000..6c9d1b6 --- /dev/null +++ b/src/img/ts-icons/talk_power_request.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/img/ts-icons/talk_power_request_cancel.svg b/src/img/ts-icons/talk_power_request_cancel.svg new file mode 100644 index 0000000..6c663fa --- /dev/null +++ b/src/img/ts-icons/talk_power_request_cancel.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/img/ts-icons/talk_power_revoke.svg b/src/img/ts-icons/talk_power_revoke.svg new file mode 100644 index 0000000..1e207a8 --- /dev/null +++ b/src/img/ts-icons/talk_power_revoke.svg @@ -0,0 +1,18 @@ + + + + + + + + + + + + + + + + + + diff --git a/src/img/ts-icons/talk_power_revoke_all_grant_next.svg b/src/img/ts-icons/talk_power_revoke_all_grant_next.svg new file mode 100644 index 0000000..a922733 --- /dev/null +++ b/src/img/ts-icons/talk_power_revoke_all_grant_next.svg @@ -0,0 +1,21 @@ + + + + + + + + + + + + + + + + + + + + + diff --git a/src/img/ts-icons/temp_server_password.svg b/src/img/ts-icons/temp_server_password.svg new file mode 100644 index 0000000..53d009a --- /dev/null +++ b/src/img/ts-icons/temp_server_password.svg @@ -0,0 +1,18 @@ + + + + + + + + + + + + + + + + + + diff --git a/src/img/ts-icons/temp_server_password_add.svg b/src/img/ts-icons/temp_server_password_add.svg new file mode 100644 index 0000000..fe7af9b --- /dev/null +++ b/src/img/ts-icons/temp_server_password_add.svg @@ -0,0 +1,18 @@ + + + + + + + + + + + + + + + + + + diff --git a/src/img/ts-icons/textformat.svg b/src/img/ts-icons/textformat.svg new file mode 100644 index 0000000..ece8449 --- /dev/null +++ b/src/img/ts-icons/textformat.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/img/ts-icons/textformat_bold.svg b/src/img/ts-icons/textformat_bold.svg new file mode 100644 index 0000000..96eaa41 --- /dev/null +++ b/src/img/ts-icons/textformat_bold.svg @@ -0,0 +1,12 @@ + + + + + + + + + + + + diff --git a/src/img/ts-icons/textformat_foreground.svg b/src/img/ts-icons/textformat_foreground.svg new file mode 100644 index 0000000..826ec09 --- /dev/null +++ b/src/img/ts-icons/textformat_foreground.svg @@ -0,0 +1,12 @@ + + + + + + + + + + + + diff --git a/src/img/ts-icons/textformat_italic.svg b/src/img/ts-icons/textformat_italic.svg new file mode 100644 index 0000000..757ff5a --- /dev/null +++ b/src/img/ts-icons/textformat_italic.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/img/ts-icons/textformat_underline.svg b/src/img/ts-icons/textformat_underline.svg new file mode 100644 index 0000000..67cd948 --- /dev/null +++ b/src/img/ts-icons/textformat_underline.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/img/ts-icons/theme.svg b/src/img/ts-icons/theme.svg new file mode 100644 index 0000000..bec2431 --- /dev/null +++ b/src/img/ts-icons/theme.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/img/ts-icons/toggle_server_query_clients.svg b/src/img/ts-icons/toggle_server_query_clients.svg new file mode 100644 index 0000000..b629e80 --- /dev/null +++ b/src/img/ts-icons/toggle_server_query_clients.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/img/ts-icons/toggle_whisper.svg b/src/img/ts-icons/toggle_whisper.svg new file mode 100644 index 0000000..8b6a356 --- /dev/null +++ b/src/img/ts-icons/toggle_whisper.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/img/ts-icons/token.svg b/src/img/ts-icons/token.svg new file mode 100644 index 0000000..fbb7266 --- /dev/null +++ b/src/img/ts-icons/token.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/img/ts-icons/token_use.svg b/src/img/ts-icons/token_use.svg new file mode 100644 index 0000000..5ac14a4 --- /dev/null +++ b/src/img/ts-icons/token_use.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/img/ts-icons/translation.svg b/src/img/ts-icons/translation.svg new file mode 100644 index 0000000..baa184b --- /dev/null +++ b/src/img/ts-icons/translation.svg @@ -0,0 +1,18 @@ + + + + + + + + + + + + + + + + + + diff --git a/src/img/ts-icons/unsubscribe_from_all_channels.svg b/src/img/ts-icons/unsubscribe_from_all_channels.svg new file mode 100644 index 0000000..a0aeabe --- /dev/null +++ b/src/img/ts-icons/unsubscribe_from_all_channels.svg @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + diff --git a/src/img/ts-icons/unsubscribe_from_channel_family.svg b/src/img/ts-icons/unsubscribe_from_channel_family.svg new file mode 100644 index 0000000..31d3a7f --- /dev/null +++ b/src/img/ts-icons/unsubscribe_from_channel_family.svg @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + diff --git a/src/img/ts-icons/unsubscribe_mode.svg b/src/img/ts-icons/unsubscribe_mode.svg new file mode 100644 index 0000000..b2f6286 --- /dev/null +++ b/src/img/ts-icons/unsubscribe_mode.svg @@ -0,0 +1,18 @@ + + + + + + + + + + + + + + + + + + diff --git a/src/img/ts-icons/up.svg b/src/img/ts-icons/up.svg new file mode 100644 index 0000000..2b90efb --- /dev/null +++ b/src/img/ts-icons/up.svg @@ -0,0 +1,12 @@ + + + + + + + + + + + + diff --git a/src/img/ts-icons/upload.svg b/src/img/ts-icons/upload.svg new file mode 100644 index 0000000..ec2a733 --- /dev/null +++ b/src/img/ts-icons/upload.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/img/ts-icons/upload_avatar.svg b/src/img/ts-icons/upload_avatar.svg new file mode 100644 index 0000000..588108f --- /dev/null +++ b/src/img/ts-icons/upload_avatar.svg @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + diff --git a/src/img/ts-icons/urlcatcher.svg b/src/img/ts-icons/urlcatcher.svg new file mode 100644 index 0000000..11cc519 --- /dev/null +++ b/src/img/ts-icons/urlcatcher.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/img/ts-icons/user-account.svg b/src/img/ts-icons/user-account.svg new file mode 100644 index 0000000..97a787c --- /dev/null +++ b/src/img/ts-icons/user-account.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/img/ts-icons/virtualserver_edit.svg b/src/img/ts-icons/virtualserver_edit.svg new file mode 100644 index 0000000..573389c --- /dev/null +++ b/src/img/ts-icons/virtualserver_edit.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/img/ts-icons/volume.svg b/src/img/ts-icons/volume.svg new file mode 100644 index 0000000..dfc0e19 --- /dev/null +++ b/src/img/ts-icons/volume.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/img/ts-icons/warning.svg b/src/img/ts-icons/warning.svg new file mode 100644 index 0000000..42f7bd9 --- /dev/null +++ b/src/img/ts-icons/warning.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/img/ts-icons/warning_error.svg b/src/img/ts-icons/warning_error.svg new file mode 100644 index 0000000..56b0d01 --- /dev/null +++ b/src/img/ts-icons/warning_error.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/img/ts-icons/warning_external_link.svg b/src/img/ts-icons/warning_external_link.svg new file mode 100644 index 0000000..3946ca3 --- /dev/null +++ b/src/img/ts-icons/warning_external_link.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/img/ts-icons/weblist.svg b/src/img/ts-icons/weblist.svg new file mode 100644 index 0000000..ae3732f --- /dev/null +++ b/src/img/ts-icons/weblist.svg @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + diff --git a/src/img/ts-icons/whisper.svg b/src/img/ts-icons/whisper.svg new file mode 100644 index 0000000..f88cac8 --- /dev/null +++ b/src/img/ts-icons/whisper.svg @@ -0,0 +1,18 @@ + + + + + + + + + + + + + + + + + + diff --git a/src/img/ts-icons/whisperlists.svg b/src/img/ts-icons/whisperlists.svg new file mode 100644 index 0000000..b027de0 --- /dev/null +++ b/src/img/ts-icons/whisperlists.svg @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/imprint.php b/src/imprint.php new file mode 100644 index 0000000..35a6eb6 --- /dev/null +++ b/src/imprint.php @@ -0,0 +1,13 @@ + "Page", + "paneltitle" => 'Imprint', + "panelcontent" => "Imprint in HTML for countries that require it" +]; + +TemplateUtils::i()->renderTemplate("simple-page", $data); diff --git a/src/index.php b/src/index.php new file mode 100644 index 0000000..c5b0405 --- /dev/null +++ b/src/index.php @@ -0,0 +1,37 @@ +getNewsCount(); +$pageCount = (int) ceil($newsCount / $perPage); +$newsList = []; + +// Fetch the news if we are on page 1 or higher +// pages 0 or lower are invalid. Otherwise newsList will be NULL +// and the template will show an invalid page message +if ($page >= 1) { + try { + $newsList = $newsStore->getNewsList($perPage, ($page - 1) * $perPage); + } catch (\Exception $e) { + $newsList = false; + } +} + +TemplateUtils::i()->renderTemplate("index", [ + "newsCount" => $newsCount, + "pageCount" => $pageCount, + "newsList" => $newsList, + "currentPage" => $page, +]); diff --git a/src/installer/cache/.gitkeep b/src/installer/cache/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/src/installer/dbinstall_mysql.sql b/src/installer/dbinstall_mysql.sql new file mode 100644 index 0000000..6cfd429 --- /dev/null +++ b/src/installer/dbinstall_mysql.sql @@ -0,0 +1,340 @@ +SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO"; +SET AUTOCOMMIT = 0; +START TRANSACTION; +SET time_zone = "+00:00"; + +DROP TABLE IF EXISTS `tsw_config`; +CREATE TABLE `tsw_config` ( + `identifier` varchar(128) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `type` varchar(16) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'STRING' COMMENT 'STRING, INT, FLOAT, BOOL, JSON', + `value` text COLLATE utf8mb4_unicode_ci, + `user_editable` tinyint(1) NOT NULL DEFAULT '1' +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; + +INSERT INTO `tsw_config` (`identifier`, `type`, `value`, `user_editable`) VALUES +('cache_servericons', 'INT', '600', 1), +('onlinerecord_value', 'INT', '0', 0), +('onlinerecord_date', 'INT', '0', 0), +('usingcloudflare', 'BOOL', 'false', 1), +('loginpokeclient', 'BOOL', 'true', 1), +('cache_logincode', 'INT', '120', 1), +('cache_adminstatus', 'INT', '60', 1), +('adminstatus_groups', 'JSON', '[]', 1), +('adminstatus_mode', 'INT', '2', 1), +('adminstatus_enabled', 'BOOL', 'true', 1), +('adminstatus_hideoffline', 'BOOL', 'false', 1), +('adminstatus_ignoredusers', 'JSON', '[]', 1), +('assignerconfig', 'JSON', '[]', 1), +('query_nickname', 'STRING', 'TS-website', 1), +('cache_serverinfo', 'INT', '10', 1), +('cache_banlist', 'INT', '60', 1), +('cache_clientlist', 'INT', '15', 1), +('cache_channelist', 'INT', '60', 1), +('cache_servergroups', 'INT', '60', 1), +('cache_channelgroups', 'INT', '60', 1), +('adminstatus_offlinehiddenbydefault', 'BOOL', 'false', 1), +('imprint_enabled', 'BOOL', 'false', 1), +('imprint_url', 'STRING', 'imprint.php', 1); + +DROP TABLE IF EXISTS `tsw_faq`; +CREATE TABLE `tsw_faq` ( + `faqid` int(11) NOT NULL, + `langid` int(11) NOT NULL DEFAULT '1', + `question` text COLLATE utf8mb4_unicode_ci NOT NULL, + `answer` longtext COLLATE utf8mb4_unicode_ci NOT NULL, + `lastmodify` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; + +INSERT INTO `tsw_faq` (`faqid`, `langid`, `question`, `answer`, `lastmodify`) VALUES +(1, 1, 'What is the FAQ?', 'FAQ section allows you to show frequently asked questions and answers to them.', '2018-12-26 13:10:32'), +(2, 1, 'How can I configure the FAQ?', 'An administrator can add, edit and remove questions in admin panel.', '2018-12-26 12:33:18'), +(3, 1, 'Question 3', 'Answer 3 in HTML', '2018-12-26 13:10:32'); + +DROP TABLE IF EXISTS `tsw_languages`; +CREATE TABLE `tsw_languages` ( + `langid` int(11) NOT NULL, + `englishname` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, + `nativename` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, + `langcode` varchar(10) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT 'In this format: https://bit.ly/2MCGg6M', + `isdefault` tinyint(1) NOT NULL DEFAULT '0' +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; + +INSERT INTO `tsw_languages` (`langid`, `englishname`, `nativename`, `langcode`, `isdefault`) VALUES +(1, 'English', 'English', 'en', 1), +(2, 'English (US)', 'English (US)', 'en-us', 0), +(3, 'Polish', 'Polski', 'pl', 0); + +DROP TABLE IF EXISTS `tsw_news`; +CREATE TABLE `tsw_news` ( + `newsid` int(11) NOT NULL, + `title` text COLLATE utf8mb4_unicode_ci NOT NULL, + `langid` int(11) NOT NULL DEFAULT '1', + `added` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, + `edited` timestamp NULL DEFAULT NULL, + `content` longtext COLLATE utf8mb4_unicode_ci NOT NULL +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; + +INSERT INTO `tsw_news` (`newsid`, `title`, `langid`, `added`, `edited`, `content`) VALUES +(1, 'Welcome to ts-website!', 1, '2018-12-26 13:10:32', NULL, 'Hi there! If you are reading this, it means that TS-website has been installed successfully.
\r\nYou can login to your ACP to configure many parts of it.
\r\nNeed help? Join our Telegram group for support.\r\nHave a good day!'); + +DROP TABLE IF EXISTS `tsw_translations`; +CREATE TABLE `tsw_translations` ( + `id` int(10) NOT NULL, + `langid` int(10) NOT NULL, + `identifier` varchar(128) COLLATE utf8mb4_unicode_ci NOT NULL, + `value` text COLLATE utf8mb4_unicode_ci NOT NULL, + `comment` text COLLATE utf8mb4_unicode_ci +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; + +INSERT INTO `tsw_translations` (`id`, `langid`, `identifier`, `value`, `comment`) VALUES +(1, 1, 'AUTHORS', 'Wruczek ', 'Language authors'), +(2, 3, 'AUTHORS', 'Wruczek ', NULL), +(3, 1, 'COOKIEALERT_MESSAGE', 'Do you like cookies? 🍪 We use cookies to ensure you get the best experience on our website. Learn more', 'Remember to change link to a website in your language'), +(4, 3, 'COOKIEALERT_MESSAGE', 'Lubisz ciasteczka? 🍪 Używamy ciasteczek, aby zapewnić najwyższą jakość usług. Dowiedz się więcej', NULL), +(5, 1, 'COOKIEALERT_AGREE', 'I agree', NULL), +(6, 3, 'COOKIEALERT_AGREE', 'Zgadzam się', NULL), +(7, 1, 'OUTDATED_DATA', 'Warning! Some information cannot be obtained now. Showing outdated data from {0}.', '{0} will be replaced with fuzzy date (for example \"8 hours ago\"). Please try to match the your message grammatically'), +(8, 3, 'OUTDATED_DATA', 'Uwaga! Niektóre dane nie mogą być teraz uzyskane. Pokazuje nieaktualne dane z {0}.', NULL), +(9, 1, 'SHOW_PROBLEMS', 'Show problems', NULL), +(10, 3, 'SHOW_PROBLEMS', 'Pokaż problemy', NULL), +(11, 1, 'PROBLEMS_DESCRIPTION', 'Problems encountered while connecting to the TeamSpeak server', NULL), +(12, 3, 'PROBLEMS_DESCRIPTION', 'Problemy napotkane podczas próby połączenia się z serwerem TeamSpeak', NULL), +(13, 1, 'NO_JAVASCRIPT_ENABLED', 'This website will not work without JavaScript enabled.', 'Remember to change the website address to include instructions in your language'), +(14, 3, 'NO_JAVASCRIPT_ENABLED', 'Ta stronie nie będzie działać bez włączonej obsługi JavaScript.', NULL), +(15, 1, 'CANNOT_GET_DATA', 'Cannot get data for \"{0}\"! Please contact website owner.', '{0} will be replaced with component name that cannot be refreshed (for example banlist or viewer)'), +(16, 3, 'CANNOT_GET_DATA', 'Nie mogę pobrać informacji o \"{0}\"! Skontaktuj się z właścicielem strony.', NULL), +(17, 1, 'NO_REASON_SET', '(no reason set)', 'Please keep the \"\" tags in place, as they help to distinguish a placeholder form a real message'), +(18, 3, 'NO_REASON_SET', '(brak powodu)', NULL), +(19, 1, 'BANS_HEADER_NAME', 'Name / IP / UID', NULL), +(20, 3, 'BANS_HEADER_NAME', 'Nazwa / IP / UID', NULL), +(21, 1, 'BANS_HEADER_REASON', 'Reason', NULL), +(22, 3, 'BANS_HEADER_REASON', 'Powód', NULL), +(23, 1, 'BANS_HEADER_INVOKER', 'Banned by', NULL), +(24, 3, 'BANS_HEADER_INVOKER', 'Zbanowany przez', NULL), +(25, 1, 'BANS_HEADER_BANDATE', 'Ban date', NULL), +(26, 3, 'BANS_HEADER_BANDATE', 'Data zbanowania', NULL), +(27, 1, 'BANS_HEADER_EXPIRES', 'Expires', NULL), +(28, 3, 'BANS_HEADER_EXPIRES', 'Wygasa', NULL), +(29, 1, 'DATATABLES_LANGUAGE_NAME', 'English', 'This language will be used to load language file for DataTables. Please choose a language from this list: https://datatables.net/plug-ins/i18n/#Translations.\r\n\r\nIf chosen correctly, this url: \"//cdn.datatables.net/plug-ins/1.10.12/i18n/{NAME}.json\" should return a valid JSON object with translations. For example: \"//cdn.datatables.net/plug-ins/1.10.12/i18n/English.json\"'), +(30, 3, 'DATATABLES_LANGUAGE_NAME', 'Polish', NULL), +(31, 1, 'BANS_NEVEREXPIRES', 'Never', NULL), +(32, 3, 'BANS_NEVEREXPIRES', 'Nigdy', NULL), +(33, 1, 'STATUS_ADDRESS', 'Address:', ''), +(34, 3, 'STATUS_ADDRESS', 'Adres:', NULL), +(35, 1, 'STATUS_CLIENTS_ONLINE', 'Online:', NULL), +(36, 3, 'STATUS_CLIENTS_ONLINE', 'Online:', NULL), +(37, 1, 'STATUS_RESERVED_SLOTS', '{0} reserved slots', NULL), +(38, 3, 'STATUS_RESERVED_SLOTS', '{0} zarezerwowanych slotów', NULL), +(39, 1, 'STATUS_TOP_ONLINE', 'Top online:', NULL), +(40, 3, 'STATUS_TOP_ONLINE', 'Rekord online:', NULL), +(41, 1, 'STATUS_TOP_ONLINE_DESC', 'Achieved on {0}', NULL), +(42, 3, 'STATUS_TOP_ONLINE_DESC', 'Ustanowiono {0}', NULL), +(43, 1, 'STATUS_UPTIME', 'Uptime:', NULL), +(44, 3, 'STATUS_UPTIME', 'Uptime:', NULL), +(45, 1, 'STATUS_VERSION', 'Version:', NULL), +(46, 3, 'STATUS_VERSION', 'Wersja:', NULL), +(47, 1, 'STATUS_VERSION_DESC', '{0} on {1}', NULL), +(48, 3, 'STATUS_VERSION_DESC', '{0} na {1}', NULL), +(49, 1, 'STATUS_PING', 'Avg. ping:', NULL), +(50, 3, 'STATUS_PING', 'Śr. ping:', NULL), +(51, 1, 'STATUS_PACKETLOSS', 'Avg. packet loss:', NULL), +(52, 3, 'STATUS_PACKETLOSS', 'Śr. utrata pakietów:', NULL), +(53, 1, 'STATUS_ERROR', 'Cannot retrieve server status', NULL), +(54, 3, 'STATUS_ERROR', 'Błąd podczas wczytywania statusu serwera', NULL), +(55, 1, 'STATUS_PANEL_TITLE', 'Server status', NULL), +(56, 3, 'STATUS_PANEL_TITLE', 'Status serwera', NULL), +(57, 1, 'MOMENTJS_LANG', 'en-gb', 'Language for Moment.js, full list: https://github.com/moment/moment/tree/develop/locale'), +(58, 2, 'MOMENTJS_LANG', 'en-us', NULL), +(59, 3, 'MOMENTJS_LANG', 'pl', NULL), +(60, 1, 'LOGIN_CONFIRMATION_CODE', 'Hi, here\'s your confirmation code to login: [b]{0}[/b]', 'You can use BBCode. Use {0} for the confirmation code.'), +(61, 3, 'LOGIN_CONFIRMATION_CODE', 'Cześć, oto twój kod potwierdzający logowanie: [b]{0}[/b]', NULL), +(62, 1, 'UNSUPPORTED_BROWSER', 'Your browser is not supported. Please switch to the latest version of Chrome, Firefox, Safari or Edge to use this website.', ''), +(63, 3, 'UNSUPPORTED_BROWSER', 'Twoja przeglądarka nie jest wspierana. Zainstaluj najnowszą wersję Chrome, Firefox, Safari lub Edge by korzystać z tej strony.', NULL), +(64, 1, 'DATATABLES_PLACEHOLDER_SEARCH', 'Search...', NULL), +(65, 3, 'DATATABLES_PLACEHOLDER_SEARCH', 'Szukaj...', NULL), +(66, 1, 'WEBSITE_TITLE', ' | TS-website English Language', NULL), +(67, 3, 'WEBSITE_TITLE', ' | TS-website Język Polski', NULL), +(68, 1, 'ADMIN_STATUS_ONLINE', 'Online', NULL), +(69, 3, 'ADMIN_STATUS_ONLINE', 'Online', NULL), +(70, 1, 'ADMIN_STATUS_AWAY', 'Away', NULL), +(71, 3, 'ADMIN_STATUS_AWAY', 'Zaraz wracam', NULL), +(72, 1, 'ADMIN_STATUS_OFFLINE', 'Offline', NULL), +(73, 3, 'ADMIN_STATUS_OFFLINE', 'Offline', NULL), +(76, 1, 'ADMIN_STATUS_EMPTY_GROUP', 'Nothing to show', NULL), +(77, 3, 'ADMIN_STATUS_EMPTY_GROUP', 'Nic do pokazania', NULL), +(78, 1, 'ADMIN_STATUS_EMPTY_STATUS', 'Admin status is empty', NULL), +(79, 3, 'ADMIN_STATUS_EMPTY_STATUS', 'Status administracji jest pusty', NULL), +(80, 1, 'ASSIGNER_PANEL_TITLE', 'Group assigner', NULL), +(81, 3, 'ASSIGNER_PANEL_TITLE', 'Przydzielanie grup', NULL), +(82, 1, 'ASSIGNER_TITLE', 'Group assigner', NULL), +(83, 3, 'ASSIGNER_TITLE', 'Przydzielanie grup', NULL), +(84, 1, 'BANS_EMPTY', 'Banlist is empty', NULL), +(85, 3, 'BANS_EMPTY', 'Lista banów jest pusta', NULL), +(86, 1, 'BANS_TITLE', 'Banlist', NULL), +(87, 3, 'BANS_TITLE', 'Lista banów', NULL), +(88, 1, 'BANS_PANEL_TITLE', 'Banlist', NULL), +(89, 3, 'BANS_PANEL_TITLE', 'Lista banów', NULL), +(90, 1, 'BANS_BANNED_ALERT_TITLE', 'Your IP has been banned by {0}', NULL), +(91, 3, 'BANS_BANNED_ALERT_TITLE', 'Twoje IP zostało zbanowane przez {0}', NULL), +(92, 1, 'BANS_BANNED_ALERT_REASON', 'Reason: {0}', NULL), +(93, 3, 'BANS_BANNED_ALERT_REASON', 'Powód: {0}', NULL), +(94, 1, 'BANS_VIEW_MORE_TIP', 'Click on a row to view more details about a ban', NULL), +(95, 3, 'BANS_VIEW_MORE_TIP', 'Kliknij na wiersz by pokazać więcej informacji o banie', NULL), +(96, 1, 'RULES_TITLE', 'Rules', NULL), +(97, 3, 'RULES_TITLE', 'Regulamin', NULL), +(98, 1, 'RULES_PANEL_TITLE', 'Rules', NULL), +(99, 3, 'RULES_PANEL_TITLE', 'Regulamin', NULL), +(100, 1, 'FAQ_COPY_LINK', 'Copy link to that answer', NULL), +(101, 3, 'FAQ_COPY_LINK', 'Kopiuj link do tej odpowiedzi', NULL), +(102, 1, 'FAQ_PANEL_TITLE', 'FAQ', NULL), +(103, 3, 'FAQ_PANEL_TITLE', 'FAQ', NULL), +(104, 1, 'FAQ_TITLE', 'FAQ', NULL), +(105, 3, 'FAQ_TITLE', 'FAQ', NULL), +(106, 1, 'FAQ_COPY_LINK_SUCCESS', 'Copied!', NULL), +(107, 3, 'FAQ_COPY_LINK_SUCCESS', 'Skopiowano!', NULL), +(108, 1, 'FAQ_COPY_LINK_ERROR', 'Error!', NULL), +(109, 3, 'FAQ_COPY_LINK_ERROR', 'Błąd!', NULL), +(110, 1, 'HOME_TITLE', 'News', NULL), +(111, 3, 'HOME_TITLE', 'Aktualności', NULL), +(112, 1, 'HOME_PANEL_TITLE', 'News', NULL), +(113, 3, 'HOME_PANEL_TITLE', 'Aktualności', NULL), +(114, 1, 'HOME_EMPTY', 'No news available at this moment', NULL), +(115, 3, 'HOME_EMPTY', 'Brak atualności', NULL), +(116, 1, 'HOME_INVALID_PAGE', 'Invalid page number', NULL), +(117, 3, 'HOME_INVALID_PAGE', 'Zły numer strony', NULL), +(118, 1, 'HOME_PREVIOUS_NEWS', 'Previous', 'This value is only used by assistive technologies (screen readers ect.)'), +(119, 3, 'HOME_PREVIOUS_NEWS', 'Poprzednia', NULL), +(120, 1, 'HOME_NEXT_NEWS', 'Next', 'This value is only used by assistive technologies (screen readers ect.)'), +(121, 3, 'HOME_NEXT_NEWS', 'Następna', NULL), +(122, 1, 'ADMIN_STATUS_PANEL_TITLE', 'Admin status', NULL), +(123, 3, 'ADMIN_STATUS_PANEL_TITLE', 'Status administracji', NULL), +(124, 1, 'ADMIN_STATUS_HIDE_OFFLINE_TIP', 'Hide offline admins', NULL), +(125, 3, 'ADMIN_STATUS_HIDE_OFFLINE_TIP', 'Ukryj administratorów offline', NULL), +(126, 1, 'ADMIN_STATUS_SHOW_OFFLINE_TIP', 'Show offline admins', NULL), +(127, 3, 'ADMIN_STATUS_SHOW_OFFLINE_TIP', 'Pokaż administratorów offline', NULL), +(128, 1, 'ADMIN_STATUS_ERROR', 'Admin status error', NULL), +(129, 3, 'ADMIN_STATUS_ERROR', 'Błąd statusu administracji', NULL), +(130, 1, 'NAV_TOGGLE', 'Toggle navigation', 'This value is only used by assistive technologies (screen readers ect.)'), +(131, 3, 'NAV_TOGGLE', 'Przełącz nawigację', NULL), +(132, 1, 'NAV_VIEWER', 'Viewer', NULL), +(133, 3, 'NAV_VIEWER', 'Podgląd', NULL), +(134, 1, 'NAV_ASSIGNER', 'Assigner', NULL), +(135, 3, 'NAV_ASSIGNER', 'Grupy', NULL), +(136, 1, 'NAV_BANS', 'Bans', NULL), +(137, 3, 'NAV_BANS', 'Bany', NULL), +(138, 1, 'NAV_RULES', 'Rules', NULL), +(139, 3, 'NAV_RULES', 'Regulamin', NULL), +(140, 1, 'NAV_FAQ', 'FAQ', NULL), +(141, 3, 'NAV_FAQ', 'FAQ', NULL), +(142, 1, 'NAV_ACCOUNT_LOGIN', 'Login', NULL), +(143, 3, 'NAV_ACCOUNT_LOGIN', 'Zaloguj się', NULL), +(144, 1, 'NAV_ACCOUNT_LOGOUT', 'Logout', NULL), +(145, 3, 'NAV_ACCOUNT_LOGOUT', 'Wyloguj się', NULL), +(146, 1, 'VIEWER_TITLE', 'Server viewer', NULL), +(147, 3, 'VIEWER_TITLE', 'Podgląd serwera', NULL), +(148, 1, 'VIEWER_PANEL_TITLE', 'Server viewer', NULL), +(149, 3, 'VIEWER_PANEL_TITLE', 'Podgląd serwera', NULL), +(150, 1, 'VIEWER_SHOW_EMPTY', 'Show empty channels', NULL), +(151, 3, 'VIEWER_SHOW_EMPTY', 'Pokaż puste kanały', NULL), +(152, 1, 'VIEWER_HIDE_EMPTY', 'Hide empty channels', NULL), +(153, 3, 'VIEWER_HIDE_EMPTY', 'Ukryj puste kanały', NULL), +(154, 1, 'VIEWER_TIP_ALERT', 'Click on a channel to join it. Hover over a user to check their info', NULL), +(155, 3, 'VIEWER_TIP_ALERT', 'Kliknij na kanał, by na niego dołączyć. Nakieruj na użytkownika, by sprawdzić informacje o nim', NULL), +(158, 1, 'ARIA_CLOSE', 'Close', 'This value is only used by assistive technologies (screen readers ect.)'), +(159, 3, 'ARIA_CLOSE', 'Zamknij', NULL), +(160, 1, 'VIEWER_ERROR', 'Viewer error', NULL), +(161, 3, 'VIEWER_ERROR', 'Błąd podglądu', NULL), +(162, 1, 'VIEWER_CONNECTION_CONFIRMATION', 'Do you want to connect to this channel?', NULL), +(163, 3, 'VIEWER_CONNECTION_CONFIRMATION', 'Czy chcesz dołączyć na ten kanał?', NULL), +(164, 1, 'VIEWER_CLIENT_LASTACTIVE', 'Last active:', NULL), +(165, 3, 'VIEWER_CLIENT_LASTACTIVE', 'Aktywny:', NULL), +(166, 1, 'VIEWER_CLIENT_ONLINE', 'Online time:', NULL), +(167, 3, 'VIEWER_CLIENT_ONLINE', 'Online przez:', NULL), +(168, 1, 'VIEWER_CLIENT_JOINED', 'First joined:', NULL), +(169, 3, 'VIEWER_CLIENT_JOINED', 'Dołączył:', NULL), +(170, 1, 'VIEWER_CLIENT_TITLE', 'Client info', NULL), +(171, 3, 'VIEWER_CLIENT_TITLE', 'Informacje o kliencie', NULL), +(172, 1, 'VIEWER_SERVER_ICON', 'Server icon', NULL), +(173, 3, 'VIEWER_SERVER_ICON', 'Ikona serwera', NULL), +(174, 1, 'VIEWER_DEFAULT_CHANNEL', 'Default channel', NULL), +(175, 3, 'VIEWER_DEFAULT_CHANNEL', 'Kanał domyślny', NULL), +(176, 1, 'VIEWER_CHANNEL_UNSUB1', ', unsubscribed', 'Please note that this string starts with \", \"'), +(177, 3, 'VIEWER_CHANNEL_UNSUB1', ', odsubskrybowany', NULL), +(178, 1, 'VIEWER_CHANNEL_OCCUPIED', 'Fully occupied', NULL), +(179, 3, 'VIEWER_CHANNEL_OCCUPIED', 'Zajęty', NULL), +(180, 1, 'VIEWER_CHANNEL_PASSWORD', 'Password-protected', NULL), +(181, 3, 'VIEWER_CHANNEL_PASSWORD', 'Zabezpieczony hasłem', NULL), +(182, 1, 'VIEWER_CHANNEL_UNSUB2', 'Unsubscribed', NULL), +(183, 3, 'VIEWER_CHANNEL_UNSUB2', 'Odsubskrybowany', NULL), +(184, 1, 'VIEWER_CHANNEL_ICON', 'Channel icon', NULL), +(185, 3, 'VIEWER_CHANNEL_ICON', 'Ikona kanału', NULL), +(186, 1, 'VIEWER_CHANNEL_MODERATED', 'Moderated', NULL), +(187, 3, 'VIEWER_CHANNEL_MODERATED', 'Moderowany', NULL), +(188, 1, 'VIEWER_CHANNEL_MUSIC_CODED', 'Music codec', NULL), +(189, 3, 'VIEWER_CHANNEL_MUSIC_CODED', 'Kodek muzyczny', NULL), +(190, 1, 'VIEWER_CLIENT_AWAY', 'Away', NULL), +(191, 3, 'VIEWER_CLIENT_AWAY', 'Zaraz wracam', NULL), +(194, 1, 'VIEWER_CLIENT_OUTPUT_DISABLED', 'Sound disabled', NULL), +(195, 3, 'VIEWER_CLIENT_OUTPUT_DISABLED', 'Głos wyłączony', NULL), +(196, 1, 'VIEWER_CLIENT_OUTPUT_MUTED', 'Deafened', NULL), +(197, 3, 'VIEWER_CLIENT_OUTPUT_MUTED', 'Głos wyciszony', NULL), +(198, 1, 'VIEWER_CLIENT_MIC_DISABLED', 'Microphone disabled', NULL), +(199, 3, 'VIEWER_CLIENT_MIC_DISABLED', 'Mikrofon wyłączony', NULL), +(200, 1, 'VIEWER_CLIENT_MIC_MUTED', 'Muted', NULL), +(201, 3, 'VIEWER_CLIENT_MIC_MUTED', 'Mikrofon wyciszony', NULL), +(202, 1, 'VIEWER_CLIENT_COMMANDER', 'Channel commander', NULL), +(203, 3, 'VIEWER_CLIENT_COMMANDER', 'Dowódca kanału', NULL), +(204, 1, 'VIEWER_CLIENT_ICON', 'Client icon', NULL), +(205, 3, 'VIEWER_CLIENT_ICON', 'Ikona klienta', NULL), +(206, 1, 'VIEWER_CLIENT_PRIORITY_SPEAKER', 'Priority speaker', NULL), +(207, 3, 'VIEWER_CLIENT_PRIORITY_SPEAKER', 'Mówca priorytetowy', NULL), +(208, 1, 'VIEWER_CLIENT_TALK_POWER_GRANTED', 'Talk power granted', NULL), +(209, 3, 'VIEWER_CLIENT_TALK_POWER_GRANTED', 'Moc konwersacji przyznana', NULL), +(210, 1, 'VIEWER_CLIENT_TALK_POWER_INSUFFICIENT', 'Insufficient talk power', NULL), +(211, 3, 'VIEWER_CLIENT_TALK_POWER_INSUFFICIENT', 'Niewystarczająca moc konwersacji', NULL), +(212, 1, 'ASSIGNER_NOT_LOGGED_IN', 'Log in before using group assigner', NULL), +(213, 3, 'ASSIGNER_NOT_LOGGED_IN', 'Zaloguj się przed przydzielaniem grup', NULL), +(214, 1, 'ASSIGNER_LOGIN_BUTTON', 'Login', NULL), +(215, 3, 'ASSIGNER_LOGIN_BUTTON', 'Zaloguj się', NULL), +(216, 1, 'ASSIGNER_SAVE_BUTTON', 'Save', NULL), +(217, 3, 'ASSIGNER_SAVE_BUTTON', 'Zapisz', NULL), +(218, 1, 'ASSIGNER_INVALID_GROUPS', 'Invalid group settings', NULL), +(219, 3, 'ASSIGNER_INVALID_GROUPS', 'Nieprawidłowe ustawienia grup', NULL), +(220, 1, 'ASSIGNER_NOT_CONFIGURED', 'Group assigner is not configured by the website administrator', NULL), +(221, 3, 'ASSIGNER_NOT_CONFIGURED', 'Przydzielanie grup nie jest skonfigurowane przez administratora strony', NULL), +(222, 1, 'ASSIGNER_SAVE_SUCCESS', 'Your groups have been updated', NULL), +(223, 3, 'ASSIGNER_SAVE_SUCCESS', 'Twoje grupy zostały zaktualizowane', NULL), +(224, 1, 'ASSIGNER_SAVE_ERROR', 'Group change error', NULL), +(225, 3, 'ASSIGNER_SAVE_ERROR', 'Błąd zmiany grup', NULL), +(226, 1, 'ASSIGNER_SAVE_NO_CHANGE', 'No changes has been made', NULL), +(227, 3, 'ASSIGNER_SAVE_NO_CHANGE', 'Nie wprowadzono żadnych zmian', NULL); + + +ALTER TABLE `tsw_config` + ADD UNIQUE KEY `param` (`identifier`); + +ALTER TABLE `tsw_faq` + ADD PRIMARY KEY (`faqid`); + +ALTER TABLE `tsw_languages` + ADD PRIMARY KEY (`langid`); + +ALTER TABLE `tsw_news` + ADD PRIMARY KEY (`newsid`); + +ALTER TABLE `tsw_translations` + ADD PRIMARY KEY (`id`); + + +ALTER TABLE `tsw_faq` + MODIFY `faqid` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4; + +ALTER TABLE `tsw_languages` + MODIFY `langid` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4; + +ALTER TABLE `tsw_news` + MODIFY `newsid` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2; + +ALTER TABLE `tsw_translations` + MODIFY `id` int(10) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=228; +COMMIT; diff --git a/src/installer/dbinstall_sqlite.sql b/src/installer/dbinstall_sqlite.sql new file mode 100644 index 0000000..1b91d4e --- /dev/null +++ b/src/installer/dbinstall_sqlite.sql @@ -0,0 +1 @@ +--- ¯\_(ツ)_/¯ diff --git a/src/installer/index.php b/src/installer/index.php new file mode 100644 index 0000000..46eab80 --- /dev/null +++ b/src/installer/index.php @@ -0,0 +1,93 @@ + 1) { + die('File "private/INSTALLER_LOCK" exists. Please remove it if you wish to run the installer again.'); +} + +if (!file_exists(__PRIVATE_DIR . "/vendor/autoload.php")) { + die( + '

Oops! We cannot find Composer\'s autoload file.

' . + '

In 2.0, the installation procedure is a little different. Go to the ' . + 'releases on GitHub, ' . + 'download the latest version and upload in on your server.

' . + 'Or, if you know what you are doing, run composer update in the ' . + '' . realpath(__BASE_DIR) . ' directory' + ); +} + +ini_set("display_errors", 1); +ini_set("display_startup_errors", 1); +error_reporting(E_ALL); +set_time_limit(0); + +$stepNumber = empty($_GET["step"]) || !file_exists(__DIR__ . "/pages/" . (int)$_GET["step"] . ".php") ? 1 : (int) $_GET["step"]; +?> + + + + + + + Step <?= $stepNumber ?> | TS-website 2.0 Installer + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+

TS-website 2.0 Installer

+
+ + + + +
+ + + + + diff --git a/src/installer/pages/1.php b/src/installer/pages/1.php new file mode 100644 index 0000000..935c3ef --- /dev/null +++ b/src/installer/pages/1.php @@ -0,0 +1,172 @@ + + + + + + + + + + +
+
+

Welcome to TS-website Installer!

+

This wizard will guide you through the installation process of TS-website.

+

Please enable Javascript before continuing!

+

+ If you encounter any problems please make sure you check the + wiki. +

+

Go to the next step whenever you are ready!

+ +
+
+ + +
+ +
+ + +
+ + +
+
+ +
+ + diff --git a/src/installer/pages/2.php b/src/installer/pages/2.php new file mode 100644 index 0000000..8e0ea7a --- /dev/null +++ b/src/installer/pages/2.php @@ -0,0 +1,264 @@ + + +
+
+

Requirements check

+ +
+ +
+ +
+
+ + + + +
+
+
+ + +
+
+ Oh snap! Looks like your current web server configuration does not allow to run TS-website 2.0. + Please fix the above problems and try again.
If you have any problems, please check + wiki and follow the installation guide. +
+
+ + +
+
+ Success! Looks like you can run TS-website 2.0! +
+
+ +
+ +
+ + 7 ok + { + $result = PHP_VERSION_ID < 50600 ? 2 : (PHP_VERSION_ID < 70000 ? 1 : 0); + showCheckResult( + "PHP 5.6.0+ (7.0+ recommended)", + $result, + "Current PHP version: " . phpversion() + ); + } + + // Check if we are using polyfill for utf8_encode + { + $result = defined("__USING_U8ENC_POLYFILL"); + + showCheckResult( + "Function utf8_encode exists", + $result ? 1 : 0, + $result ? + "Function not found, using polyfill" : + "Function exists" + ); + } + + // password_hash and password_verify + { + $result = PHP_VERSION_ID >= 50500 && password_verify( + "ayy-lmao-m88", password_hash("ayy-lmao-m88", PASSWORD_DEFAULT) + ); + + showCheckResult( + "password_hash & password_verify", + $result ? 0 : 2, + $result ? + "Functions exists and work" : + "Please make sure your PHP version supports BCRYPT and BLOWFISH" + ); + } + + displayCategory("Extension checks"); + + // Extensions check + { + foreach (["mbstring", "json", "pdo_mysql", "tokenizer", "curl"] as $extension) { + $result = extension_loaded($extension); + + showCheckResult( + "$extension extension", + $result ? 0 : 2, + $result ? + "Extension installed and loaded" : + 'Please install or enable ' . $extension . ' extension' + ); + } + } + + displayCategory("File / directory permission checks"); + + // file / directory writable checks + { + // path => true if file, false if directory + $paths = [ + __CONFIG_FILE => true, + __INSTALLER_LOCK_FILE => true, + __CACHE_DIR => false, + __CACHE_DIR . "/templates" => false, + __CACHE_DIR . "/servericons" => false, + ]; + + foreach ($paths as $path => $isFile) { + $exists = file_exists($path); + + // If file / directory doesnt exists try to create it and update the variable + if(!$exists) + $exists = $isFile ? @touch($path) : @mkdir($path); + + $writable = is_writable($path); + $basename = basename($path); + + // we are using a custom method instead of realpath, + // because it does not work with non-existing files + $realpath = resolveFilename($path); + + $msg = "Yes"; + + if(!$writable) + $msg = "Please make $realpath writable"; + + if(!$exists) + $msg = ($isFile ? "File" : "Directory") . " $realpath does not exists, please create it"; + + showCheckResult("Is $basename writable?", $exists && $writable ? 0 : 2, $msg); + } + } + + displayCategory("Miscellaneous"); + + // cache test + { + $result = false; + + try { + require_once __PRIVATE_DIR . "/vendor/autoload.php"; + $cache = new Wruczek\PhpFileCache\PhpFileCache(); + $teststring = "cachetest123"; + $cache->store("installertest", $teststring, 3); + $result = $cache->retrieve("installertest") === $teststring; + $cache->clearCache(); + } catch (Exception $e) {} + + showCheckResult( + "Cache save and read test", + $result ? 0 : 2, + $result ? + "Save and read success" : + "Something went wrong! Please make sure that private/cache directory is writable" + ); + } + + // template test + { + if($result) { + if(extension_loaded("mbstring")) { + $result = false; + + try { + $latte = new Latte\Engine(); + $latte->setTempDirectory(__CACHE_DIR); + $latte->setLoader(new Latte\Loaders\StringLoader()); + + $render = @$latte->renderToString('Hello, {$test|upper}!', array("test" => "Wruczek")); + + $result = $render === "Hello, WRUCZEK!"; + } catch (Exception $e) {} + + showCheckResult( + "Template render and cache test", + $result ? 0 : 2, + $result ? + "Render and cache success" : + "Something went wrong! Please make sure that private/cache directory is writable" + ); + } else { + showCheckResult("Template render and cache test", 2, "mbstring extension not found, cannot start the test"); + } + } else { + showCheckResult("Template render and cache test", 2, "private/cache directory is not writable, cannot start the test"); + } + } + +} + +// Utils + +function showCheckResult($name, $state, $resulttext) { + if($state === 0) { + $attr = "fa-check-circle color-success"; + } else if($state === 1) { + $attr = "fa-minus-circle color-warning"; + } else { + $attr = "fa-times-circle color-danger"; + + if(!defined("CANNOT_INSTALL")) + define("CANNOT_INSTALL", true); + } + + ?> + + + + + +' . $name . ''; +} + +// https://tomnomnom.com/posts/realish-paths-without-realpath +function resolveFilename($filename) { + $filename = str_replace('//', '/', $filename); + $parts = explode('/', $filename); + $out = array(); + foreach ($parts as $part){ + if ($part === '.') continue; + if ($part === '..') { + array_pop($out); + continue; + } + $out[] = $part; + } + return implode('/', $out); +} diff --git a/src/installer/pages/3.php b/src/installer/pages/3.php new file mode 100644 index 0000000..236a563 --- /dev/null +++ b/src/installer/pages/3.php @@ -0,0 +1,213 @@ + "mysql", + "server" => $dbhostname, + "username" => $dbusername, + "password" => $dbpassword, + "database_name" => $dbname, + "prefix" => $dbprefix, + "port" => 3306, + "charset" => "utf8mb4" + ]; + } else { + // no sqlite support for now :( + $errormessage = "Please fill in your database details"; + +// $usingMysql = false; +// $dbconfig = [ +// "database_type" => "sqlite", +// "database_file" => __LOCALDB_FILE +// ]; + } + + // try to connect only if dbconfig is defined + if (isset($dbconfig)) { + try { + $db = new Medoo($dbconfig); + $sqlfile = $usingMysql ? "dbinstall_mysql" : "dbinstall_sqlite"; + $sqlquery = file_get_contents(__DIR__ . "/../$sqlfile.sql"); + + if($sqlquery === false) { + $errormessage = "Cannot read $sqlfile.sql file!"; + } else { + $sqlquery = str_replace("DBPREFIX", $dbprefix, $sqlquery); + $sqlresult = $db->query($sqlquery); + + if($sqlresult === false || !empty($db->error()[1])) { + throw new Exception($db->error()[2], $db->error()[1]); + } + + $phpcode = << $value) { + $confarray .= sprintf(' "%s" => "%s",' . PHP_EOL, addcslashes($key, '"'), addcslashes($value, '"')); + } + + // Remove semicolon and new line from the end + $confarray = rtrim($confarray, "," . PHP_EOL); + + // Replace all variables with sprintf + $phpcode = sprintf($phpcode, date("d-m-Y H:i:s"), __TSWEBSITE_VERSION, $confarray); + + if(file_put_contents(__CONFIG_FILE, $phpcode) === false) { + $errormessage = "Cannot write to " . __CONFIG_FILE . "! Please check the file/directory permissions"; + } else { + header("Location: ?step=" . ($stepNumber + 1)); + } + } + } catch (Exception $e) { + $errormessage = htmlspecialchars("Error " . $e->getCode() . ": " . $e->getMessage()); + + if($e->getCode() === 1045) { + $errormessage .= '
You have entered wrong username and/or password. Please check it and try again.'; + } + + if($e->getCode() === 1049) { + $errormessage .= '
Please manually create database "' . htmlspecialchars($dbname) . '" and try again.'; + } + } + } + +} +?> + + +
+
+ +
+
+ + +
+ +
+

Database details

+ +
+
+ + +
+
+ + +
+
+ +
+
"> + +
+
+ +
+ +
+ + + +
+
+ +
+
+ +
+ +
+ + + +
+
+ +
+
+ +
+ +
+ +
+
+ +
+ +
+ +
+
+ +
+ +
+ + + +
+
+ + +
+
+
+ + +
+ + diff --git a/src/installer/pages/4.php b/src/installer/pages/4.php new file mode 100644 index 0000000..84c4f20 --- /dev/null +++ b/src/installer/pages/4.php @@ -0,0 +1,190 @@ +login($queryusername, $querypassword); + $tsServer = $tsNodeHost->serverGetByPort($queryserverport); + + if(is_array($tsServer->getInfo())) { + $utils = Config::i(); + + $configdata = [ + "query_hostname" => $queryhostname, + "query_port" => $queryport, + "tsserver_port" => $queryserverport, + "query_username" => $queryusername, + "query_password" => $querypassword, + "query_displayip" => $querydisplayip, + ]; + + foreach ($configdata as $key => $value) { + if(!$utils->setValue($key, $value)) { + die("Error while inserting query data to database, at " . htmlspecialchars($key) . " => " . htmlspecialchars($value)); + } + } + + header("Location: ?step=" . ($stepNumber + 1)); + } else { + $errormessage .= '
Cannot retrieve server information'; + } + } catch (Exception $e) { + $errormessage = htmlspecialchars("Error " . $e->getCode() . ": " . $e->getMessage()); + + if($e->getCode() === 520) { + $errormessage .= '
You have entered wrong username and/or password. Please check it and try again.'; + } + + if($e->getCode() === 2568) { + $errormessage .= '
Query account does not have permissions. ' . 'Click here to view required permissions list.'; + } + } + } +} +?> + + + + + +
+
+ +
+
+ + +
+ +
+

Query details

+ +
+
"> + +
+
+ +
+ +
+ + + +
+
+ +
+
+
+ +
+ +
+ +
+
+ +
+ +
+
+ +

+ Default query port: 10011, default server port: 9987. +

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

Query permissions required by TS-website

+
+ + +
+
+
+ + +
+ + diff --git a/src/installer/pages/5.php b/src/installer/pages/5.php new file mode 100644 index 0000000..8632029 --- /dev/null +++ b/src/installer/pages/5.php @@ -0,0 +1,39 @@ + + + +
+
+ +
+
+ + +
+ +
+

Secure your web server

+ +
+
+ Securing your web server is very important. Please read + this + guide on how to properly isolate the "private" directory +
+
+
+ + +
+ + diff --git a/src/installer/pages/6.php b/src/installer/pages/6.php new file mode 100644 index 0000000..5196387 --- /dev/null +++ b/src/installer/pages/6.php @@ -0,0 +1,125 @@ +setValue("baseurl", $baseUrl); + Config::i()->setValue("website_title", $websiteName); + Config::i()->setValue("nav_brand", $websiteName); + Config::i()->setValue("timezone", $timezone); + Config::i()->setValue("usingcloudflare", $usingCloudflare); + + header("Location: ?step=" . ($stepNumber + 1)); + } catch (\Exception $e) { + $errormessage = "Error saving config: " . htmlspecialchars($e->getMessage()); + } + } +} + +$defaultTimezone = date_default_timezone_get(); + +$defaultBase = (@$_SERVER["HTTPS"] === "on" ? "https" : "http") . "://" . $_SERVER["HTTP_HOST"] . $_SERVER["REQUEST_URI"]; +$defaultBase = dirname(dirname($defaultBase)); // get the path for the previous directory, not the installer + +$displayip = Config::get("query_displayip"); // default website name to the display IP +?> + + +
+
+ +
+
+ + +
+ +
+

Configure your site

+ +
+
"> + +
+ Almost done! Here you can adjust some basic settings of ts-website. + Don't worry, you will be able to change them in the admin panel after installation. +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+
+ + +
+

This will change the way ts-website detects user IP address

+
+ + +
+
+
+ + +
+ + diff --git a/src/installer/pages/7.php b/src/installer/pages/7.php new file mode 100644 index 0000000..668de1b --- /dev/null +++ b/src/installer/pages/7.php @@ -0,0 +1,136 @@ +private/INSTALLER_LOCK! Please check the file/directory permissions"); +//} + +// If we are allowed to collect metrics +if(!empty($_COOKIE["tsw_allow_metrics"])) { + setcookie("tsw_allow_metrics", "false", 1); // remove the cookie + + $data = [ + "tswVersion" => __TSWEBSITE_VERSION, + "phpVersion" => PHP_VERSION, + "os" => sprintf("%s %s %s %s", php_uname("s"), php_uname("r"), php_uname("v"), php_uname("m")), // no hostname + "webServer" => $_SERVER["SERVER_SOFTWARE"], + "loadedExtensions" => get_loaded_extensions() + ]; + + // Os details + { + $lsb = shell_exec('lsb_release -a | grep "Description"'); + + if (strpos($lsb, "Description:") !== false) { + // Split string by ":", get the 2nd part and trim the string + // "Description: Ubuntu 18.04.1 LTS" --> "Ubuntu 18.04.1 LTS" + $osversion = trim(explode(":", $lsb, 2)[1]); + $data["osDetails"] = $osversion; + } + } + + // TS info + { + try { + require_once __DIR__ . "/../../private/vendor/autoload.php"; + $tsNode = TeamSpeakUtils::i()->getTSNodeHost(); + $tsAdmin = TeamSpeakUtils::i()->getTSNodeServer(); + + $tsInfo = $tsAdmin->getInfo(); + + $data["ts"] = [ + "uid" => (string) $tsInfo["virtualserver_unique_identifier"], + "version" => (string) $tsInfo["virtualserver_version"], + "platform" => (string) $tsInfo["virtualserver_platform"], + "slotCount" => $tsInfo["virtualserver_maxclients"], + "usingServeradmin" => $tsNode->whoami()["client_unique_identifier"] == "serveradmin" + ]; + } catch (\Exception $e) {} + } + + // Send it + $data = json_encode($data); + $url = "https://wruczek.tech/tsw-metrics/"; + + // If cURL is available, use it + if (function_exists("curl_version")) { + $ch = curl_init($url); + curl_setopt($ch, CURLOPT_HTTPHEADER, ["Content-Type: application/json"]); + curl_setopt($ch, CURLOPT_POST, true); + curl_setopt($ch, CURLOPT_POSTFIELDS, $data); + curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); + $response = curl_exec($ch); + curl_close($ch); + + //echo $response; + } else { // else try file_get_contents + $context = stream_context_create([ + "http" => [ + "method" => "POST", + "header" => "Content-type: application/json\r\n" . + "Accept: application/json\r\n" . + "Connection: close\r\n" . + "Content-length: " . strlen($data) . "\r\n", + "content" => $data + ] + ]); + + $response = file_get_contents($url, false, $context); + //echo $response; + } +} +?> +
+
+

TS-website has been successfully installed! 👍

+ +

+ If you wish, you can remove the installer directory. +

+ +
+ +

What now?

+ +
+
+
+ +
+
+

Donate

+

to keep this project alive

+
+
+
+
+

Join our telegram group

+

news, announcements and support

+
+
+ +
+
+
+
+ +
+
+

Visit your new website

+

or login to your Admin Panel

+
+
+
+
+

Spread the message

+

Let others know about this project

+
+
+ +
+
+
+
+
diff --git a/src/installer/style.css b/src/installer/style.css new file mode 100644 index 0000000..5f97047 --- /dev/null +++ b/src/installer/style.css @@ -0,0 +1,103 @@ +body { + margin-bottom: 40px; +} + +h4 { + margin-bottom: 2rem !important; +} + +.nav-wizard { + display: inline-block; + margin-bottom: 40px; +} + +.nav-wizard > li { + display: block; +} + +.nav-wizard > li > a { + display: block; + padding: 10px 15px; + cursor: default; + text-decoration: none !important; +} + +.btn { + font-family: Helvetica, Arial, sans-serif; + line-height: 12px; +} + +p, label { + font-size: 115%; +} + +.license { + margin: 1rem auto; + display: inline-block; + max-height: 400px; + text-align: initial; +} + +.license-container { + text-align: center; +} + +.fa-larger { + font-size: 1.5em; +} + +.fa-chevron-left { + margin-right: 3px; +} + +.fa-chevron-right, .fa-sync { + margin-left: 3px; +} + +.requirements-check-table { + display: inline-block; + width: auto; + text-align: initial +} + +.color-success { + color: #28B62C; +} + +.color-warning { + color: #FF851B; +} + +.color-danger { + color: #FF4136; +} + +.whatnow-row { + margin-bottom: 30px; +} + +.whatnow-row h1, .whatnow-row h3 { + margin: 0; +} + +.whatnow-icon { + font-size: 5rem; +} + +.tooltip-inner { + max-width: 300px; +} + +@media (max-width: 1200px) { + .nav-wizard > li:not(:first-child) > a:before { + border: 0; + } + + .nav-wizard { + width: 100%; + } + + .nav-wizard > li { + float: none; + } +} diff --git a/src/js/assigner.js b/src/js/assigner.js new file mode 100644 index 0000000..5872b5e --- /dev/null +++ b/src/js/assigner.js @@ -0,0 +1,43 @@ +$(function () { + "use strict" + + recalculateGroups() + + $(".group-assigner .list-group-item:not(.assigner-header)").click(function (e) { + var checkbox = $(this).find("input[type=checkbox]") + $(checkbox).prop("checked", !checkbox.is(':checked')) + recalculateGroups() + }) + + $(".group-assigner input[type=checkbox]").change(function (e) { + recalculateGroups() + }) + + function recalculateGroups() { + var invalidGroups = false + var assignerCategories = $(".group-assigner .assigner-category") + + assignerCategories.each(function (key, val) { + var assignerCategory = $(val) + var maxGroups = assignerCategory.data("maxgroups") + var usedGroups = assignerCategory.find(":checkbox:checked").length + var badge = assignerCategory.find(".assigner-header .badge") + var isValid = usedGroups <= maxGroups + + badge.text(usedGroups + " / " + maxGroups) + + if (isValid) { + badge.removeClass("badge-invalid") + } else { + badge.addClass("badge-invalid") + invalidGroups = true + } + + if (key === assignerCategories.length - 1) { + // last iteration! update the "save" button state + $(".group-assigner .assigner-save").prop("disabled", invalidGroups) + $(".group-assigner .invalid-groups-alert").css("display", invalidGroups ? "inline-block" : "none") + } + }) + } +}) diff --git a/src/js/bans.js b/src/js/bans.js new file mode 100644 index 0000000..5a057ac --- /dev/null +++ b/src/js/bans.js @@ -0,0 +1,43 @@ +$(document).ready(function() { + var bansTable = $("#banlist").DataTable({ + responsive: { + details: { + type: "column", + target: "tr" + } + }, + order: [ + [3, "desc"] + ], + language: { + url: "https://cdn.datatables.net/plug-ins/1.10.19/i18n/" + DATATABLES_LANGUAGE_NAME + ".json" + }, + /* + TODO: + It looks better with the "search" text as an placeholder instead of the label + But its impossible to combine the translation from a CDN. Either gets overwritten by another + It might be worth experimenting more with DataTables API to make it somehow work... + oLanguage: { + sSearch: "_INPUT_", + sSearchPlaceholder: {_"DATATABLES_PLACEHOLDER_SEARCH"} + } + */ + }); + + var responsiveTip = $("#responsive-table-details-tip") + + // show / hide the tip about responsive tables + bansTable.on("responsive-resize", function () { + if (bansTable.responsive.hasHidden() && !Cookies.get("tswebsite_banrowtip_hide")) { + responsiveTip.show() + } else { + responsiveTip.hide() + } + }); + + // preserve alert dismiss with a cookie + responsiveTip.find(".close").click(function (e) { + e.preventDefault() + Cookies.set("tswebsite_banrowtip_hide", true, {expires: 365}); + }) +}); diff --git a/src/js/faq.js b/src/js/faq.js new file mode 100644 index 0000000..a020fbb --- /dev/null +++ b/src/js/faq.js @@ -0,0 +1,40 @@ +$(document).ready(function() { + var hash = decodeURIComponent(location.hash.substr(1)) + + if (hash.startsWith("faq")) { + var faqId = parseInt(hash.substr(3)) - 1 // IDs in faq start from 0 + + // Check if FAQ is a number and is not lower than 0 + if (!faqId || faqId < 0) { + return + } + + var selectedCollapse = $("#faqcollapse-heading-" + faqId) + + // Check if element exists + if (!selectedCollapse.length) { + return + } + + // Toggle collapse + selectedCollapse.parent().find(".collapse").collapse({ + toggle: true + }) + + // Scroll body + $("html,body").animate({ + scrollTop: selectedCollapse.offset().top - 60 + },"slow") + } + + $(".copy-faq-url").click(function (e) { + e.preventDefault() + var currentUrl = window.location.href.split("#")[0] + var faqid = parseInt($(this).data("faqid")) + 1 + var copied = copyTextToClipboard(currentUrl + "#faq" + faqid) + + $(this).tooltip("hide") + updateTooltip($(this), copied ? FAQ_LANG.copy_success : FAQ_LANG.copy_error) + $(this).tooltip("show") + }) +}) diff --git a/src/js/login.js b/src/js/login.js new file mode 100644 index 0000000..21441fd --- /dev/null +++ b/src/js/login.js @@ -0,0 +1,141 @@ +var openLoginModal + +$(function () { + "use strict" + var lm = $("#loginModal") + var isModalShown = false + var accounts + var selectedCldbid + var selectedNickname + + lm.find("#loginModal-codeconfirm").submit(function (e) { + e.preventDefault() + var codeInput = $(e.target[0]) + var code = codeInput.val() + + callLoginApi("login", {cldbid: selectedCldbid, code: code}, function (json) { + if (json.success) { + hideAll() + lm.find(".status-loader").show() + location.reload() + } else { + codeInput.addClass("is-invalid") + } + }) + }) + + $(document).on("click", "[data-selectaccount]", function () { + selectedCldbid = $(this).data("selectaccount") + selectAccount() + }) + + $(".logoutUser").click(function (e) { + callLoginApi("logout", {}, function () { + location.reload() + }) + }) + + $("[data-openLoginModal]").click(function (e) { + e.preventDefault() + openLoginModal() + }) + + openLoginModal = function() { + lm.modal("show") + isModalShown = true; + loadAccounts() + } + + lm.on("hidden.bs.modal", function (e) { + isModalShown = false; + }) + + function loadAccounts() { + callLoginApi("getclients", {}, function (json) { + if (!json.success) { + showError() + return + } + + accounts = json.data + var accountCount = Object.keys(accounts).length; + hideAll() + + // If no accounts returned, show "not connected" + if (accountCount === 0) { + lm.find(".not-connected").show() + + setTimeout(function () { + if (isModalShown) { + loadAccounts() + } + }, 2000) + } else if (accountCount === 1) { + // If only one account, auto-select it + selectedCldbid = Object.keys(accounts)[0] + + selectAccount() + } else { + var html = '' + var template = lm.find(".select-account #select-account-template").html() + + for (var i = 0; i < accountCount; i++) { + var cldbid = Object.keys(accounts)[i] + var nickname = escapeHtml(accounts[cldbid]) + + html += template.format(nickname, cldbid) + } + + lm.find(".select-account .list-group").html(html) + lm.find(".select-account").show() + } + }) + } + + function selectAccount() { + callLoginApi("selectaccount", {cldbid: selectedCldbid}, function (json) { + if (!json.success && json.code !== "CODE_ALREADY_GENERATED") { + lm.find(".error-sendingcode").show() + return + } + + // get nickname by dbid + selectedNickname = accounts[selectedCldbid] + + hideAll() + lm.find(".selected-nickname").text(selectedNickname) + lm.find(".confirmation-code").show() + }) + } + + function callLoginApi(method, data, success) { + data.method = method + $.ajax({ + headers: { + "X-CSRF-TOKEN": csrfToken + }, + url: "api/login.php", + method: "post", + data: data, + success: success, + error: function (result) { + showError() + console.log(result) + } + }) + } + + function showError() { + hideAll() + lm.find(".error-generic").show() + } + + function hideAll() { + lm.find(".error-generic").hide() + lm.find(".error-sendingcode").hide() + lm.find(".status-loader").hide() + lm.find(".not-connected").hide() + lm.find(".select-account").hide() + lm.find(".confirmation-code").hide() + } +}) diff --git a/src/js/script.js b/src/js/script.js new file mode 100644 index 0000000..8b5e118 --- /dev/null +++ b/src/js/script.js @@ -0,0 +1,165 @@ +var csrfToken = $('meta[name="csrf-token"]').attr("content") + +$(function () { + "use strict" + + // START string.format + // parts from https://stackoverflow.com/a/4673436/5381375 + // Replace placeholders like [0] or {0} with arguments + String.prototype.format = function() { + var args = arguments + return this.replace(/({|\[)(\d+)(]|})/g, function(match, x, number) { + return typeof args[number] != 'undefined' ? args[number] : match + }) + } + // END string.format + + // START Time functions + console.log("Moment.js locale set to " + moment.locale()); + + updateRelativeTime(); + + setInterval(function () { + updateRelativeTime(); + }, 1000 * 60); + // END Time functions + + // START Cookies + if (!Cookies.get("tswebsite_cookie_consent")) { + $(".cookiealert").addClass("show"); + } + + $(".acceptcookies").click(function () { + Cookies.set("tswebsite_cookie_consent", true, {expires: 365}); + $(".cookiealert").removeClass("show"); + }); + // END Cookies + + $('*[data-connectionproblem="trigger"]').click(function (e) { + e.preventDefault() + $(this).siblings('*[data-connectionproblem="hidden"]').show(); + $(this).hide(); + }); + + // Check if browser supports CSS variables, if not, display an old browser warning + // Taken from Modernizr, MIT license + var supportsFn = (window.CSS && window.CSS.supports.bind(window.CSS)) || (window.supportsCSS); + if (!(!!supportsFn && (supportsFn('--f:0') || supportsFn('--f', 0)))) { + $(".oldbrowser-alert").show() + } + + // Add CSRF token to ajax requests + $.ajaxSetup({ + headers: { + // Disabled for now - problems with DataTables and dynamic language loading + // "X-CSRF-TOKEN": getCsrfToken() + } + }); + + // Initialise tooltips and popovers + $('[data-toggle="tooltip"]').tooltip(); + $('[data-toggle="popover"]').popover(); + + // Display or hide offline admins by default + $(".admin-status").each(function (key, status) { + var hide = $(status).data("hidebydefault") + + if (hide) { + adminStatusDisplayOffline(false) + } + }) + + // Show / hide offline admins from admin status + $("[data-adminstatusoffline]").click(function (e) { + var el = $(this) + var show = el.data("adminstatusoffline") === "show" + $("[data-adminstatusoffline]").show() + el.hide() + adminStatusDisplayOffline(show) + }) + + function adminStatusDisplayOffline(show) { + var offlineAdmins = $(".admin-status .status-offline") + show ? offlineAdmins.show() : offlineAdmins.hide() + } + + // Functions + function updateRelativeTime() { + $('[data-relativetime]').each(function () { + var el = $(this); + var mode = el.data("relativetime"); + var timestamp = el.data("timestamp"); + + var fulldate = timestampToDate(timestamp, true) + var fuzzydate = timestampToDate(timestamp, false) + + if (mode == "fuzzydate") { + el.attr("data-toggle", "tooltip"); + el.attr("title", fulldate); + el.html(fuzzydate); + } else if (mode == "fulldate") { + el.html(fulldate); + } + }); + } +}); + +function timestampToDate(timestamp, full) { + "use strict" + + var ld = moment.localeData() + var fuzzydate = moment.unix(timestamp).fromNow() + var fulldate = moment.unix(timestamp).format(ld.longDateFormat("LLL")) + return full ? fulldate : fuzzydate +} + +function escapeHtml(text) { + var map = { + '&': '&', + '<': '<', + '>': '>', + '"': '"', + "'": ''' + }; + + return text.replace(/[&<>"']/g, function(m) { return map[m]; }); +} + +function updateTooltip(el, text) { + if ($(el).attr("title")) { + $(el).attr("title", text) + } + + $(el).attr("data-original-title", text) + + var id = $(el).attr("aria-describedby") + if (id) { + $("#" + id + " .tooltip-inner").text(text) + } +} + +function updateTooltipWithTranslation(el) { + var args = Array.prototype.slice.call(arguments); + args.shift() + updateTooltip(el, "".format.apply(el.data("translation"), args)) +} + +function copyTextToClipboard(text) { + var textArea = document.createElement("textarea") + textArea.style.position = "fixed" + textArea.style.top = -999999999 + textArea.style.left = -999999999 + textArea.style.opacity = 0 + textArea.value = text + document.body.appendChild(textArea) + textArea.select() + + var success = false + + try { + success = document.execCommand('copy') + } catch (err) {} + + document.body.removeChild(textArea) + return success +} diff --git a/src/js/status.js b/src/js/status.js new file mode 100644 index 0000000..e3de263 --- /dev/null +++ b/src/js/status.js @@ -0,0 +1,80 @@ +$(function () { + "use strict" + + checkStatus() + + var intervalId = setInterval(function() { + checkStatus() + }, 10 * 1000) + + function checkStatus() { + var showError = function () { + $(".server-status .data").hide() + $(".server-status .error").show() + } + + var showData = function () { + $(".server-status .data").show() + $(".server-status .error").hide() + } + + $.ajax({ + url: "api/getstatus.php", + success: function(json) { + var data = json.data + + if (!json.success) { + showError() + console.log(json) + return + } + + showData() + + var clientsPrecent = Math.round(data.clientsOnline * 100 / data.maxClients); + var badges = $(".server-status .data .badge") + + badges.eq(0).text(data.clientsOnline + " / " + data.maxClients + " (" + clientsPrecent + "%)") + updateTooltipWithTranslation(badges.eq(0), data.reservedSlots) + + badges.eq(1).text(data.onlineRecord) + updateTooltipWithTranslation(badges.eq(1), timestampToDate(data.onlineRecordDate, true)) + + badges.eq(2).text(data.uptimeFormatted) + + badges.eq(3).html(data.version + " on " + getPlatformIcon(data.platform)) + updateTooltipWithTranslation(badges.eq(3), data.version, data.platform) + + badges.eq(4).text(Math.round(data.averagePing * 100) / 100 + " ms") + badges.eq(5).text(Math.round(data.averagePacketloss * 10000) / 100 + "%") + }, + error: function(result) { + showError() + }, + complete: function () { + $(".server-status").addClass("loaded") + } + }) + } + + function getPlatformIcon(platform) { + var platformIcon = '' + + switch (platform.toLowerCase()) { + case "windows": + platformIcon = platformIcon.format("windows") + break; + case "linux": + platformIcon = platformIcon.format("linux") + break; + case "os x": + case "macos": + platformIcon = platformIcon.format("apple") + break; + default: + platformIcon = platform + } + + return platformIcon + } +}) diff --git a/src/js/viewer.js b/src/js/viewer.js new file mode 100644 index 0000000..b0f90a8 --- /dev/null +++ b/src/js/viewer.js @@ -0,0 +1,202 @@ +/* +refreshViewer() + +var intervalId = setInterval(function() { + refreshViewer() +}, 10 * 1000) + +function refreshViewer() { + var showError = function () { + $(".viewer-container").hide() + $(".viewer-error").show() + } + + var showData = function () { + $(".viewer-container").show() + $(".viewer-error").hide() + } + + $.ajax({ + url: "api/getviewerhtml.php", + success: function (result) { + $(".viewer-container").html(result) + updateHooks() + showData() + }, + error: function(result) { + showError() + }, + complete: function () { + $(".viewer-container").addClass("loaded") + } + }) +} +*/ + +// show the viewer tip if no cookie present +if (!Cookies.get("tswebsite_viewertip_hide")) { + var alert = $("#server-viewer-tip") + alert.show() + + // preserve alert dismiss with a cookie + alert.find(".close").click(function (e) { + e.preventDefault() + Cookies.set("tswebsite_viewertip_hide", true, {expires: 365}); + }) +} + +// The show-empty-channels button +$("[data-emptychannels]").click(function (e) { + var el = $(this) + var show = el.data("emptychannels") === "show" + $("[data-emptychannels]").show() + el.hide() + + var emptyChannels = $(".viewer-container .not-occupied") + show ? emptyChannels.show() : emptyChannels.hide() +}) + +// Press ENTER to connect to a focused channel +$("[data-channelid]").keypress(function (e) { + if (e.which === 13) { + $(this).click() + } +}) + +// Click to connect to the channel +$("[data-channelid]").click(function (e) { + if ($(this).parent(".channel-container").hasClass("is-spacer")) { + return // dont connect when clicking on a spacer + } + + if (!confirm(VIEWER_LANG.connection_alert)) { + return + } + + var cid = $(this).data("channelid") + + window.location = "ts3server://" + TS3_DISPLAY_IP + "/?cid=" + cid +}) + +// START Code for showing the customised popover when you hover over the client +// Mouse in / out +$(".viewer-container .client-container").hover(function () { + showPopover($(this).find(".client-name")) +}, function () { + $(this).find(".client-name").popover("hide") +}) + +// Keyboard focus (TAB) +$(".viewer-container .client-container").on("focusin focusout", function (e) { + if (e.type === "focusin") { + showPopover($(this).find(".client-name")) + } else { + $(this).find(".client-name").popover("hide") + } +}) +// END + +// Popover code, to be shown at the bottom of .client-name +$(".viewer-container .client-container .client-name").popover({ + title: VIEWER_LANG.client_info, + content: function () { + var el = $(this) + + return '
' + + '
' + + '
' + }, + html: true, + template: '', + placement: "bottom", + trigger: "manual" +}) + +function showPopover(el) { + el.popover("show") + + var cldbid = el.parent().data("clientdbid") + + if (!cldbid) { + return + } + + var popoverDebounceMs = 250 + + // Debounce the hovers + setTimeout(function () { + var popoverId = el.attr("aria-describedby") + + if (!$("#" + popoverId).length) { + return + } + + $.ajax({ + url: "api/getclientinfo.php", + data: { cldbid: cldbid }, + success: function (result) { + if (!result.success) { + updatePopover(el.attr("aria-describedby"), "Result error", result.message || ":(") + return + } + + var describeSeconds = function (seconds) { + return moment().seconds(-seconds).fromNow() + } + + var describeTimestamp = function (timestamp, skipSuffix) { + if (skipSuffix === undefined) + skipSuffix = true + + return moment.unix(timestamp).fromNow(skipSuffix) + } + + var time = result.timenow + var data = result.data + var title = escapeHtml(data.client_nickname) + + var idleSeconds = Math.round(data.client_idle_time / 1000) + var onlineTimestamp = data.client_lastconnected + var createdTimestamp = data.client_created + + var clientInfo = [] + + clientInfo.push([VIEWER_LANG.last_active, describeSeconds(idleSeconds)]) + clientInfo.push([VIEWER_LANG.online_time, describeTimestamp(onlineTimestamp)]) + clientInfo.push([VIEWER_LANG.first_joined, describeTimestamp(createdTimestamp, false)]) + + var body = '' + + clientInfo.forEach(function (entry) { + var description = entry[0] + var value = entry[1] + + body += '' + body += '' + body += '' + body += '' + }) + + body += '
' + description + ' ' + value + '
' + + updatePopover(popoverId, title, body) + }, + error: function (result) { + updatePopover(popoverId, "Ajax error", VIEWER_LANG.viewer_error) + }, + complete: function (result) { + el.popover("update") + } + }) + }, popoverDebounceMs) +} + +function updatePopover(id, header, body) { + if (!id) { + return + } + + var popover = $("#" + id) + popover.find(".popover-header").html(header) + popover.find(".popover-body").html(body) +} diff --git a/src/private/cache/.gitkeep b/src/private/cache/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/src/private/php/AdminStatus.php b/src/private/php/AdminStatus.php new file mode 100644 index 0000000..92d6ee0 --- /dev/null +++ b/src/private/php/AdminStatus.php @@ -0,0 +1,143 @@ +cache = new PhpFileCache(__CACHE_DIR, "adminstatus"); + } + + public function getCachedAdminClients(array $adminGroups) { + return $this->cache->refreshIfExpired("adminstatus", function () use ($adminGroups) { + if(TeamSpeakUtils::i()->checkTSConnection()) { + try { + $nodeServer = TeamSpeakUtils::i()->getTSNodeServer(); + $clients = []; + + foreach ($adminGroups as $groupId) { + $clients[$groupId] = $nodeServer->serverGroupClientList($groupId); + } + + return $clients; + } catch (\TeamSpeak3_Exception $e) { + TeamSpeakUtils::i()->addExceptionToExceptionsList($e); + } + } + return null; + }, Config::get("cache_adminstatus")); + } + + public function getStatus(array $adminGroups, $format, $hideOffline = false, array $ignoredUsersDbids = []) { + if ($format !== self::STATUS_STYLE_GROUPED + && $format !== self::STATUS_STYLE_GROUPED_HIDE_EMPTY_GROUPS + && $format !== self::STATUS_STYLE_LIST + && $format !== self::STATUS_STYLE_LIST_ONLINE_FIRST) { + throw new \InvalidArgumentException("Invalid format specified"); + } + + $serverGroupList = CacheManager::i()->getServerGroupList(); + $adminStatus = $this->getCachedAdminClients($adminGroups); + $data = []; + + if ($serverGroupList === null || $adminStatus === null) { + // if we dont have a server group list or the + // cached admin clients, we cannot do anything + // (its probably a connection issue) + // false means "data problem" + return false; + } + + foreach ($adminGroups as $adminGroupId) { + // try to get that group from server group list + $serverGroup = @$serverGroupList[$adminGroupId]; + + // skip if we cant get that group + if ($serverGroup === null) { + continue; + } + + $groupClients = []; + $cachedClients = $adminStatus[$adminGroupId]; + + foreach ($cachedClients as $client) { + $cldbid = $client["cldbid"]; + + if (in_array($cldbid, $ignoredUsersDbids)) { + continue; + } + + $onlineClient = CacheManager::i()->getClient($cldbid); + + if ($format === self::STATUS_STYLE_LIST_ONLINE_FIRST) { + // in list style, inside of data we have + // 2 additional arrays: online and offline + // we add online users to online, and offline users to offline + // at the end, we combine both arrays + $data[$onlineClient ? "online" : "offline"][] = [ + "client" => $onlineClient ?: $client, + "group" => $serverGroup + ]; + } else { + // when dealing with other formats... + if ($onlineClient !== null) { + // if online, add everything from the $onlineClient + $groupClients[] = $onlineClient; + } else if (!$hideOffline) { + // if offline, we only have info from $client returned by the server group list + $groupClients[] = $client; + } + } + } + + // sort clients, always show online first + if ($format !== self::STATUS_STYLE_LIST_ONLINE_FIRST) { + uasort($groupClients, function ($a, $b) { + if (isset($a["clid"], $b["clid"])) { + return 0; + } + + return isset($a["clid"]) ? -1 : 1; + }); + + // add sorted data to our results + $data[$adminGroupId] = $serverGroup + ["clients" => $groupClients]; + } + } + + // in the online first format... + if ($format === self::STATUS_STYLE_LIST_ONLINE_FIRST) { + if ($hideOffline) { + // we dont care about the offline users if hideOffline is true + $data = @$data["online"]; + } else { + // ...combine online and offline arrays + // see line #89 for explanation + // online users go before offline users + // NOTE: we are using array_merge instead of the "+" + // operator, because we have default numeric keys. + // Using "+" would make us loose some data + $data = array_merge(@$data["online"], @$data["offline"]); + } + } + + return ["format" => $format, "data" => $data]; + } + +} diff --git a/src/private/php/Assigner.php b/src/private/php/Assigner.php new file mode 100644 index 0000000..89110a4 --- /dev/null +++ b/src/private/php/Assigner.php @@ -0,0 +1,136 @@ +getServerGroupList(); + + foreach ($assignerConfig as $index => $category) { + $assignedCount = 0; + $groups = []; + + foreach ($category["groups"] as $sgid) { + $serverGroup = @$serverGroups[$sgid]; + + if ($serverGroup === null) { + continue; + } + + $assigned = in_array($sgid, $userGroups); + $groups[$sgid] = $serverGroup + ["assigned" => $assigned]; + + if ($assigned) { + $assignedCount++; + } + } + + $assignerConfig[$index]["assignedCount"] = $assignedCount; + $assignerConfig[$index]["groups"] = $groups; + } + + return $assignerConfig; + } + + public static function isAssignable($sgid) { + foreach (self::getAssignerConfig() as $category) { + if (in_array($sgid, $category["groups"], true)) { + return true; + } + } + + return false; + } + + /** + * Attempts to change user groups with the provided $newGroups + * @param array $newGroups array of new SGIDs that the user should + * have. any assigner groups not present in this array will + * be removed from the user + * @return int status code that shows result of the group change. + * 0 - groups have been successfully changed + * 1 - no change between current groups and submitted groups + * 2 - group assigner is not configured, stopping + * 3 - reached category group limit + * @throws UserNotAuthenticatedException + * @throws \TeamSpeak3_Exception + */ + public static function changeGroups($newGroups) { + $assignerConfig = self::getAssignerConfig(); + + if (empty($assignerConfig)) { + return 2; // if the assigner is not configured, stop there + } + + $userGroups = Auth::getUserServerGroupIds(); + $groupsToAdd = []; + $groupsToRemove = []; + + foreach ($assignerConfig as $config) { + $groupsToAssign = 0; + + foreach ($config["groups"] as $group) { + // true if the $group is currently assigned to the user + $isAssigned = in_array($group, $userGroups); + // true if the user wants to be added to $group + $wantToAssign = in_array($group, $newGroups); + + // if the group is already assigned, or is to be assigned, + // check for the max group limit in this category: + // - add 1 to the "groupsToAssign", and + // - check if its bigger than the max limit + if ($wantToAssign && (++$groupsToAssign > $config["max"])) { + return 3; + } + + // ADD GROUP if the group is not assigned, but the user wants to be added + if (!$isAssigned && $wantToAssign) { + // ok, seems like we can add this group! + $groupsToAdd[] = $group; + } + + // REMOVE GROUP if the group is currently assigned, but the user does not want to be inside it + if ($isAssigned && !$wantToAssign) { + $groupsToRemove[] = $group; + } + } + } + + // empty arrays - nothing to change + if (!$groupsToAdd && !$groupsToRemove) { + return 1; + } + + // finally, add or remove the groups + $tsServer = TeamSpeakUtils::i()->getTSNodeServer(); + + foreach ($groupsToAdd as $sgid) { + try { + $tsServer->serverGroupClientAdd($sgid, Auth::getCldbid()); + } catch (\TeamSpeak3_Exception $e) {} // TODO log it to the admin panel? + } + + foreach ($groupsToRemove as $sgid) { + try { + $tsServer->serverGroupClientDel($sgid, Auth::getCldbid()); + } catch (\TeamSpeak3_Exception $e) {} // TODO log it to the admin panel? + } + + return 0; + } + +} diff --git a/src/private/php/Auth.php b/src/private/php/Auth.php new file mode 100644 index 0000000..aa9ec0f --- /dev/null +++ b/src/private/php/Auth.php @@ -0,0 +1,288 @@ +getClientList(); + + if ($clientList === null) { + return null; + } + + $ret = []; + + foreach ($clientList as $client) { + // Skip query clients + if ($client["client_type"]) continue; + + if ((string) $client["connection_client_ip"] === $ip) { + $ret[$client["client_database_id"]] = (string) $client["client_nickname"]; + } + } + + return $ret; + } + + /** + * Returns true if the $cldbid is connected with the same IP address as $ip + * @param $cldbid int cldbid to check + * @param $ip string optional, defaults to Utils::getClientIp + * @return bool true if the cldbid have the same IP address as $ip + */ + public static function checkClientIp($cldbid, $ip = null) { + if ($ip === null) { + $ip = Utils::getClientIp(); + } + + $users = self::getTsUsersByIp($ip); + + if ($users === null) { + return false; + } + + return array_key_exists($cldbid, $users); + } + + /** + * Tries to generate and send confirmation code to the TS client + * @param $cldbid int + * @param $poke bool|null true = poke user, false = send a message, null = default value from config + * @return string|null|false Returns code as string on success, null when + * client cannot be found and false when other error occurs. + */ + public static function generateConfirmationCode($cldbid, $poke = null) { + if ($poke === null) { + $poke = (bool) Config::get("loginpokeclient"); + } + + if (TeamSpeakUtils::i()->checkTSConnection()) { + try { + $client = TeamSpeakUtils::i()->getTSNodeServer()->clientGetByDbid($cldbid); + $code = (string) mt_rand(100000, 999999); // TODO: replace it with a CSPRNG + $msg = LanguageUtils::tl("LOGIN_CONFIRMATION_CODE", $code); + + if ($poke) { + $client->poke(mb_substr($msg, 0, 100)); // Max 100 characters for pokes + } else { + $client->message(mb_substr($msg, 0, 1024)); // Max 1024 characters for messages + } + + self::saveConfirmationCode($cldbid, $code); + return $code; + } catch (\TeamSpeak3_Adapter_ServerQuery_Exception $e) { + if ($e->getCode() === 512) { + return null; + } + } + } + + return false; + } + + /** + * Checks if there is already a confirmation code cached for this user. + * Returns the code of found, otherwise NULL. + * @param $cldbid int + * @return string|null Confirmation code, null if not found + */ + public static function getConfirmationCode($cldbid) { + return (new PhpFileCache(__CACHE_DIR, "confirmationcodes"))->retrieve("c_$cldbid"); + } + + /** + * Saves confirmation code for the user + * @param $cldbid int + * @param $code string + */ + public static function saveConfirmationCode($cldbid, $code) { + (new PhpFileCache(__CACHE_DIR, "confirmationcodes"))->store("c_$cldbid", $code, (int) Config::get("cache_logincode")); + } + + /** + * Deletes confirmation code for the user + * @param $cldbid int + */ + public static function deleteConfirmationCode($cldbid) { + (new PhpFileCache(__CACHE_DIR, "confirmationcodes"))->eraseKey("c_$cldbid"); + } + + /** + * Checks confirmation code and logs user in if its correct. + * @param $cldbid + * @param $userCode + * @return bool true if authentication was successful + */ + public static function checkCodeAndLogin($cldbid, $userCode) { + if (!is_int($cldbid)) { + throw new \InvalidArgumentException("cldbid must be an int"); + } + + $codeCheck = self::checkConfirmationCode($cldbid, $userCode); + + if ($codeCheck !== true) { + return false; + } + + $login = self::loginUser($cldbid); + if ($login) { + self::deleteConfirmationCode($cldbid); + return true; + } + + return false; + } + + /** + * Checks if the provided confirmation code matches the saved one and returns true on success. + * @param $cldbid int + * @param $userCode string + * @return bool + */ + public static function checkConfirmationCode($cldbid, $userCode) { + $knownCode = self::getConfirmationCode($cldbid); + + if ($knownCode === null) { + return false; + } + + return hash_equals($knownCode, $userCode); + } + + /** + * Logins user to this account + * @param $cldbid int + * @return bool true on success, false otherwise + */ + public static function loginUser($cldbid) { + $clientList = CacheManager::i()->getClientList(); + + foreach ($clientList as $client) { + if ($client["client_database_id"] === $cldbid) { + $_SESSION["tsuser"]["uid"] = (string) $client["client_unique_identifier"]; + $_SESSION["tsuser"]["cldbid"] = $client["client_database_id"]; + $_SESSION["tsuser"]["nickname"] = (string) $client["client_nickname"]; + return true; + } + } + + return false; + } + + public static function invalidateUserGroupCache() { + unset($_SESSION["tsuser"]["servergroups"]); + } + + /** + * Returns an array containing cached array with group IDs of the user + * @param $cacheTime int for how long we should cache the IDs? + * @return array array with server group IDs of the user + * @throws UserNotAuthenticatedException if user is not logged in + * @throws \TeamSpeak3_Exception when we cannot get data from the TS server + */ + public static function getUserServerGroupIds($cacheTime = 60) { + if (!self::isLoggedIn()) { + throw new UserNotAuthenticatedException("User is not authenticated"); + } + + // Check if we data is already cached and if we can use it + if (isset($_SESSION["tsuser"]["servergroups"])) { + $cached = $_SESSION["tsuser"]["servergroups"]; + + // Calculate how old is the cached data (in seconds) + $secondsSinceCache = time() - $cached["timestamp"]; + + // If we dont need to refresh it, return the data + if ($secondsSinceCache <= $cacheTime) { + return $cached["data"]; + } + } + + // If we end up here, it means we need to refresh the cache + + if (!TeamSpeakUtils::i()->checkTSConnection()) { + throw new \TeamSpeak3_Exception("Cannot connect to the TeamSpeak server"); + } + + try { + $tsServer = TeamSpeakUtils::i()->getTSNodeServer(); + // Get all user groups from TS server + $serverGroups = $tsServer->clientGetServerGroupsByDbid(self::getCldbid()); + } catch (\TeamSpeak3_Exception $e) { + TeamSpeakUtils::i()->addExceptionToExceptionsList($e); + throw $e; + } + + // Since the array in indexed with server group ID's, we can just separate the keys + // That gives us an array with ID's if user groups + $serverGroupIds = array_keys($serverGroups); + + // Cache it in session with current time for later cachebusting + $_SESSION["tsuser"]["servergroups"] = [ + "timestamp" => time(), + "data" => $serverGroupIds + ]; + + return $serverGroupIds; + } + + /** + * Combines sever group ID's from getUserServerGroupIds() with cached + * server group list and returns full array with user's server groups + * @see self::getUserServerGroupIds + * @param int $cacheTime value passed to getUserServerGroupIds() + * @return array array with user server groups + * @throws UserNotAuthenticatedException if user is not logged in + * @throws \TeamSpeak3_Exception when we cannot get data from the TS server + */ + public static function getUserServerGroups($cacheTime = 60) { + $serverGroupIds = self::getUserServerGroupIds($cacheTime); + $serverGroups = CacheManager::i()->getServerGroupList(); + + $resut = array_filter($serverGroups, function ($serverGroup) use ($serverGroupIds) { + // If the group id is inside $serverGroupIds, + // keep that group. Otherwise filter it out. + return in_array($serverGroup["sgid"], $serverGroupIds); + }); + + return $resut; + } +} + +class UserNotAuthenticatedException extends \Exception {} diff --git a/src/private/php/CacheManager.php b/src/private/php/CacheManager.php new file mode 100644 index 0000000..4988bae --- /dev/null +++ b/src/private/php/CacheManager.php @@ -0,0 +1,160 @@ +cache = new PhpFileCache(__CACHE_DIR, "cachemanager"); + } + + private function tsNodeObjectToArray(array $object, $extendInfo = false) { + if (!is_array($object)) { + throw new \Exception("object must be a array filled with TeamSpeak3_Node_Abstract objects"); + } + + $data = []; + + foreach ($object as $obj) { + $data[$obj->getId()] = $obj->getInfo($extendInfo); + } + + return $data; + } + + public function getServerInfo($meta = false) { + if ($this->serverInfo) { + return $this->serverInfo; + } + + return $this->serverInfo = $this->cache->refreshIfExpired("serverinfo", function () { + if(TeamSpeakUtils::i()->checkTSConnection()) { + try { + return TeamSpeakUtils::i()->getTSNodeServer()->getInfo(); + } catch (\TeamSpeak3_Exception $e) { + TeamSpeakUtils::i()->addExceptionToExceptionsList($e); + } + } + return null; + }, Config::get("cache_serverinfo"), $meta); + } + + public function getBanList($meta = false) { + if ($this->banList) { + return $this->banList; + } + + return $this->banList = $this->cache->refreshIfExpired("banlist", function () { + if(TeamSpeakUtils::i()->checkTSConnection()) { + try { + return TeamSpeakUtils::i()->getTSNodeServer()->banList(); + } catch (\TeamSpeak3_Exception $e) { + if ($e->getCode() === 1281) { // database empty result set + return []; + } + + TeamSpeakUtils::i()->addExceptionToExceptionsList($e); + } + } + return null; + }, Config::get("cache_banlist"), $meta); + } + + public function getClientList($meta = false) { + if ($this->clientList) { + return $this->clientList; + } + + return $this->clientList = $this->cache->refreshIfExpired("clientlist", function () { + if(TeamSpeakUtils::i()->checkTSConnection()) { + try { + return $this->tsNodeObjectToArray(TeamSpeakUtils::i()->getTSNodeServer()->clientList()); + } catch (\TeamSpeak3_Exception $e) { + TeamSpeakUtils::i()->addExceptionToExceptionsList($e); + } + } + return null; + }, Config::get("cache_clientlist"), $meta); // Lower cache time because of login system + } + + public function getClient($cldbid) { + $clients = $this->getClientList(); + + if ($clients === null) { + return null; + } + + foreach ($clients as $client) { + if ($client["client_database_id"] === $cldbid) { + return $client; + } + } + + return null; + } + + public function getChannelList($meta = false) { + if ($this->channelList) { + return $this->channelList; + } + + return $this->channelList = $this->cache->refreshIfExpired("channellist", function () { + if(TeamSpeakUtils::i()->checkTSConnection()) { + try { + return $this->tsNodeObjectToArray(TeamSpeakUtils::i()->getTSNodeServer()->channelList()); + } catch (\TeamSpeak3_Exception $e) { + TeamSpeakUtils::i()->addExceptionToExceptionsList($e); + } + } + return null; + }, Config::get("cache_channelist"), $meta); + } + + public function getServerGroupList($meta = false) { + if ($this->serverGroupList) { + return $this->serverGroupList; + } + + return $this->serverGroupList = $this->cache->refreshIfExpired("servergrouplist", function () { + if(TeamSpeakUtils::i()->checkTSConnection()) { + try { + return $this->tsNodeObjectToArray(TeamSpeakUtils::i()->getTSNodeServer()->serverGroupList()); + } catch (\TeamSpeak3_Exception $e) { + TeamSpeakUtils::i()->addExceptionToExceptionsList($e); + } + } + return null; + }, Config::get("cache_servergroups"), $meta); + } + + public function getChannelGroupList($meta = false) { + if ($this->channelGroupList) { + return $this->channelGroupList; + } + + return $this->channelGroupList = $this->cache->refreshIfExpired("channelgrouplist", function () { + if(TeamSpeakUtils::i()->checkTSConnection()) { + try { + return $this->tsNodeObjectToArray(TeamSpeakUtils::i()->getTSNodeServer()->channelGroupList()); + } catch (\TeamSpeak3_Exception $e) { + TeamSpeakUtils::i()->addExceptionToExceptionsList($e); + } + } + return null; + }, Config::get("cache_channelgroups"), $meta); + } +} diff --git a/src/private/php/Config.php b/src/private/php/Config.php new file mode 100644 index 0000000..ff51976 --- /dev/null +++ b/src/private/php/Config.php @@ -0,0 +1,179 @@ +getValue($key, $default); + } + + private function __construct() { + + if(!defined("__CONFIG_FILE")) { + die("__CONFIG_FILE is not defined"); + } + + $config = require __CONFIG_FILE; + + if($config === null || !is_array($config)) { + die("Cannot read the db config file! (" . __CONFIG_FILE . ")"); + } + + $this->databaseConfig = $config; + $this->cache = new PhpFileCache(__CACHE_DIR, "config"); + } + + /** + * Returns config used to connect to the database + * @return array Config as an array + */ + public function getDatabaseConfig() { + return $this->databaseConfig; + } + + /** + * Returns configuration saved in database + * @return array Config file as an key => value array + */ + public function getConfig() { + if($this->config === null) { + $this->config = $this->cache->refreshIfExpired("config", function () { + try { + $db = DatabaseUtils::i()->getDb(); + $data = $db->select("config", ["identifier", "type", "value"]); + } catch (\Exception $e) { + TemplateUtils::i()->renderErrorTemplate("DB error", "Cannot get config data from database", $e->getMessage()); + exit; + } + + if(!empty($db->error()[1])) { + return null; + } + + $cfg = []; + + foreach ($data as $item) { + $key = $item["identifier"]; + $type = $item["type"]; + $val = $item["value"]; + + switch ($type) { + case "STRING": + $val = (string) $val; + break; + case "INT": + $val = (int) $val; + break; + case "FLOAT": + $val = (float) $val; + break; + case "BOOL": + $val = strtolower($val) === "true"; + break; + case "JSON": + $json = json_decode((string) $val, true); + + if ($json === false) { + throw new \Exception("Error loading config from db: cannot parse JSON from $key"); + } + + $val = $json; + break; + default: + throw new \Exception("Error loading config from db: unrecognised data type $type"); + } + + $cfg[$key] = $val; + } + + return $cfg; + }, 60); + } + + return $this->config; + } + + /** + * Resets current config cache + */ + public function clearConfigCache() { + $this->config = null; + $this->cache->eraseKey("config"); + } + + /** + * Returns value associated with given key + * @param string $key + * @param null $default + * @return mixed value Returns string with + * the value if key exists, null otherwise + */ + public function getValue($key, $default = null) { + return isset($this->getConfig()[$key]) ? $this->getConfig()[$key] : $default; + } + + /** + * Saves key => value combo in config table + * @param string $key + * @param string|int|float|bool|array|object $value + * @return bool true on success, false otherwise + * @throws \Exception + */ + public function setValue($key, $value) { + $db = DatabaseUtils::i()->getDb(); + + switch (gettype($value)) { + case "string": + $type = "STRING"; + break; + case "integer": + $type = "INT"; + break; + case "double": + $type = "FLOAT"; + break; + case "boolean": + $type = "BOOL"; + $value = $value ? "true" : "false"; + break; + case "array": + case "object": + $type = "JSON"; + $value = json_encode($value); + break; + default: + throw new \Exception("Unsupported data type"); + } + + $data = [ + "identifier" => $key, + "type" => $type, + "value" => $value + ]; + + if($db->has("config", ["identifier" => $key])) { + $ret = $db->update("config", $data, ["identifier" => $key]); + } else { + $ret = $db->insert("config", $data); + } + + $this->clearConfigCache(); + return $ret; + } +} diff --git a/src/private/php/News/DefaultNewsStore.php b/src/private/php/News/DefaultNewsStore.php new file mode 100644 index 0000000..9272309 --- /dev/null +++ b/src/private/php/News/DefaultNewsStore.php @@ -0,0 +1,106 @@ +db = DatabaseUtils::i()->getDb(); + } + + public function getNewsList($limit, $offset = null) { + if ($limit !== null && !\is_int($limit)) { + throw new \InvalidArgumentException("limit must be an integer"); + } + + if ($offset !== null && !\is_int($offset)) { + throw new \InvalidArgumentException("offset must be an integer"); + } + + $options = []; // Medoo: [$offset, $limit] + + // If we have both limit and offset + if ($limit !== null && $offset !== null) { + $options = [$offset, $limit]; + } else if ($limit !== null) { // if we have only limit + $options = $limit; + } + + $data = $this->db->select($this->newsTable, "*", [ + "ORDER" => ["added" => "DESC"], + "LIMIT" => $options + ]); + + $newsList = []; + + foreach ($data as $row) { + $newsId = $row["newsid"]; + + $newsList[$newsId] = [ + "newsId" => $newsId, + "title" => $row["title"], + // There is no separate news pages for now, so we show the entire content as the description +// "description" => mb_substr($row["content"], 0, 200), + "description" => $row["content"], + "added" => $row["added"], + "edited" => $row["edited"], + // "link" => "news.php?id=$newsId", + "external" => false, + ]; + } + + return $newsList; + } + + public function getNews($newsId) { + return $this->db->get($this->newsTable, "*", [ + "newsId" => $newsId, + ]); + } + + public function getNewsCount() { + return $this->db->count($this->newsTable); + } + + public function addNews($title, $content, $addDate = null, $editDate = null) { + if ($addDate === null) { + $addDate = time(); + } + + $this->db->insert($this->newsTable, [ + "title" => $title, + "added" => $addDate, + "edited" => $editDate, + "content" => $content, + ]); + + return $this->db->id(); + } + + public function editNews($newsId, $title = null, $content = null, $addDate = null, $editDate = null) { + $data = []; + + if ($title !== null) $data["title"] = $title; + if ($content !== null) $data["content"] = $content; + if ($addDate !== null) $data["added"] = $addDate; + if ($editDate !== null) $data["edited"] = $editDate; + + $update = $this->db->update($this->newsTable, $data, [ + "newsId" => $newsId + ]); + + return $update->rowCount() !== 0; + } +} diff --git a/src/private/php/News/INewsStore.php b/src/private/php/News/INewsStore.php new file mode 100644 index 0000000..0da7e98 --- /dev/null +++ b/src/private/php/News/INewsStore.php @@ -0,0 +1,62 @@ + + * [ + * $newsId = [ + * "newsId" => int, + * "title" => "title of the news", + * "description" => "short description", + * "added" => int creation timestamp, + * "edited" => int last edit timestamp, null if never edited, + * "link" => "clicking on the news header will redirect here", + * "external" => true|false if true, the link will open in new tab + * ] + * ] + * + * @param int $limit Number of results to return + * @param int $offset From where to start the list + * @return array array with the news + * @throws \Exception when we cannot get the news + */ + public function getNewsList($limit, $offset = null); + + /** + * Returns full information about this particular news + * @param int $newsId + * @return array|null array with the news details or null if news was not found + */ + public function getNews($newsId); + + /** + * Returns a number of news in the database + * @return int + */ + public function getNewsCount(); + + /** + * Adds a new news and return its new id + * @param string $title + * @param string $content + * @param null|int $addDate if null, the implementation will use the current timestamp + * @param null|int $editDate + * @return int newsId of the inserted news + */ + public function addNews($title, $content, $addDate = null, $editDate = null); + + /** + * Edit the news selected by $newsId. All parameters are optional, and only the provided ones will be changed + * @param int $newsId + * @param string|null $title + * @param string|null $content + * @param int|null $addDate + * @param int|null $editDate + */ + public function editNews($newsId, $title = null, $content = null, $addDate = null, $editDate = null); + +} diff --git a/src/private/php/ServerIconCache.php b/src/private/php/ServerIconCache.php new file mode 100644 index 0000000..3f84327 --- /dev/null +++ b/src/private/php/ServerIconCache.php @@ -0,0 +1,105 @@ +refreshIfExpired("lasticonsync", function () { + // Do not sync icons if we cannot connect the the TS server + if (!TeamSpeakUtils::i()->checkTSConnection()) { + return null; + } + + ServerIconCache::syncIcons(); + return true; + }, Config::get("cache_servericons", 300)); + } + + public static function isLocal($iconId) { + return $iconId > 0 && $iconId < 1000; + } + + public static function iconIdFromName($iconName) { + return substr($iconName, 5); + } + + /** + * Converts a 32-bit int to a unsigned int + * 32-bit int is obtained for example from the servergroup details (iconid) + * Returned value can be used with ServerIconCache's methods like getIconBytes + * @see http://yat.qa/resources/tools/ (Icon Filename Tool) + * @param $iconId int + * @return int + */ + public static function unsignIcon($iconId) { + if (!is_int($iconId)) { + throw new \InvalidArgumentException("iconId must be an integer"); + } + + return ($iconId < 0) ? (2 ** 32) - ($iconId * -1) : $iconId; + } + + public static function downloadIcon($iconId) { + return TeamSpeakUtils::i()->ftDownloadFile("/icon_$iconId"); + } + + public static function ftDownloadIconList() { + try { + return TeamSpeakUtils::i()->getTSNodeServer()->channelFileList(0, "", "/icons/"); + } catch (\TeamSpeak3_Adapter_ServerQuery_Exception $e) { + if ($e->getCode() === 1281) { // database empty result set + return []; + } + + throw $e; + } + } + +} diff --git a/src/private/php/TeamSpeakChannel.php b/src/private/php/TeamSpeakChannel.php new file mode 100644 index 0000000..d351ed1 --- /dev/null +++ b/src/private/php/TeamSpeakChannel.php @@ -0,0 +1,232 @@ +channelList = CacheManager::i()->getChannelList(); + + if (!isset($this->channelList[$cid])) { + throw new \InvalidArgumentException("Channel with ID $cid was not found in the channel cache"); + } + + $this->info = $this->channelList[$cid]; + } + + private function getChannelList() { + return $this->channelList; + } + + private function getClientList() { + if ($this->clientList === null) { + $this->clientList = CacheManager::i()->getClientList(); + } + + return $this->clientList; + } + + public function getInfo() { + return $this->info; + } + + public function getId() { + return (int) $this->info["cid"]; + } + + public function getName() { + return (string) $this->info["channel_name"]; + } + + public function getDisplayName() { + if ($this->isSpacer()) { + // If its a spacer, remove everything before the + // first "]", and then the "]" itself. + return mb_substr(mb_strstr($this->getName(), "]"), 1); + } + + return $this->getName(); + } + + public function isPermanent() { + return (bool) $this->info["channel_flag_permanent"]; + } + + public function getParentId() { + return (int) $this->info["pid"]; + } + + public function isOccupied($checkChildrens = false, $includeQuery = false) { + if ($checkChildrens) { + // Loop through all the children channels, and check if they are occupied + foreach ($this->getChildChannels(true) as $channel) { + if ($channel->isOccupied(false, $includeQuery)) { + return true; + } + } + + return false; + } + + // We could use the getChannelMembers method: + // return count($this->getChannelMembers($includeQuery)) > 0; + // But its much faster to return on the first instance then to + // count up all users and then compare their number. + foreach ($this->getClientList() as $client) { + if (!$client["client_type"] && $client["cid"] === $this->getId()) { + return true; + } + } + + return false; + } + + public function hasPassword() { + return $this->info["channel_flag_password"] === 1; + } + + public function getTotalClients() { + return (int) $this->info["total_clients"]; + } + + public function isFullyOccupied() { + return $this->info["channel_maxclients"] !== -1 && + $this->info["channel_maxclients"] <= $this->info["total_clients"]; + } + + public function isDefaultChannel() { + return $this->info["channel_flag_default"] === 1; + } + + public function isTopChannel() { + return $this->getParentId() === 0; + } + + public function getParentChannels($max = -1) { + $pid = (int) $this->info["pid"]; + $parents = []; + + while ($pid !== 0 && ($max < 0 || count($parents) < $max)) { + $parent = new TeamSpeakChannel($pid); + $parents[$pid] = $parent; + $pid = $parent->getParentId(); + } + + return $parents; + } + + public function getClosestParentChannel() { + $parentChannels = $this->getParentChannels(1); + return isset($parentChannels[0]) ? $parentChannels[0] : null; + } + + public function getChildChannels($resursive = false) { + $childList = []; + + foreach ($this->getChannelList() as $child) { + if ($child["pid"] === $this->getId()) { + $childTSC = new TeamSpeakChannel($child); + $childList[$childTSC->getId()] = $childTSC; + + if ($resursive) { + $childList += $childTSC->getChildChannels(true); + } + } + } + + return $childList; + } + + public function getClosestChildChannel() { + $childChannels = $this->getChildChannels(1); + return isset($childChannels[0]) ? $childChannels[0] : null; + } + + public function getChannelMembers($includeQuery = false) { + $clientList = []; + + foreach ($this->getClientList() as $client) { + if ($client["cid"] === $this->getId() && ($includeQuery || !$client["client_type"])) { +// $childTSC = new TeamSpeakClient($child["clid"]); + $clientList[$client["clid"]] = $client; + } + } + + return $clientList; + } + + public function isSpacer() { + return preg_match("/\[[^\]]*spacer[^\]]*\]/", $this->getName()) && $this->isPermanent() && !$this->getParentId(); + } + + /** + * Returns the possible alignment of a channel spacer + * @return int|false + */ + public function getSpacerAlign() { + if(!$this->isSpacer() || !preg_match("/\[(.*)spacer.*\]/", $this->getName(), $matches) || !isset($matches[1])) { + return false; + } + + if ($this->getSpacerType() !== TeamSpeak3::SPACER_CUSTOM) { + return TeamSpeak3::SPACER_ALIGN_REPEAT; + } + + switch($matches[1]) { + case "*": + return TeamSpeak3::SPACER_ALIGN_REPEAT; + case "c": + return TeamSpeak3::SPACER_ALIGN_CENTER; + case "r": + return TeamSpeak3::SPACER_ALIGN_RIGHT; + default: + return TeamSpeak3::SPACER_ALIGN_LEFT; + } + } + + public function getSpacerType() { + if(!$this->isSpacer()) { + return false; + } + + switch((new TeamSpeak3_Helper_String($this->getName()))->section("]", 1)) { + case "___": + return TeamSpeak3::SPACER_SOLIDLINE; + case "---": + return TeamSpeak3::SPACER_DASHLINE; + case "...": + return TeamSpeak3::SPACER_DOTLINE; + case "-.-": + return TeamSpeak3::SPACER_DASHDOTLINE; + case "-..": + return TeamSpeak3::SPACER_DASHDOTDOTLINE; + default: + return TeamSpeak3::SPACER_CUSTOM; + } + } + + + public function __toString() { + return $this->getName(); + } +} diff --git a/src/private/php/Utils/ApiUtils.php b/src/private/php/Utils/ApiUtils.php new file mode 100644 index 0000000..f20b68b --- /dev/null +++ b/src/private/php/Utils/ApiUtils.php @@ -0,0 +1,108 @@ + $success]; + + if ($code !== null) { + $json["code"] = $code; + } + + if (is_string($data)) { + $json["message"] = $data; + } else if (is_array($data)) { + $json = array_merge($json, $data); + } else if($data !== null) { + $json["data"] = $data; + } + + if (is_int($statusCode)) { + @http_response_code($statusCode); + } + + self::outputJson($json); + } + + public static function outputJson($array) { + @header("Content-Type: application/json"); + echo json_encode($array); + } + + public static function getPostParam($key) { + return self::getParam($_POST, $key); + } + + public static function getGetParam($key) { + return self::getParam($_GET, $key); + } + + /** + * Returns $array[$key] if exists, otherwise throws an jsonerror and + * terminates the script + * @param $array array + * @param $key string + * @param $canBeArray bool whenever the data can be an array + * @return mixed + */ + public static function getParam($array, $key, $canBeArray = false) { + if (!isset($array[$key])) { + self::jsonError("Parameter $key is not provided", 400); + exit; + } + + $data = $array[$key]; + + if (is_array($data) && !$canBeArray) { + self::jsonError("Parameter $key cannot be an array", 400); + exit; + } + + return $data; + } + +} diff --git a/src/private/php/Utils/CsrfUtils.php b/src/private/php/Utils/CsrfUtils.php new file mode 100644 index 0000000..a5e3a2f --- /dev/null +++ b/src/private/php/Utils/CsrfUtils.php @@ -0,0 +1,80 @@ +renderErrorTemplate("", "Security error. Please go to the previous page and try again.", "CSRF token mismatch"); + exit; + } + } + +} diff --git a/src/private/php/Utils/DatabaseUtils.php b/src/private/php/Utils/DatabaseUtils.php new file mode 100644 index 0000000..5073d8e --- /dev/null +++ b/src/private/php/Utils/DatabaseUtils.php @@ -0,0 +1,51 @@ +configUtils = Config::i(); + } + + /** + * Returns database object created with data from + * database config. Stores connection for reuse. + * @return \Medoo\Medoo database object + */ + public function getDb() { + if($this->db === null) { + try { + $db = new Medoo($this->configUtils->getDatabaseConfig()); + } catch (\Exception $e) { + TemplateUtils::i()->renderErrorTemplate("DB error", "Connection to database failed", $e->getMessage()); + exit; + } + + $this->db = $db; + } + + return $this->db; + } + + /** + * Returns true if MysqliDb has been ever initialised. Useful + * for checking if there was a database connection attempt. + * @return bool + */ + public function isInitialised() { + return !empty($this->db); + } +} diff --git a/src/private/php/Utils/DateUtils.php b/src/private/php/Utils/DateUtils.php new file mode 100644 index 0000000..0b54011 --- /dev/null +++ b/src/private/php/Utils/DateUtils.php @@ -0,0 +1,117 @@ +translate("DATE_FORMAT"); + } catch (\Exception $e) { + return "d.m.Y"; + } + } + + /** + * Returns current time format based on current user language. If it cannot + * be retrieved, default value is returned + * @return string time format + */ + public function getTimeFormat() { + try { + return LanguageUtils::i()->translate("TIME_FORMAT"); + } catch (\Exception $e) { + return "H:i:s"; + } + } + + /** + * Returns timestamp formatted to string with format from getDateFormat() + * @param $timestamp + * @return false|string + */ + public function formatToDate($timestamp) { + return date($this->getDateFormat(), $timestamp); + } + + /** + * Returns timestamp formatted to string with format from getTimeFormat() + * @param $timestamp + * @return false|string + */ + public function formatToTime($timestamp) { + return date($this->getTimeFormat(), $timestamp); + } + + /** + * Returns timestamp formatted with formatToDate() and formatToTime() + * @param $timestamp + * @param string $additional additional date format + * @return false|string + */ + public function formatToDateTime($timestamp, $additional = "") { + return date("{$this->getDateFormat()} {$this->getTimeFormat()} $additional", $timestamp); + } + + /** + * Formats timestamp into "time ago" string + * For example, timestamp set to 60 seconds ago will return "1 minute ago" + * + * Taken from StackOverflow: https://stackoverflow.com/a/18602474 + * @param $timestamp int timestamp with past date + * @param bool $full if true, full date will be returned. For example "5 hours, 2 minutes, 8 seconds" + * @return string timestamp formatted to fuzzy date. Marf. + */ + public function fuzzyDate($timestamp, $full = false) { + $now = new \DateTime; + $ago = (new \DateTime)->setTimestamp($timestamp); + + $diff = $now->diff($ago); + + $diff->w = floor($diff->d / 7); + $diff->d -= $diff->w * 7; + + $string = [ + 'y' => 'year', + 'm' => 'month', + 'w' => 'week', + 'd' => 'day', + 'h' => 'hour', + 'i' => 'minute', + 's' => 'second' + ]; + + foreach ($string as $k => &$v) { + if ($diff->$k) { + $v = $diff->$k . ' ' . $v . ($diff->$k > 1 ? 's' : ''); + } else { + unset($string[$k]); + } + } + + if (!$full) $string = array_slice($string, 0, 1); + return $string ? implode(', ', $string) . ' ago' : 'just now'; + } + + + /** + * Returns fuzzy date with abbreviation showing precise date + * @see fuzzyDate + * @param $timestamp + * @param bool $full + * @return string + */ + public function fuzzyDateHTML($timestamp, $full = false) { + $fuzzyDate = $this->fuzzyDate($timestamp, $full); + $fullDate = $this->formatToDateTime($timestamp, "T"); + + return ''; +// return '' . htmlentities($fuzzyDate) . ''; + } +} diff --git a/src/private/php/Utils/Language/Language.php b/src/private/php/Utils/Language/Language.php new file mode 100644 index 0000000..b2a76d3 --- /dev/null +++ b/src/private/php/Utils/Language/Language.php @@ -0,0 +1,114 @@ +languageId = $languageId; + $this->languageNameEnglish = $languageNameEnglish; + $this->languageNameNative = $languageNameNative; + $this->languageCode = $languageCode; + $this->isDefault = $isDefault; + $this->languageItems = $languageItems; + } + + /** + * Returns language ID + * @return int language ID + */ + public function getLanguageId() { + return $this->languageId; + } + + /** + * Returns language name in English + * @return string language name in English + */ + public function getLanguageNameEnglish() { + return $this->languageNameEnglish; + } + + /** + * Returns language name in its native form + * @return string language name in its native form + */ + public function getLanguageNameNative() { + return $this->languageNameNative; + } + + /** + * Returns language code + * @return string language code + */ + public function getLanguageCode() { + return $this->languageCode; + } + + /** + * Returns true when this language is set as default site language + * @return boolean true when default, false otherwise + */ + public function isDefault() { + return $this->isDefault; + } + + /** + * Sets this language as default language of the site + * @return boolean true on success, false otherwise + */ + public function setAsDefaultLanguage() { + return LanguageUtils::i()->setDefaultLanguage($this); + } + + /** + * Returns simple array with identifier -> value mapping, created from getLanguageItems() + * @return array + */ + public function getSimpleItemsArray() { + $ret = []; + + foreach ($this->getLanguageItems() as $item) { + $ret[$item->getIdentifier()] = $item->getValue(); + } + + return $ret; + } + + /** + * Returns language item + * @param $identifier string identifier + * @return LanguageItem LanguageItem if found, null otherwise + */ + public function getLanguageItem($identifier) { + foreach ($this->getLanguageItems() as $item) { + if(strcasecmp($item->getIdentifier(), $identifier) === 0) + return $item; + } + return null; + } + + /** + * Returns language strings + * @return array array filled with LanguageItem + */ + public function getLanguageItems() { + return $this->languageItems; + } + +} diff --git a/src/private/php/Utils/Language/LanguageItem.php b/src/private/php/Utils/Language/LanguageItem.php new file mode 100644 index 0000000..468e210 --- /dev/null +++ b/src/private/php/Utils/Language/LanguageItem.php @@ -0,0 +1,50 @@ +identifier = $identifier; + $this->value = $value; + $this->comment = $comment; + } + + /** + * Returns item identifier + * @return string + */ + public function getIdentifier() { + return $this->identifier; + } + + /** + * Returns item value + * @return string + */ + public function getValue() { + return $this->value; + } + + /** + * Returns item comment, can be null + * @return string + */ + public function getComment() { + return $this->comment; + } + + public function __toString() { + return $this->getValue(); + } + +} diff --git a/src/private/php/Utils/Language/LanguageUtils.php b/src/private/php/Utils/Language/LanguageUtils.php new file mode 100644 index 0000000..b1220b9 --- /dev/null +++ b/src/private/php/Utils/Language/LanguageUtils.php @@ -0,0 +1,201 @@ +translate($identifier, $args); + } + + private function __construct() { + $this->cache = new PhpFileCache(__CACHE_DIR, "translations"); + + $this->languages = $this->cache->refreshIfExpired("languages", function () { + return $this->refreshLanguageCache(false); + }, 300); + } + + /** + * Returns language by its ID + * @param $languageId int Language ID + * @return Language|boolean returns Language when found, false otherwise + */ + public function getLanguageById($languageId) { + foreach ($this->getLanguages() as $lang) { + if($lang->getLanguageId() === $languageId) + return $lang; + } + + return false; + } + + /** + * Returns language by its Language Code + * @param $languageCode string Language Code + * @return Language|boolean returns Language when found, false otherwise + */ + public function getLanguageByCode($languageCode) { + foreach ($this->getLanguages() as $lang) { + if(strcasecmp($lang->getLanguageCode(), $languageCode) === 0) + return $lang; + } + + return false; + } + + /** + * Returns all available languages + * @return array|mixed + */ + public function getLanguages() { + return $this->languages; + } + + /** + * Returns default language + * @return Language default language + */ + public function getDefaultLanguage() { + foreach ($this->getLanguages() as $lang) { + if($lang->isDefault()) + return $lang; + } + + return null; + } + + /** + * Sets language as default + * @param $language Language + * @return boolean true on success, false otherwise + */ + public function setDefaultLanguage($language) { + $db = DatabaseUtils::i()->getDb(); + + // set all languages as non-default, if this succeeds... + if($db->update("languages", ["isdefault" => 0])) { + // ...then set only this language to default + $success = $db->update("languages", ["isdefault" => 1], ["langid", $language->getLanguageId()]); + $this->refreshLanguageCache(); + return $success; + } + + return false; + } + + /** + * Tried to determine user language and returns it + * @return Language user language if determined, null otherwise + */ + public function detectUserLanguage() { + if (isset($_COOKIE["tswebsite_language"])) { // check cookie + $langcode = $_COOKIE["tswebsite_language"]; + } else if (isset($_SERVER["HTTP_ACCEPT_LANGUAGE"])) { // check http headers + $langcode = substr($_SERVER["HTTP_ACCEPT_LANGUAGE"], 0, 2); + } + + // if language with that code exists, return it + if(!empty($langcode) && ($lang = $this->getLanguageByCode($langcode))) + return $lang; + + return null; + } + + /** + * Refreshes language cache, loads and returns new data + * @param bool $updateCache true if the file cache should also be updated + * @return array + */ + public function refreshLanguageCache($updateCache = true) { + $db = DatabaseUtils::i()->getDb(); + $data = $db->select("languages", ["langid", "englishname", "nativename", "langcode", "isdefault"]); + + $langs = []; + + foreach ($data as $lang) { + $langid = $lang["langid"]; + $englishname = $lang["englishname"]; + $nativename = $lang["nativename"]; + $langcode = $lang["langcode"]; + $isdefault = $lang["isdefault"]; + + $strings = $db->select("translations", ["identifier", "value", "comment"], ["langid" => $langid]); + + $languageItems = []; + + foreach ($strings as $str) + $languageItems[] = new LanguageItem($str["identifier"], $str["value"], $str["comment"]); + + $langs[] = new Language($langid, $englishname, $nativename, $langcode, $isdefault, $languageItems); + } + + $this->languages = $langs; + + if($updateCache) + $this->cache->store("languages", $langs, 300); + + return $langs; + } + + /** + * Returns translated text. If identifier is not found in the current + * language, it tries to get it from the default language. + * User language is determined with getDefaultLanguage() function. + * @param $identifier string Translation identifier + * @param array $args Arguments that will replace placeholders + * @return string Translated text + * @throws \Exception When default site or user language cannot + * be found, and/or if $identifier is not found + */ + public function translate($identifier, $args = []) { + if (!is_array($args)) { + $args = [$args]; + } + + $defaultlang = $this->getDefaultLanguage(); + $lang = $this->getLanguageById(@$_SESSION["userlanguageid"]); + + if(!$lang && !$defaultlang) + throw new \Exception("Cannot get user or default language"); + + $item = $lang->getLanguageItem($identifier); + + if(!$item) + $item = $defaultlang->getLanguageItem($identifier); + + if(!$item) + throw new \Exception("Cannot get translation for $identifier"); + + $val = $item->getValue(); + + // Replace placeholders with values from $args + foreach ($args as $i => $iValue) { + // Prevent argument placeholder injection + $iValue = str_replace(["{", "}"], ["{", "}"], $iValue); + + $val = str_ireplace('{' . $i . '}', $iValue, $val); + } + + return $val; + } + +} diff --git a/src/private/php/Utils/SingletonTait.php b/src/private/php/Utils/SingletonTait.php new file mode 100644 index 0000000..f868ac5 --- /dev/null +++ b/src/private/php/Utils/SingletonTait.php @@ -0,0 +1,29 @@ +configUtils = Config::i(); + } + + /** + * Returns TeamSpeak3_Node_Host object created using + * data from config database + * @return \TeamSpeak3_Node_Host + */ + public function getTSNodeHost() { + if($this->tsNodeHost === null) { + $hostname = $this->configUtils->getValue("query_hostname"); + $queryport = $this->configUtils->getValue("query_port"); + $username = $this->configUtils->getValue("query_username"); + $password = $this->configUtils->getValue("query_password"); + + try { + $tsNodeHost = \TeamSpeak3::factory("serverquery://$hostname:$queryport/?timeout=3"); + $tsNodeHost->login($username, $password); + $this->tsNodeHost = $tsNodeHost; + } catch (\Exception $e) { + $this->addExceptionToExceptionsList($e); + } + } + + return $this->tsNodeHost; + } + + /** + * Returns TeamSpeak3_Node_Server object created + * using getTSNodeHost() method. + * @return \TeamSpeak3_Node_Server + */ + public function getTSNodeServer() { + // Don't continue if TSNodeHost is NULL (not working / not initialised) + if($this->tsNodeServer === null && $this->getTSNodeHost()) { + $port = $this->configUtils->getValue("tsserver_port"); + + try { + $this->tsNodeServer = $this->getTSNodeHost()->serverGetByPort($port); + + $newNickname = Config::get("query_nickname"); + + // if available, set the query nickname. add random numbers to the end, so + // the bot will work even with a user/query of the same nickname online + if (isset($newNickname)) { + // try 5 times to change the nickname if the previous is already in use + for($i = 0; $i < 5; $i++) { + try { + $this->tsNodeServer->selfUpdate(["client_nickname" => $newNickname]); + break; // success - we have set the nickname + } catch (\TeamSpeak3_Exception $e) { + // error nickname in use + if ($e->getCode() === 513) { + // add something random to the name and try again + $newNickname .= mt_rand(0, 9); + } else { + // if thats other error than nickname in use, re-throw it + throw $e; + } + } + } + } + } catch (\Exception $e) { + $this->addExceptionToExceptionsList($e); + } + } + + return $this->tsNodeServer; + } + + /** + * Tries to download file from the TS3 server. It might be an actual file, + * icon or avatar. Returns downloaded data. Might throw exceptions when filetransfer fails. + * @param $filename + * @param int $cid Channel Id (defaults to 0 - server) + * @param string $cpw Channel password (defaults to empty) + * @return mixed + * @throws \TeamSpeak3_Adapter_ServerQuery_Exception + */ + public function ftDownloadFile($filename, $cid = 0, $cpw = "") { + $dl = $this->getTSNodeServer()->transferInitDownload(mt_rand(0x0000, 0xFFFF), $cid, $filename, $cpw); + $host = (false !== strpos($dl["host"], ":") ? "[" . $dl["host"] . "]" : $dl["host"]); + $filetransfer = \TeamSpeak3::factory("filetransfer://$host:" . $dl["port"]); + + return $filetransfer->download($dl["ftkey"], $dl["size"]); + } + + /** + * Resets current connection, forces to reconnect to the TeamSpeak server + * next time you call getTSNodeHost or getTSNodeServer + */ + public function reset() { + $this->tsNodeHost = null; + $this->tsNodeServer = null; + } + + /** + * Checks TeamSpeak server connection + * Warning: it will connect to the TeamSpeak server to check the status. + * Use it just before accessing the server, preferably after checking cache. + * @return bool true if TeamSpeak connection succeeded, false otherwise + */ + public function checkTSConnection() { + return $this->getTSNodeHost() !== null + && $this->getTSNodeServer() !== null + && empty($this->getExceptionsList()); + } + + /** + * Adds exception to the exceptions list + * @param \Exception $exception + */ + public function addExceptionToExceptionsList($exception) { + $this->exceptionsList[$exception->getCode()] = $exception; + } + + /** + * Returns array filled with connection exceptions collected + * when calling getTSNodeServer(), getTSNodeServer() and other methods + * @return array Array filled with exceptions. Empty if no exceptions where thrown. + */ + public function getExceptionsList() { + return $this->exceptionsList; + } +} diff --git a/src/private/php/Utils/TemplateUtils.php b/src/private/php/Utils/TemplateUtils.php new file mode 100644 index 0000000..e0a1f69 --- /dev/null +++ b/src/private/php/Utils/TemplateUtils.php @@ -0,0 +1,193 @@ +latte = new Engine(); + $this->getLatte()->setTempDirectory(__CACHE_DIR . "/templates"); + + // Add custom filters... + + $this->getLatte()->addFilter("fuzzyDateAbbr", function ($s) { + return new Html('{cannot convert ' . $s . '}'); + }); + + $this->getLatte()->addFilter("fullDate", function ($s) { + return new Html('{cannot convert ' . $s . '}'); + }); + + $this->getLatte()->addFilter("translate", function ($s, ...$args) { + return new Html(__get($s, $args)); + }); + } + + /** + * Returns latte object + * @return \Latte\Engine Latte object + */ + public function getLatte() { + return $this->latte; + } + + /** + * Echoes rendered template + * @see renderTemplateToString + */ + public function renderTemplate($templateName, $data = [], $loadLangs = true) { + echo $this->renderTemplateToString($templateName, $data, $loadLangs); + } + + /** + * Renders and outputs the error template + * @param string $errorcode Error code + * @param string $errorname Error title + * @param string $description Error description + */ + public function renderErrorTemplate($errorcode = "", $errorname = "", $description = "") { + $data = ["errorcode" => $errorcode, "errorname" => $errorname, "description" => $description]; + $this->renderTemplate("errorpage", $data, false); + } + + /** + * @param $templateName string Name of the template file, without path and extension + * @param $data array Data passed to the template + * @param bool $loadLangs true if the languages should be loaded (requires working database connection) + * @return string Rendered template + * @throws \Exception when we cannot get the CSRF token + */ + public function renderTemplateToString($templateName, $data = [], $loadLangs = true) { + $dbutils = DatabaseUtils::i(); + + if($loadLangs) { + $userlang = LanguageUtils::i()->getLanguageById($_SESSION["userlanguageid"]); + + $data["languageList"] = LanguageUtils::i()->getLanguages(); + $data["userLanguage"] = $userlang; + } + + if ($timestamp = $this->getOldestCacheTimestamp()) + $data["oldestTimestamp"] = $timestamp; + + $data["tsExceptions"] = TeamSpeakUtils::i()->getExceptionsList(); + + if(@$dbutils->isInitialised()) + $data["sqlCount"] = @$dbutils->getDb()->query("SHOW SESSION STATUS LIKE 'Questions'")->fetch()["Value"]; + else + $data["sqlCount"] = "none"; + + $data["config"] = Config::i()->getConfig(); + + $csrfToken = CsrfUtils::getToken(); + $data["csrfToken"] = $csrfToken; + $data["csrfField"] = new Html(''); + + if (Config::get("adminstatus_enabled")) { + $data["adminStatus"] = AdminStatus::i()->getStatus( + Config::get("adminstatus_groups"), + Config::get("adminstatus_mode"), + Config::get("adminstatus_hideoffline"), + Config::get("adminstatus_ignoredusers") + ); + } + + return $this->getLatte()->renderToString(__TEMPLATES_DIR . "/$templateName.latte", $data); + } + + /** + * Returns time elapsed from website load start until now + * @param bool $raw If true, returns elapsed time in + * milliseconds. Defaults to false. + * @return string + */ + public static function getRenderTime($raw = false) { + if($raw) { + return microtime(true) - __RENDER_START; + } else { + return number_format(self::getRenderTime(true), 5); + } + } + + /** + * Stores information about the oldest cached page element + * for later to be displayed in a warning + * @see getOldestCacheTimestamp + * @param $data + */ + public function storeOldestCache($data) { + if ($data["expired"] && (!$this->oldestCache || $this->oldestCache > $data["time"])) + $this->oldestCache = $data["time"]; + } + + /** + * @see storeOldestCache + * @return int Oldest cache timestamp, null if not set + */ + public function getOldestCacheTimestamp() { + return $this->oldestCache; + } + + /** + * Outputs either script or link with all parameters needed + * @param $resourceType string must be either "stylesheet" or "script" + * @param $url string Relative or absolute path to the resource. {cdnjs} will be + * replaced with "https://cdnjs.cloudflare.com/ajax/libs" + * @param $parameter string|bool|null If boolean, its gonna treat it as a local + * resource and add a version timestamp. If string, its gonna treat it as a + * integrity hash and add it along with crossorigin="anonymous" tag. + */ + public static function includeResource($resourceType, $url, $parameter = null) { + $url = str_replace('{cdnjs}', 'https://cdnjs.cloudflare.com/ajax/libs', $url); + $attributes = ""; + + if (is_bool($parameter)) { + $filemtime = @filemtime(__BASE_DIR . "/" . $url); + + if ($filemtime !== false) { + $url .= "?v=$filemtime"; + } + } else if (is_string($parameter)) { + // NEEDS to start with a space! + $attributes = ' integrity="' . htmlspecialchars($parameter) . '" crossorigin="anonymous"'; + } + + if ($resourceType === "stylesheet") { + echo ''; + } else if ($resourceType === "script") { + echo ''; + } else { + throw new \InvalidArgumentException("$resourceType is not a valid resource type"); + } + } + + /** + * @see includeResource + */ + public static function includeStylesheet($url, $parameter = null) { + self::includeResource("stylesheet", $url, $parameter); + } + + /** + * @see includeResource + */ + public static function includeScript($url, $parameter = null) { + self::includeResource("script", $url, $parameter); + } +} diff --git a/src/private/php/Utils/Utils.php b/src/private/php/Utils/Utils.php new file mode 100644 index 0000000..a2d3b59 --- /dev/null +++ b/src/private/php/Utils/Utils.php @@ -0,0 +1,132 @@ += 2) { + return "{$ip[0]}.{$ip[1]}.***.***"; + } + + return "(IPv4)"; + } + + if (filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_IPV6)) { + $ip = explode(":", $ip); + + if (count($ip) >= 2) { + return "{$ip[0]}:{$ip[1]}:***:***"; + } + + return "(IPv6)"; + } + + throw new \Exception("Invalid IP address $ip"); + } + + /** + * Returns client IP from REMOTE_ADDR or from HTTP_CF_CONNECTING_IP if using CF IP + * @param bool $useCfip if true, check and use HTTP_CF_CONNECTING_IP header if present. + * Falls back to REMOTE_ADDR if empty + * @return string IP address + */ + public static function getClientIp($useCfip = null) { + if ($useCfip === null) { + $useCfip = (bool) Config::get("usingcloudflare"); + } + + // If IPv6 localhost, return IPv4 localhost + if ($_SERVER["REMOTE_ADDR"] === "::1") { + return "127.0.0.1"; + } + + if (!empty($_SERVER["HTTP_CF_CONNECTING_IP"]) && $useCfip) { + return $_SERVER["HTTP_CF_CONNECTING_IP"]; + } + + return $_SERVER["REMOTE_ADDR"]; + } + + /** + * Returns currently used news store + * @return INewsStore|null + */ + public static function getNewsStore() { + $newsStore = null; + + // if the current implementation is default + if (true) { + $newsStore = new DefaultNewsStore(); + } + + return $newsStore; + } +} diff --git a/src/private/php/Utils/ValidationUtils.php b/src/private/php/Utils/ValidationUtils.php new file mode 100644 index 0000000..b9eda5e --- /dev/null +++ b/src/private/php/Utils/ValidationUtils.php @@ -0,0 +1,9 @@ +imgPath = $imgPath; + + $cm = CacheManager::i(); + $this->serverInfo = $cm->getServerInfo(); + $this->channelList = $cm->getChannelList(); + $this->clientList = $cm->getClientList(); + $this->serverGroupList = $cm->getServerGroupList(); + $this->channelGroupList = $cm->getChannelGroupList(); + } + + /** + * Checks if we have successfully loaded all required data from cache. + * Loading data from CacheManager might fail for example when the server is offline, + * or when we dont have required permissions to check for a specific item. + * @return bool true on success, false otherwise + */ + public function checkRequiredData() { + return isset($this->channelList, $this->clientList, $this->serverGroupList, $this->channelGroupList); + } + + private function add($html, ...$args) { + foreach ($args as $i => $iValue) { + // Prevent argument placeholder injection + $iValue = str_replace(["{", "}"], ["{", "}"], $iValue); + + $html = str_ireplace('{' . $i . '}', $iValue, $html); + } + + $this->resultHtml .= $html; + } + + public function renderViewer() { + if (!$this->checkRequiredData()) { + throw new \Exception("Failed to load required data from the cache. " . + "Is the server online? Do we have enough permissions?"); + } + + $suffixIcons = ""; + + if ($icon = $this->serverInfo["virtualserver_icon_id"]) { + $suffixIcons = $this->getIcon($icon, __get("VIEWER_SERVER_ICON")); + } + + $html = << +
+ {0}{1} + {2} +
+ + +EOD; + + $this->add( + $html, + $this->getIcon("server_green.svg"), + htmlspecialchars($this->serverInfo["virtualserver_name"]), + $suffixIcons + ); + + foreach ($this->channelList as $channel) { + // Start rendering the top channels, they are gonna + // render all the childrens recursively + if ($channel["pid"] === 0) { + $this->renderChannel(new TeamSpeakChannel($channel)); + } + } + + return $this->resultHtml; + } + + public function getIcon($name, $tooltip = null, $alt = "Icon") { + if (is_string($name)) { + $path = "{$this->imgPath}/$name"; + } else { + $path = "api/geticon.php?iconid=" . (int) $name; + } + + $ttip = $tooltip ? ' data-toggle="tooltip" title="' . htmlspecialchars($tooltip) . '"' : ""; + return '' . htmlspecialchars($alt) . ''; + } + + /** + * @param $channel TeamSpeakChannel + */ + public function renderChannel($channel) { + $hasParent = $channel->getParentId(); + + $isHidden = in_array($channel->getId(), $this->hiddenChannels); + $channelDisplayName = $channel->getDisplayName(); + $channelClasses = $hasParent ? "has-parent" : "no-parent"; + $channelIcon = ""; + $suffixIcons = ""; + + // If this channel is occupied + if ($channel->isOccupied(false, $this->renderQueryClients) && !$isHidden) { + $channelClasses .= " is-occupied"; + } else if ($channel->isOccupied(true, $this->renderQueryClients) && !$isHidden) { + $channelClasses .= " occupied-childs"; + } else { + $channelClasses .= " not-occupied"; + } + + if ($channel->isSpacer()) { + $channelClasses .= " is-spacer"; + + switch($channel->getSpacerAlign()) { + case TeamSpeak3::SPACER_ALIGN_REPEAT: + $channelClasses .= " spacer-repeat"; + $channelDisplayName = str_repeat($channelDisplayName, 200); + break; + case TeamSpeak3::SPACER_ALIGN_CENTER: + $channelClasses .= " spacer-center"; + break; + case TeamSpeak3::SPACER_ALIGN_RIGHT: + $channelClasses .= " spacer-right"; + break; + case TeamSpeak3::SPACER_ALIGN_LEFT: + $channelClasses .= " spacer-left"; + break; + } + } else { + $channelIcon = $this->getChannelIcon($channel, $isHidden); + $suffixIcons = $this->getChannelSuffixIcons($channel); + } + + $html = << +
+ {3}{4} + {5} +
+ +EOD; + + $this->add( + $html, + $channelClasses, + $channel->getId(), + $channel->isSpacer() ? "" : ' tabindex="0"', + $channelIcon, + htmlspecialchars($channelDisplayName), + $suffixIcons + ); + + if (!$isHidden) { + foreach ($channel->getChannelMembers($this->renderQueryClients) as $member) { + $this->renderClient($member); + } + } + + foreach ($channel->getChildChannels() as $member) { + $this->renderChannel($member); + } + + $this->add('' . PHP_EOL . PHP_EOL); + } + + public function renderClient($client) { + $isQuery = (bool) $client["client_type"]; + + $clientSGIDs = explode(",", $client["client_servergroups"]); + $clientServerGroups = []; + + $beforeName = []; + $afterName = []; + + if (isset($client["client_away_message"])) { + $afterName[] = "[{$client["client_away_message"]}]"; + } + + foreach ($this->serverGroupList as $servergroup) { + $groupid = $servergroup["sgid"]; + + if (in_array($groupid, $clientSGIDs)) { + $clientServerGroups[$groupid] = $servergroup; + + if ($servergroup["namemode"] === TeamSpeak3::GROUP_NAMEMODE_BEFORE) { + $beforeName[] = "[{$servergroup["name"]}]"; + } + + if ($servergroup["namemode"] === TeamSpeak3::GROUP_NAMEMODE_BEHIND) { + $afterName[] = "[{$servergroup["name"]}]"; + } + } + } + + $clientIcon = $this->getClientIcon($client); + $suffixIcons = $this->getClientSuffixIcons($client, $clientServerGroups, 0); + + $html = << + {2}{3} + {4} + + +EOD; + + $clientName = implode(" ", $beforeName); // prefix groups + $clientName .= " {$client["client_nickname"]} "; // nickname + $clientName .= implode(" ", $afterName); // suffix groups + $clientName = htmlspecialchars(trim($clientName)); // trim and sanitize + + $this->add( + $html, + $isQuery ? " is-query" : "", $client["client_database_id"], + $clientIcon, + $clientName, + $suffixIcons + ); + } + + private function getChannelIcon(TeamSpeakChannel $channel, $isHidden) { + $subscribed = $isHidden ? "" : "_subscribed"; + $unsub = $isHidden ? __get("VIEWER_CHANNEL_UNSUB1") : ""; + + if ($channel->isDefaultChannel()) { + return $this->getIcon("channel_default.svg", __get("VIEWER_DEFAULT_CHANNEL")); + } + + if ($channel->isFullyOccupied()) { + return $this->getIcon("channel_red{$subscribed}.svg", __get("VIEWER_CHANNEL_OCCUPIED") . $unsub); + } + + if ($channel->hasPassword()) { + return $this->getIcon("channel_yellow{$subscribed}.svg", __get("VIEWER_CHANNEL_PASSWORD") . $unsub); + } + + return $this->getIcon("channel_green{$subscribed}.svg", $isHidden ? __get("VIEWER_CHANNEL_UNSUB2") : null); + } + + private function getChannelSuffixIcons(TeamSpeakChannel $channel) { + $info = $channel->getInfo(); + $html = ""; + + if($channel->isDefaultChannel()) { + $html .= $this->getIcon("default.svg", __get("VIEWER_DEFAULT_CHANNEL")); + } + + if($info["channel_flag_password"]) { + $html .= $this->getIcon("channel_private.svg", __get("VIEWER_CHANNEL_PASSWORD")); + } + + $codec = $info["channel_codec"]; + if($codec === TeamSpeak3::CODEC_CELT_MONO || $codec === TeamSpeak3::CODEC_OPUS_MUSIC) { + $html .= $this->getIcon("music.svg", __get("VIEWER_CHANNEL_MUSIC_CODED")); + } + + if($info["channel_needed_talk_power"]) { + $html .= $this->getIcon("moderated.svg", __get("VIEWER_CHANNEL_MODERATED")); + } + + if($info["channel_icon_id"]) { + $html .= $this->getIcon($info["channel_icon_id"], __get("VIEWER_CHANNEL_ICON")); + } + + return $html; + } + + public function getClientIcon($client) { + if($client["client_type"]) { + return $this->getIcon("server_query.svg"); + } + + if($client["client_away"]) { + return $this->getIcon("away.svg", htmlspecialchars($client["client_away_message"]) ?: __get("VIEWER_CLIENT_AWAY")); + } + + if(!$client["client_output_hardware"]) { + return $this->getIcon("hardware_output_muted.svg", __get("VIEWER_CLIENT_OUTPUT_DISABLED")); + } + + if($client["client_output_muted"]) { + return $this->getIcon("output_muted.svg", __get("VIEWER_CLIENT_OUTPUT_MUTED")); + } + + if(!$client["client_input_hardware"]) { + return $this->getIcon("hardware_input_muted.svg", __get("VIEWER_CLIENT_MIC_DISABLED")); + } + + if($client["client_input_muted"]) { + return $this->getIcon("input_muted.svg", __get("VIEWER_CLIENT_MIC_MUTED")); + } + + if($client["client_is_channel_commander"]) { + return $this->getIcon("player_commander_off.svg", __get("VIEWER_CLIENT_COMMANDER")); + } + + return $this->getIcon("player_off.svg"); + } + + public function getClientSuffixIcons($client, $groups, $cntp) { + $html = ""; + + if($client["client_is_priority_speaker"]) { + $html .= $this->getIcon("microphone.svg", __get("VIEWER_CLIENT_PRIORITY_SPEAKER")); + } + + if($client["client_is_channel_commander"]) { + $html .= $this->getIcon("channel_commander.svg", __get("VIEWER_CLIENT_COMMANDER")); + } + + if($client["client_is_talker"]) { + $html .= $this->getIcon("talk_power_grant.svg", __get("VIEWER_CLIENT_TALK_POWER_GRANTED")); + } else if($cntp && $cntp > $client["client_talk_power"]) { + $html .= $this->getIcon("input_muted.svg", __get("VIEWER_CLIENT_TALK_POWER_INSUFFICIENT")); + } + + foreach ($groups as $group) { + if ($group["iconid"]) { + $icon = $group["iconid"]; + } else { + $icon = "broken_image.svg"; + continue; + // If the group does not have an icon, we skip this group. + // However, you can comment out the above "continue" statement + // to show the group with a "broken-image" icons. + } + + $html .= $this->getIcon($icon, htmlspecialchars($group["name"])); + } + + if($client["client_icon_id"]) { + $html .= $this->getIcon($client["client_icon_id"], __get("VIEWER_CLIENT_ICON")); + } + + if($client["client_country"]) { + $country = $client["client_country"]; + $countryLower = strtolower($country); + $html .= ''; + } + + return $html; + } +} diff --git a/src/private/php/constants.php b/src/private/php/constants.php new file mode 100644 index 0000000..acb816b --- /dev/null +++ b/src/private/php/constants.php @@ -0,0 +1,28 @@ +> 1, $j = 0; $i < $len; ++$i, ++$j) { + switch (true) { + case $s[$i] < "\x80": $s[$j] = $s[$i]; break; + case $s[$i] < "\xC0": $s[$j] = "\xC2"; $s[++$j] = $s[$i]; break; + default: $s[$j] = "\xC3"; $s[++$j] = chr(ord($s[$i]) - 64); break; + } + } + return substr($s, 0, $j); + } +} diff --git a/src/private/php/load.php b/src/private/php/load.php new file mode 100644 index 0000000..95027a4 --- /dev/null +++ b/src/private/php/load.php @@ -0,0 +1,87 @@ +detectUserLanguage(); + + if(!$lang) { + $lang = LanguageUtils::i()->getDefaultLanguage(); + } + + $_SESSION["userlanguageid"] = $lang->getLanguageId(); +} + +// Shortcut to language functions +{ + /** + * Shortcut to translate and output the result + */ + function __($identifier, $args = []) { + echo __get($identifier, $args); + } + + /** + * Shortcut to translate and return the result + */ + function __get($identifier, $args = []) { + try { + return LanguageUtils::i()->translate($identifier, $args); + } catch (\Exception $e) { + return "(unknown translation for " . htmlspecialchars($identifier) . ")"; + } + } +} + +// Set timezone +date_default_timezone_set(Config::get("timezone")); + +// Init TS3 library +// This makes it possible to cache TS3 library objects +TeamSpeak3::init(); + +// Sync server icon cache if needed +ServerIconCache::syncIfNeeded(); diff --git a/src/private/templates/admin-status.latte b/src/private/templates/admin-status.latte new file mode 100644 index 0000000..804afe6 --- /dev/null +++ b/src/private/templates/admin-status.latte @@ -0,0 +1,126 @@ +{* This file is a little hard to read... sorry! :( *} + +{define admin-status-template} + {var $isOnline = isset($client["clid"])} +
+ + {if $iconBeforeName} + {if $group["iconid"]} + {$group[ + {else} + {$group["name"]} + {/if} + {/if} + {$client["client_nickname"]} + + + {if $isOnline} + {if $client["client_away"]} + {ifset $client["client_away_message"]} + + {_"ADMIN_STATUS_AWAY"} + + + {else} + {_"ADMIN_STATUS_AWAY"} + {/ifset} + {else} + {_"ADMIN_STATUS_ONLINE"} + {/if} + {else} + {_"ADMIN_STATUS_OFFLINE"} + {/if} + +
+{/define} + +{* STATUS_STYLE_GROUPED or STATUS_STYLE_GROUPED_HIDE_EMPTY_GROUPS *} +{if $format === 1 || $format === 2} +
+ {if !$data} +
+ + {_"ADMIN_STATUS_EMPTY_STATUS"} + +
+ {/if} + + {foreach $data as $sgid => $group} + {* additional div, mainly used for additional *} + {* styling with css for the first group *} +
+ {* Only show group header when there are clients *} + {* in the group OR if the format allows us *} + {* to show empty groups *} + {if $format !== 2 || $group["clients"]} +
+ {if $group["iconid"]} + {$group[ + {/if} + {$group["name"]} +
+ + {if !$group["clients"]} +
{_"ADMIN_STATUS_EMPTY_GROUP"}
+ {/if} + {/if} + + {foreach $group["clients"] as $client} + {include admin-status-template, iconBeforeName => false, client => $client, group => $group} + {/foreach} +
+ {/foreach} +
+{/if} + +{* STATUS_STYLE_LIST *} +{if $format === 3} +
+ {if !$data} +
+ + {_"ADMIN_STATUS_EMPTY_STATUS"} + +
+ {/if} + + {var $lastGroup = null} + + {foreach $data as $sgid => $group} + {foreach $group["clients"] as $client} + + {* This thing detects when we are looping though a new group *} + {* and before we start printing clients from it, it inserts a *} + {* group separator that creates a little space between different groups *} + {if $lastGroup !== $group} + {* here we check if $lastGroup is not NULL *} + {* this way we dont put a spacer before the first group *} + {if $lastGroup} +
+ {/if} + + {var $lastGroup = $group} + {/if} + + {include admin-status-template, iconBeforeName => true, client => $client, group => $group} + {/foreach} + {/foreach} +
+{/if} + +{* STATUS_STYLE_LIST_ONLINE_FIRST *} +{if $format === 4} +
+ {if !$data} +
+ + {_"ADMIN_STATUS_EMPTY_STATUS"} + +
+ {/if} + + {foreach $data as $entry} + {include admin-status-template, iconBeforeName => true, client => $entry["client"], group => $entry["group"]} + {/foreach} +
+{/if} diff --git a/src/private/templates/assigner.latte b/src/private/templates/assigner.latte new file mode 100644 index 0000000..9d6b423 --- /dev/null +++ b/src/private/templates/assigner.latte @@ -0,0 +1,122 @@ +{extends "body.latte"} +{var title = __get("ASSIGNER_TITLE")} +{var navActiveIndex = 2} + +{block content} + +
+
+ {_"ASSIGNER_PANEL_TITLE"} +
+
+ {if !$isLoggedIn} +
+

{_"ASSIGNER_NOT_LOGGED_IN"}

+ + +
+ {elseif $assignerConfig === null} + {include "utils/data-problem.latte", message => __get("CANNOT_GET_DATA", "assigner")} + {elseif empty($assignerConfig)} +
+ {_"ASSIGNER_NOT_CONFIGURED"} +
+ {else} + {ifset $groupChangeStatus} + {if $groupChangeStatus === 0} {* saved *} + + {elseif $groupChangeStatus === 1} {* no change *} + + {else} {* something went wrong *} + + {/if} + {/ifset} + +
+ {foreach $assignerConfig as $row} +
+ {foreach $row as $assignerCategory} +
+
    +
  • +
    + {$assignerCategory["name"]} +
    +
    + +
    +
  • + + {foreach $assignerCategory["groups"] as $group} + + {/foreach} +
+
+ {/foreach} +
+ {/foreach} + + {$csrfField} + + + + + + +
+ + +
+ +
+
+ +
+ {/if} +
+
+ +{/block} + +{block footerbottom} + {$tplutils::includeScript("js/assigner.js", true)} +{/block} diff --git a/src/private/templates/bans.latte b/src/private/templates/bans.latte new file mode 100644 index 0000000..564e2dc --- /dev/null +++ b/src/private/templates/bans.latte @@ -0,0 +1,72 @@ +{extends "body.latte"} +{var title = __get("BANS_TITLE")} +{var navActiveIndex = 3} + +{block content} + +
+
+ {_"BANS_PANEL_TITLE"} +
+
+ {if $banlist === null || $banlist === false} + {include "utils/data-problem.latte", message => __get("CANNOT_GET_DATA", "banlist")} + {elseif empty($banlist)} + + {else} + + + {if $ipbanned !== false} + + {/if} + + + + + + + + + + + + + {foreach $banlist as $ban} + {var $expiretime = $ban["created"] + $ban["duration"]} + + + + + + + + {/foreach} + +
{_"BANS_HEADER_NAME"}{_"BANS_HEADER_REASON"}{_"BANS_HEADER_INVOKER"}{_"BANS_HEADER_BANDATE"}{_"BANS_HEADER_EXPIRES"}
{$ban["name"]}{$ban["reason"]}{$ban["invoker"]}{$ban["created"]|fullDate}{$ban["duration"] ? ($expiretime|fuzzyDateAbbr) : ("BANS_NEVEREXPIRES"|translate)}
+ {/if} +
+
+{/block} + +{block footerbottom} + + + {$tplutils::includeScript("js/bans.js", true)} +{/block} diff --git a/src/private/templates/body.latte b/src/private/templates/body.latte new file mode 100644 index 0000000..8258a10 --- /dev/null +++ b/src/private/templates/body.latte @@ -0,0 +1,219 @@ +{php +$utils = Wruczek\TSWebsite\Utils\Utils::class; +$tplutils = Wruczek\TSWebsite\Utils\TemplateUtils::i(); +$auth = Wruczek\TSWebsite\Auth::class; +$userlangcode = $userLanguage->getLanguageCode(); +$navActiveIndex = isset($navActiveIndex) ? (int) $navActiveIndex : 0; +} + + + + + + + + + + {$title} | {$config["website_title"]} + + + {$tplutils::includeStylesheet("{cdnjs}/twitter-bootstrap/4.1.3/css/bootstrap.min.css", "sha256-eSi1q2PG6J7g7ib17yAaWMcrr5GrtohYChqibrV7PBE=")} + + + {$tplutils::includeStylesheet("https://use.fontawesome.com/releases/v5.2.0/css/all.css", "sha256-iJGhYPiir7gd5SWfn2jlrzeCNI6iknrZ6Wm8iMfTmYQ=")} + + + {$tplutils::includeStylesheet("{cdnjs}/datatables/1.10.19/css/dataTables.bootstrap4.min.css", "sha256-F+DaKAClQut87heMIC6oThARMuWne8+WzxIDT7jXuPA=")} + + + {$tplutils::includeStylesheet("css/flags/famfamfam-flags.min.css", true)} + {$tplutils::includeStylesheet("css/style.css", true)} + {$tplutils::includeStylesheet("css/loader.css", true)} + {$tplutils::includeStylesheet("css/cookiealert.css", true)} + {$tplutils::includeStylesheet("css/themes/dark.css", true)} + + {if __DEV_MODE} + + {$tplutils::includeStylesheet("css/dev.css", true)} + {/if} + + + + + + + +{if !$auth::isLoggedIn()} + {include "utils/modal-login.latte"} +{/if} + + + +
+ {ifset $oldestTimestamp} + {include "utils/data-problem.latte", message => ("OUTDATED_DATA"|translate,($oldestTimestamp|fuzzyDateAbbr))} + {/ifset} + + {if $tsExceptions} + {include "utils/data-problem.latte", message => "We are having trouble communicating with the server. Some parts of the website might not be working as expected."} + {/if} + +
+ +
+ {block content}{/block} +
+ + +
+ {include "sidebar.latte"} +
+
+
+ + +{include "utils/cookiealert.latte"} + + +
+
+ © WebsiteTitle.tech {date("Y")} + + {if $config["imprint_enabled"]}3 + — imprint + {/if} +
+ +
+ + + + + + +{$tplutils::includeScript("{cdnjs}/jquery/3.3.1/jquery.min.js", "sha256-FgpCb/KJQlLNfOu91ta32o/NMZxltwRo8QtmkMRdAu8=")} + + +{$tplutils::includeScript("{cdnjs}/popper.js/1.14.4/umd/popper.min.js", "sha256-EGs9T1xMHdvM1geM8jPpoo8EZ1V1VRsmcJz8OByENLA=")} + + +{$tplutils::includeScript("{cdnjs}/twitter-bootstrap/4.1.3/js/bootstrap.min.js", "sha256-VsEqElsCHSGmnmHXGQzvoWjWwoznFSZc6hs7ARLRacQ=")} + + +{$tplutils::includeScript("{cdnjs}/js-cookie/2.2.0/js.cookie.min.js", "sha256-9Nt2r+tJnSd2A2CRUvnjgsD+ES1ExvjbjBNqidm9doI=")} + + + +{$tplutils::includeScript("{cdnjs}/moment.js/2.22.2/moment.min.js", "sha256-CutOzxCRucUsn6C6TcEYsauvvYilEniTXldPa6/wu0k=")} + +{var momentjslang = Wruczek\TSWebsite\Utils\Language\LanguageUtils::tl("MOMENTJS_LANG")} +{if $momentjslang !== "en-us"} + {$tplutils::includeScript("{cdnjs}/moment.js/2.22.2/locale/$momentjslang.js")} + +{/if} + + +{$tplutils::includeScript("{cdnjs}/datatables/1.10.19/js/jquery.dataTables.min.js", "sha256-t5ZQTZsbQi8NxszC10CseKjJ5QeMw5NINtOXQrESGSU=")} +{$tplutils::includeScript("{cdnjs}/datatables/1.10.19/js/dataTables.bootstrap4.min.js", "sha256-hJ44ymhBmRPJKIaKRf3DSX5uiFEZ9xB/qx8cNbJvIMU=")} + + +{$tplutils::includeScript("https://cdn.datatables.net/responsive/2.2.3/js/dataTables.responsive.min.js", "sha256-7Tbik5KSODuGiOLIOFfhP47p5UK6h1wzw8CFSI/TKhc=")} +{$tplutils::includeScript("https://cdn.datatables.net/responsive/2.2.3/js/responsive.bootstrap4.min.js", "sha256-aXVO47Rb7s58FhMTCwbM39en/1XcmzGkClRzBe5txKs=")} + + +{$tplutils::includeScript("js/script.js", true)} +{$tplutils::includeScript("js/status.js", true)} +{$tplutils::includeScript("js/login.js", true)} + +{block footerbottom}{/block} + + + + + diff --git a/src/private/templates/bootstrap-theme-test.latte b/src/private/templates/bootstrap-theme-test.latte new file mode 100644 index 0000000..a583429 --- /dev/null +++ b/src/private/templates/bootstrap-theme-test.latte @@ -0,0 +1,1272 @@ +{extends "body.latte"} +{var title = "TESTING"} + +{block content} +
+
+ + +
+ + +
+
+ +

+ + + + + + + +

+ +

+ + + + + + + +

+ +

+ + + + + + +

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

+ +

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

Heading 1

+

Heading 2

+

Heading 3

+

Heading 4

+
Heading 5
+
Heading 6
+

+ Heading + with muted text +

+

Vivamus sagittis lacus vel augue laoreet rutrum faucibus dolor auctor.

+
+
+
+
+

Example body text

+

Nullam quis risus eget urna mollis ornare vel eu leo. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Nullam id dolor id nibh ultricies vehicula.

+

This line of text is meant to be treated as fine print.

+

The following is rendered as bold text.

+

The following is rendered as italicized text.

+

An abbreviation of the word attribute is attr.

+
+ +
+
+
+

Emphasis classes

+

Fusce dapibus, tellus ac cursus commodo, tortor mauris nibh.

+

Nullam id dolor id nibh ultricies vehicula ut id elit.

+

Etiam porta sem malesuada magna mollis euismod.

+

Donec ullamcorper nulla non metus auctor fringilla.

+

Duis mollis, est non commodo luctus, nisi erat porttitor ligula.

+

Maecenas sed diam eget risus varius blandit sit amet non magna.

+
+ +
+
+ + + +
+
+

Blockquotes

+
+
+
+
+
+
+

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer posuere erat a ante.

+
Someone famous in Source Title
+
+
+
+
+
+
+

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer posuere erat a ante.

+
Someone famous in Source Title
+
+
+
+
+
+
+

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer posuere erat a ante.

+
Someone famous in Source Title
+
+
+
+
+
+ + +
+ +
+
+ + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
TypeColumn headingColumn headingColumn heading
ActiveColumn contentColumn contentColumn content
DefaultColumn contentColumn contentColumn content
PrimaryColumn contentColumn contentColumn content
SecondaryColumn contentColumn contentColumn content
SuccessColumn contentColumn contentColumn content
DangerColumn contentColumn contentColumn content
WarningColumn contentColumn contentColumn content
InfoColumn contentColumn contentColumn content
LightColumn contentColumn contentColumn content
DarkColumn contentColumn contentColumn content
+
+
+
+
+ + +
+
+
+ +
+
+ +
+
+
+
+
+ Legend +
+ +
+ +
+
+
+ + + We'll never share your email with anyone else. +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + + This is some placeholder block-level help text for the above input. It's a bit lighter and easily wraps to a new line. +
+
+ Radio buttons +
+ +
+
+ +
+
+ +
+
+
+ Checkboxes +
+ +
+
+ +
+
+ +
+
+
+
+
+ +
+
+
+ + +
+
+ +
+
+ + +
+
+ +
+ + +
Success! You've done it.
+
+ +
+ + +
Sorry, that username's taken. Try another?
+
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ +
+
+
+ $ +
+ +
+ .00 +
+
+
+
+
+ +
+
+ Custom forms +
+
+ + +
+
+ + +
+
+ + +
+
+
+
+ + +
+
+ + +
+
+
+ +
+
+
+
+ + +
+
+ Upload +
+
+
+
+
+ +
+
+
+ + +
+ +
+
+ +
+
+ +
+
+ +
+ +
+
+

Raw denim you probably haven't heard of them jean shorts Austin. Nesciunt tofu stumptown aliqua, retro synth master cleanse. Mustache cliche tempor, williamsburg carles vegan helvetica. Reprehenderit butcher retro keffiyeh dreamcatcher synth. Cosby sweater eu banh mi, qui irure terry richardson ex squid. Aliquip placeat salvia cillum iphone. Seitan aliquip quis cardigan american apparel, butcher voluptate nisi qui.

+
+
+

Food truck fixie locavore, accusamus mcsweeney's marfa nulla single-origin coffee squid. Exercitation +1 labore velit, blog sartorial PBR leggings next level wes anderson artisan four loko farm-to-table craft beer twee. Qui photo booth letterpress, commodo enim craft beer mlkshk aliquip jean shorts ullamco ad vinyl cillum PBR. Homo nostrud organic, assumenda labore aesthetic magna delectus mollit.

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

Pagination

+
+
+
    +
  • + « +
  • +
  • + 1 +
  • +
  • + 2 +
  • +
  • + 3 +
  • +
  • + 4 +
  • +
  • + 5 +
  • +
  • + » +
  • +
+
+ +
+
    +
  • + « +
  • +
  • + 1 +
  • +
  • + 2 +
  • +
  • + 3 +
  • +
  • + 4 +
  • +
  • + 5 +
  • +
  • + » +
  • +
+
+ +
+
    +
  • + « +
  • +
  • + 1 +
  • +
  • + 2 +
  • +
  • + 3 +
  • +
  • + 4 +
  • +
  • + 5 +
  • +
  • + » +
  • +
+
+ +
+
+
+
+ + +
+ +
+
+ +
+
+ +
+
+

Alerts

+
+
+ +

Warning!

+

Best check yo self, you're not looking too good. Nulla vitae elit libero, a pharetra augue. Praesent commodo cursus magna, vel scelerisque nisl consectetur et.

+
+
+
+
+
+
+
+
+ + Oh snap! Change a few things up and try submitting again. +
+
+
+
+
+
+ + Well done! You successfully read this important alert message. +
+
+
+
+
+
+ + Heads up! This alert needs your attention, but it's not super important. +
+
+
+
+
+
+
+
+ + Oh snap! Change a few things up and try submitting again. +
+
+
+
+
+
+ + Well done! You successfully read this important alert message. +
+
+
+
+
+
+ + Heads up! This alert needs your attention, but it's not super important. +
+
+
+
+
+

Badges

+
+ Primary + Secondary + Success + Danger + Warning + Info + Light + Dark +
+
+ Primary + Secondary + Success + Danger + Warning + Info + Light + Dark +
+
+
+ + +
+ +
+
+ + +

Basic

+
+
+
+
+
+ +

Contextual alternatives

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

Multiple bars

+
+
+
+
+
+
+
+ +

Striped

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

Animated

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

Hello, world!

+

This is a simple hero unit, a simple jumbotron-style component for calling extra attention to featured content or information.

+
+

It uses utility classes for typography and spacing to space content out within the larger container.

+

+ Learn more +

+
+
+
+
+ + +
+
+

List groups

+
+
+ + + +
+
+

Cards

+
+
+ +
+
+
+
+
Header
+
+

Primary card title

+

Some quick example text to build on the card title and make up the bulk of the card's content.

+
+
+
+
Header
+
+

Secondary card title

+

Some quick example text to build on the card title and make up the bulk of the card's content.

+
+
+
+
Header
+
+

Success card title

+

Some quick example text to build on the card title and make up the bulk of the card's content.

+
+
+
+
Header
+
+

Danger card title

+

Some quick example text to build on the card title and make up the bulk of the card's content.

+
+
+
+
Header
+
+

Warning card title

+

Some quick example text to build on the card title and make up the bulk of the card's content.

+
+
+
+
Header
+
+

Info card title

+

Some quick example text to build on the card title and make up the bulk of the card's content.

+
+
+
+
Header
+
+

Light card title

+

Some quick example text to build on the card title and make up the bulk of the card's content.

+
+
+
+
Header
+
+

Dark card title

+

Some quick example text to build on the card title and make up the bulk of the card's content.

+
+
+
+
+
+
+
+
Header
+
+

Primary card title

+

Some quick example text to build on the card title and make up the bulk of the card's content.

+
+
+
+
Header
+
+

Secondary card title

+

Some quick example text to build on the card title and make up the bulk of the card's content.

+
+
+
+
Header
+
+

Success card title

+

Some quick example text to build on the card title and make up the bulk of the card's content.

+
+
+
+
Header
+
+

Danger card title

+

Some quick example text to build on the card title and make up the bulk of the card's content.

+
+
+
+
Header
+
+

Warning card title

+

Some quick example text to build on the card title and make up the bulk of the card's content.

+
+
+
+
Header
+
+

Info card title

+

Some quick example text to build on the card title and make up the bulk of the card's content.

+
+
+
+
Header
+
+

Light card title

+

Some quick example text to build on the card title and make up the bulk of the card's content.

+
+
+
+
Header
+
+

Dark card title

+

Some quick example text to build on the card title and make up the bulk of the card's content.

+
+
+
+
+ +
+
+
+

Card header

+
+
Special title treatment
+
Support card subtitle
+
+ Card image +
+

Some quick example text to build on the card title and make up the bulk of the card's content.

+
+
    +
  • Cras justo odio
  • +
  • Dapibus ac facilisis in
  • +
  • Vestibulum at eros
  • +
+ + +
+
+
+

Card title

+
Card subtitle
+

Some quick example text to build on the card title and make up the bulk of the card's content.

+ Card link + Another link +
+
+
+
+
+ +
+ + +
+ +
+
+ +
+
+
+
+

Modals

+
+ +
+
+
+

Popovers

+
+ + + + + + + +
+

Tooltips

+
+ + + + + + + +
+
+
+
+
+
+{/block} diff --git a/src/private/templates/errorpage.latte b/src/private/templates/errorpage.latte new file mode 100644 index 0000000..708a403 --- /dev/null +++ b/src/private/templates/errorpage.latte @@ -0,0 +1,131 @@ + + + + + + + + + {$errorname} + + + + + + + + + +
+ +
+ +
+ +
+
+ {$errorcode} +
+ + {* Add dark-color when description is not set *} +
+ {$errorname} +
+ +
+ {$description} +
+ +
+ Try again + + Go back +
+
+ +
+ + + diff --git a/src/private/templates/faq.latte b/src/private/templates/faq.latte new file mode 100644 index 0000000..431a570 --- /dev/null +++ b/src/private/templates/faq.latte @@ -0,0 +1,43 @@ +{extends "body.latte"} +{var title = __get("FAQ_TITLE")} +{var navActiveIndex = 5} + +{block content} +
+
+ {_"FAQ_PANEL_TITLE"} +
+
+ {$additionaltext|noescape} + +
+ {foreach $qa as $id => $value} +
+
+ + +
+ +
+
+ {$value["answer"]|noescape} +
+
+
+ {/foreach} +
+
+
+{/block} + +{block footerbottom} + + {$tplutils::includeScript("js/faq.js", true)} +{/block} diff --git a/src/private/templates/index.latte b/src/private/templates/index.latte new file mode 100644 index 0000000..6f62009 --- /dev/null +++ b/src/private/templates/index.latte @@ -0,0 +1,82 @@ +{extends "body.latte"} +{var title = __get("HOME_TITLE")} + +{block content} +
+
+ {_"HOME_PANEL_TITLE"} +
+
+ + {if $newsList === null || $newsList === false} + {include "utils/data-problem.latte", message => __get("CANNOT_GET_DATA", "news")} + {elseif $newsCount === 0} + + {elseif !$newsList} + + {else} + {foreach $newsList as $news} +
+
+
+ {ifset $news["link"]} + + {$news["title"]} + + {else} + {$news["title"]} + {/ifset} +
+
+
+

{$news["description"]|noescape}

+
+
+ {/foreach} + + {* Pagination logic *} + {* show the pagination only if we have more than 1 page *} +
+ +
+ {/if} +{/block} diff --git a/src/private/templates/sidebar.latte b/src/private/templates/sidebar.latte new file mode 100644 index 0000000..859e0f7 --- /dev/null +++ b/src/private/templates/sidebar.latte @@ -0,0 +1,91 @@ +
+
+ {_"STATUS_PANEL_TITLE"} +
+
+
+
+
+ + + + +
+
+ +{ifset $adminStatus} + {var offlineHiddenByDefault = $config["adminstatus_offlinehiddenbydefault"]} +
+
+ + {_"ADMIN_STATUS_PANEL_TITLE"} + + + + + +
+
+ {if $adminStatus !== false} + {include "admin-status.latte", + data => $adminStatus["data"], + format => $adminStatus["format"], + defaultHide => $offlineHiddenByDefault + } + {else} +
+ + {_"ADMIN_STATUS_ERROR"} + +
+ {/if} +
+
+{/ifset} diff --git a/src/private/templates/simple-page.latte b/src/private/templates/simple-page.latte new file mode 100644 index 0000000..563562e --- /dev/null +++ b/src/private/templates/simple-page.latte @@ -0,0 +1,13 @@ +{extends "body.latte"} +{var title = $pagetitle} + +{block content} +
+
+ {$paneltitle|noescape} +
+
+ {$panelcontent|noescape} +
+
+{/block} diff --git a/src/private/templates/utils/cookiealert.latte b/src/private/templates/utils/cookiealert.latte new file mode 100644 index 0000000..b467558 --- /dev/null +++ b/src/private/templates/utils/cookiealert.latte @@ -0,0 +1,7 @@ + diff --git a/src/private/templates/utils/data-problem.latte b/src/private/templates/utils/data-problem.latte new file mode 100644 index 0000000..08c0f0f --- /dev/null +++ b/src/private/templates/utils/data-problem.latte @@ -0,0 +1,16 @@ + diff --git a/src/private/templates/utils/google-analytics.latte b/src/private/templates/utils/google-analytics.latte new file mode 100644 index 0000000..6dee22c --- /dev/null +++ b/src/private/templates/utils/google-analytics.latte @@ -0,0 +1,11 @@ + + + diff --git a/src/private/templates/utils/modal-login.latte b/src/private/templates/utils/modal-login.latte new file mode 100644 index 0000000..d77b8df --- /dev/null +++ b/src/private/templates/utils/modal-login.latte @@ -0,0 +1,82 @@ + + diff --git a/src/private/templates/utils/piwik.latte b/src/private/templates/utils/piwik.latte new file mode 100644 index 0000000..f5b391a --- /dev/null +++ b/src/private/templates/utils/piwik.latte @@ -0,0 +1,14 @@ + + + diff --git a/src/private/templates/viewer.latte b/src/private/templates/viewer.latte new file mode 100644 index 0000000..9d1ccbe --- /dev/null +++ b/src/private/templates/viewer.latte @@ -0,0 +1,52 @@ +{extends "body.latte"} +{var title = __get("VIEWER_TITLE")} +{var navActiveIndex = 1} + +{block content} +
+
+ + {_"VIEWER_PANEL_TITLE"} + + + + + +
+
+ {if $html === null} + {include "utils/data-problem.latte", message => __get("CANNOT_GET_DATA", "viewer")} + {else} + + +
+ {$html|noescape} +
+ {/if} +
+
+{/block} + +{block footerbottom} + + {$tplutils::includeScript("js/viewer.js", true)} +{/block} diff --git a/src/rules.php b/src/rules.php new file mode 100644 index 0000000..a2bf640 --- /dev/null +++ b/src/rules.php @@ -0,0 +1,14 @@ + __get("RULES_TITLE"), + "navActiveIndex" => 4, + "paneltitle" => '' . __get("RULES_PANEL_TITLE"), + "panelcontent" => "Rules in HTML" +]; + +TemplateUtils::i()->renderTemplate("simple-page", $data); diff --git a/src/viewer.php b/src/viewer.php new file mode 100644 index 0000000..0e38bc1 --- /dev/null +++ b/src/viewer.php @@ -0,0 +1,15 @@ +checkRequiredData()) { + $html = $viewerRenderer->renderViewer(); +} + +TemplateUtils::i()->renderTemplate("viewer", ["html" => $html]);