diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..194d635 --- /dev/null +++ b/.gitignore @@ -0,0 +1,5 @@ +.DS_Store +cache/* +vendor/* +coverage/* +node_modules/* diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..fae9e1e --- /dev/null +++ b/.travis.yml @@ -0,0 +1,37 @@ +# language used in the project +language: php +os: linux +dist: precise + +# list any PHP version to test against +php: + - 7.0 + - 7.1 + +# restricting the use of root privileges +sudo: false + +# cache directories +cache: + directories: + - cache + - vendor + - $HOME/.composer/cache + +# installing dependencies +install: + - npm install + - npm install -g gulp-cli karma-cli + - gulp + - composer install --no-interaction --prefer-source + +# checks to run before scripts +before_script: + # php syntax check (lint) + - if find . -name "*.php" ! -path "./vendor/*" -exec php -l {} \; | grep "unexpected $end"; then exit 1; fi + - ./vendor/bin/phpcs --standard=PSR2 includes/ modules/ request/ index.php + +# scripts like phpunit test +script: + - ./vendor/bin/phpunit tests/phpUnitTests/ + - ./node_modules/karma/bin/karma start jasmine.config.js --single-run diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..9398c9c --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,12 @@ +# Contributing Guidelines +* You can join our [slack channel](http://systers.io/slack-systers-opensource/). Each active repo has its own channel to direct questions to (for example #powerup or #portal). +* Remember that this is an inclusive community, committed to creating a safe, positive environment. See the full [Code of Conduct](http://www.systers.io/code-of-conduct.html). +## General Guidelines +* If you’re just getting started work on an issue labeled “First Timers Only” in any project. Additional resources are available on our [website](http://www.systers.io). +* In an active repository (not an archived one), choose an open issue from the issue list, claim it in the comments, and a maintainer will assign it to you. +* After approval you must make continuous notes on your progress in the issue while working. If there is not at least one comment every 3 days, the maintainer can reassign the issue. +* When sending a PR have an appropriate title referencing the issue which it solves. Add “fixes #” in the commit body, so that when the PR gets merged, the issue gets closed automatically. Do not do this if the PR solves only a part of the issue. See more information on commit guidelines [here](https://udacity.github.io/git-styleguide/). +* If you’d like to create a new issue, please go through our issue list first (open as well as closed) and make sure the issues you are reporting do not replicate the existing issues. +* Have a short description on what has gone wrong (like a root cause analysis and description of the fix), if that information is not already present in the issue. +* If you have issues on multiple pages, report them separately. Do not combine them into a single issue. +## Repo Specific Guidelines diff --git a/ISSUE_TEMPLATE.md b/ISSUE_TEMPLATE.md new file mode 100644 index 0000000..7ed12e8 --- /dev/null +++ b/ISSUE_TEMPLATE.md @@ -0,0 +1,20 @@ +## Description +As a [USER], +I need [TO DO THIS], +so that I can [ACCOMPLISH THAT]. + +## Mocks +[INSERT RELEVANT PNG FILE] + +## Acceptance Criteria +### Update [Required] +- [ ] [LIST ITEMS] +### Enhancement to Update [Optional] +- [ ] [LIST ITEMS] + +## Definition of Done +- [ ] All of the required items are completed. +- [ ] Approval by 1 mentor. + +## Estimation +[INSERT NUMBER HERE] hours diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..dbbe355 --- /dev/null +++ b/LICENSE @@ -0,0 +1,661 @@ + GNU AFFERO GENERAL PUBLIC LICENSE + Version 3, 19 November 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU Affero General Public License is a free, copyleft license for +software and other kinds of works, specifically designed to ensure +cooperation with the community in the case of network server software. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +our General Public Licenses are intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + Developers that use our General Public Licenses protect your rights +with two steps: (1) assert copyright on the software, and (2) offer +you this License which gives you legal permission to copy, distribute +and/or modify the software. + + A secondary benefit of defending all users' freedom is that +improvements made in alternate versions of the program, if they +receive widespread use, become available for other developers to +incorporate. Many developers of free software are heartened and +encouraged by the resulting cooperation. However, in the case of +software used on network servers, this result may fail to come about. +The GNU General Public License permits making a modified version and +letting the public access it on a server without ever releasing its +source code to the public. + + The GNU Affero General Public License is designed specifically to +ensure that, in such cases, the modified source code becomes available +to the community. It requires the operator of a network server to +provide the source code of the modified version running there to the +users of that server. Therefore, public use of a modified version, on +a publicly accessible server, gives the public access to the source +code of the modified version. + + An older license, called the Affero General Public License and +published by Affero, was designed to accomplish similar goals. This is +a different license, not a version of the Affero GPL, but Affero has +released a new version of the Affero GPL which permits relicensing under +this license. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU Affero General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Remote Network Interaction; Use with the GNU General Public License. + + Notwithstanding any other provision of this License, if you modify the +Program, your modified version must prominently offer all users +interacting with it remotely through a computer network (if your version +supports such interaction) an opportunity to receive the Corresponding +Source of your version by providing access to the Corresponding Source +from a network server at no charge, through some standard or customary +means of facilitating copying of software. This Corresponding Source +shall include the Corresponding Source for any work covered by version 3 +of the GNU General Public License that is incorporated pursuant to the +following paragraph. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the work with which it is combined will remain governed by version +3 of the GNU General Public License. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU Affero General Public License from time to time. Such new versions +will be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU Affero General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU Affero General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU Affero General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Affero General Public License as published + by the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Affero General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + + If your software can interact with users remotely through a computer +network, you should also make sure that it provides a way for users to +get its source. For example, if your program is a web application, its +interface could display a "Source" link that leads users to an archive +of the code. There are many ways you could offer source, and different +solutions will be better for different programs; see section 13 for the +specific requirements. + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU AGPL, see +. diff --git a/PULL_REQUEST_TEMPLATE.md b/PULL_REQUEST_TEMPLATE.md new file mode 100644 index 0000000..a83ffec --- /dev/null +++ b/PULL_REQUEST_TEMPLATE.md @@ -0,0 +1,42 @@ +### Description +Include a summary of the change and relevant motivation/context. List any dependencies that are required for this change. + +Fixes # [ISSUE] + +### Type of Change: +**Delete irrelevant options.** + +- Code +- Quality Assurance +- User Interface +- Outreach +- Documentation + + +**Code/Quality Assurance Only** +- Bug fix (non-breaking change which fixes an issue) +- This change requires a documentation update (software upgrade on readme file) +- New feature (non-breaking change which adds functionality pre-approved by mentors) + + + +### How Has This Been Tested? +Describe the tests you ran to verify your changes. Provide instructions or GIFs so we can reproduce. List any relevant details for your test. + + +### Checklist: +**Delete irrelevant options.** + +- [ ] My PR follows the style guidelines of this project +- [ ] I have performed a self-review of my own code or materials +- [ ] I have commented my code or provided relevant documentation, particularly in hard-to-understand areas +- [ ] I have made corresponding changes to the documentation +- [ ] Any dependent changes have been merged + + +**Code/Quality Assurance Only** +- [ ] My changes generate no new warnings +- [ ] My PR currently breaks something (fix or feature that would cause existing functionality to not work as expected) +- [ ] I have added tests that prove my fix is effective or that my feature works +- [ ] New and existing unit tests pass locally with my changes +- [ ] Any dependent changes have been published in downstream modules diff --git a/Procfile b/Procfile new file mode 100644 index 0000000..0bb75d6 --- /dev/null +++ b/Procfile @@ -0,0 +1 @@ +web: vendor/bin/heroku-php-apache2 diff --git a/README.md b/README.md index 81867e7..0d1a26d 100644 --- a/README.md +++ b/README.md @@ -1 +1,35 @@ -# PCSA-web +# FirstAide-Web [![Build Status](https://travis-ci.org/systers/FirstAide-web.svg?branch=develop)](https://travis-ci.org/systers/FirstAide-web) + +### Abstract +Sexual assault and rape are serious social and public health issues, being one of the major cause of concern. +FirstAide-Web is a web based application developed to help the PCV(Peace Corps Volunteers), in case of sexual +harassment. The app ensures safety by sending messages to fellow volunteers, helpline numbers etc. when in trouble. This application makes it a point that the victim can be sure of getting all the help +he/she needs in case of a critical situation. The sexually assaulted volunteer can get information of Peace Corps policy and safety procedures and also contact Peace Corps for help. + + +### Rules for Contributing +1. To fix a new issue and submit a PR, the first step is to report the issue and get it approved by repo owners. +2. Before submitting an issue, make sure it is not already reported by someone else. You can check [here](https://github.com/systers/FirstAide-web/issues) in both open and closed categories +3. Before picking and working on an issue, make sure it is not already assigned to another developer. The protocol followed is that the issue is assigned to the developer who reports it first. +4. To suggest features that you think will enhance the app, please email us. +5. When you submit a PR please ensure that commit messages are meaningful and reflect what the PR fixes. +6. When you submit a PR for an issue, ensure that there is description of what the PR fixes, a link to the issue that you are fixing and tag the repo owners for review. + + +### Initial Setup and Installation +Download XAMPP from here [XAMPP download](https://www.apachefriends.org/download.html). You will also need a text editor. + +Go to your terminal and execute this command + +`$ git clone https://github.com/systers/FirstAide-web` + +Or download the ZIP file from above + +### Opening and Running +1. Launch XAMPP by opening XAMPP control panel +2. Start 'Apache' and 'MySQL' +3. Check if XAMPP has started using the url 'http://localhost:8080/' (Here 8080 is the port number, use the one which you have configured) +4. Now extract the ZIP file of the project FirstAide-web which you have downloaded and paste it in the C:\xampp\htdocs (the path where your xampp is present) +5. Open the file which you want to work with using a text editor. +6. Make the required changes and save the file +7. Now, view your changes using the url http://localhost:8080/directory_name/file_name.extension Example: 'http://localhost:8080/FirstAide-web/login.html' diff --git a/cache/README.md b/cache/README.md new file mode 100644 index 0000000..fd2fd9f --- /dev/null +++ b/cache/README.md @@ -0,0 +1 @@ +### Note: This is cache directory. Do not commit anything here. diff --git a/code_of_conduct.md b/code_of_conduct.md new file mode 100644 index 0000000..e0dfd11 --- /dev/null +++ b/code_of_conduct.md @@ -0,0 +1,82 @@ +# Code of Conduct + +## 1. Purpose + +A primary goal of Systers is to be inclusive to the largest number of contributors, with the most varied and diverse backgrounds possible. As such, we are committed to providing a friendly, safe and welcoming environment for all, regardless of gender, sexual orientation, ability, ethnicity, socioeconomic status, and religion (or lack thereof). + +This code of conduct outlines our expectations for all those who participate in our community, as well as the consequences for unacceptable behavior. + +We invite all those who participate in Systers to help us create safe and positive experiences for everyone. + +## 2. Open Source Citizenship + +A supplemental goal of this Code of Conduct is to increase open source citizenship by encouraging participants to recognize and strengthen the relationships between our actions and their effects on our community. + +Communities mirror the societies in which they exist and positive action is essential to counteract the many forms of inequality and abuses of power that exist in society. + +If you see someone who is making an extra effort to ensure our community is welcoming, friendly, and encourages all participants to contribute to the fullest extent, we want to know. + +## 3. Expected Behavior + +The following behaviors are expected and requested of all community members: + +* Participate in an authentic and active way. In doing so, you contribute to the health and longevity of this community. +* Exercise consideration and respect in your speech and actions. +* Attempt collaboration before conflict. +* Refrain from demeaning, discriminatory, or harassing behavior and speech. +* Be mindful of your surroundings and of your fellow participants. Alert community leaders if you notice a dangerous situation, someone in distress, or violations of this Code of Conduct, even if they seem inconsequential. +* Remember that community event venues may be shared with members of the public; please be respectful to all patrons of these locations. + +## 4. Unacceptable Behavior + +The following behaviors are considered harassment and are unacceptable within our community: + +* Violence, threats of violence or violent language directed against another person. +* Sexist, racist, homophobic, transphobic, ableist or otherwise discriminatory jokes and language. +* Posting or displaying sexually explicit or violent material. +* Posting or threatening to post other people’s personally identifying information ("doxing"). +* Personal insults, particularly those related to gender, sexual orientation, race, religion, or disability. +* Inappropriate photography or recording. +* Inappropriate physical contact. You should have someone’s consent before touching them. +* Unwelcome sexual attention. This includes, sexualized comments or jokes; inappropriate touching, groping, and unwelcomed sexual advances. +* Deliberate intimidation, stalking or following (online or in person). +* Advocating for, or encouraging, any of the above behavior. +* Sustained disruption of community events, including talks and presentations. + +## 5. Consequences of Unacceptable Behavior + +Unacceptable behavior from any community member, including sponsors and those with decision-making authority, will not be tolerated. + +Anyone asked to stop unacceptable behavior is expected to comply immediately. + +If a community member engages in unacceptable behavior, the community organizers may take any action they deem appropriate, up to and including a temporary ban or permanent expulsion from the community without warning (and without refund in the case of a paid event). + +## 6. Reporting Guidelines +If you are subject to or witness unacceptable behavior, or have any other concerns, please notify a community organizer as soon as possible by emailing systers.keeper@gmail.com. Please read [Reporting Guidelines](reporting_guidelines.md) for details. + + + +Additionally, community organizers are available to help community members engage with local law enforcement or to otherwise help those experiencing unacceptable behavior feel safe. In the context of in-person events, organizers will also provide escorts as desired by the person experiencing distress. + +## 7. Addressing Grievances + +Only permanent resolutions (such as bans) may be appealed. To appeal a decision of the working group, contact the Systers' Open Source Board at os-board@anitab.org with your appeal and the board will review the case. + + +## 8. Scope + +We expect all community participants (contributors, paid or otherwise; sponsors; and other guests) to abide by this Code of Conduct in all community venues–online and in-person–as well as in all one-on-one communications pertaining to community business. + +This code of conduct and its related procedures also applies to unacceptable behavior occurring outside the scope of community activities when such behavior has the potential to adversely affect the safety and well-being of community members. + +## 9. Contact info + +systers.keeper@gmail.com + +## 10. License and attribution + +This Code of Conduct is distributed under a [Creative Commons Attribution-ShareAlike license](http://creativecommons.org/licenses/by-sa/3.0/). + +Portions of text derived from the [Django Code of Conduct](https://www.djangoproject.com/conduct/) and the [Geek Feminism Anti-Harassment Policy](http://geekfeminism.wikia.com/wiki/Conference_anti-harassment/Policy). + +Retrieved on November 22, 2016 from [http://citizencodeofconduct.org/](http://citizencodeofconduct.org/) diff --git a/composer.json b/composer.json new file mode 100644 index 0000000..817f5d5 --- /dev/null +++ b/composer.json @@ -0,0 +1,18 @@ +{ + "require" : { + "php": "^7.0.0", + "twig/twig": "~2.0", + "twilio/sdk": "^5.10" + }, + "require-dev" : { + "squizlabs/php_codesniffer": "*", + "phpunit/phpunit": "^6.1", + "mockery/mockery": "dev-master" + }, + "autoload" : { + "psr-4" : { + "FirstAide\\":"modules/", + "Tests\\": "tests/phpUnitTests/" + } + } +} diff --git a/composer.lock b/composer.lock new file mode 100644 index 0000000..c496da4 --- /dev/null +++ b/composer.lock @@ -0,0 +1,1807 @@ +{ + "_readme": [ + "This file locks the dependencies of your project to a known state", + "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", + "This file is @generated automatically" + ], + "content-hash": "62da419ace4cc7a147793ca0f4ef80b2", + "packages": [ + { + "name": "symfony/polyfill-mbstring", + "version": "v1.4.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-mbstring.git", + "reference": "f29dca382a6485c3cbe6379f0c61230167681937" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/f29dca382a6485c3cbe6379f0c61230167681937", + "reference": "f29dca382a6485c3cbe6379f0c61230167681937", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "suggest": { + "ext-mbstring": "For best performance" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.4-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Polyfill\\Mbstring\\": "" + }, + "files": [ + "bootstrap.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill for the Mbstring extension", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "mbstring", + "polyfill", + "portable", + "shim" + ], + "time": "2017-06-09T14:24:12+00:00" + }, + { + "name": "twig/twig", + "version": "v2.4.3", + "source": { + "type": "git", + "url": "https://github.com/twigphp/Twig.git", + "reference": "eab7c3288ae6603d7d6f92b531626af2b162d1f2" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/twigphp/Twig/zipball/eab7c3288ae6603d7d6f92b531626af2b162d1f2", + "reference": "eab7c3288ae6603d7d6f92b531626af2b162d1f2", + "shasum": "" + }, + "require": { + "php": "^7.0", + "symfony/polyfill-mbstring": "~1.0" + }, + "require-dev": { + "psr/container": "^1.0", + "symfony/debug": "~2.7", + "symfony/phpunit-bridge": "~3.3@dev" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.4-dev" + } + }, + "autoload": { + "psr-0": { + "Twig_": "lib/" + }, + "psr-4": { + "Twig\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com", + "homepage": "http://fabien.potencier.org", + "role": "Lead Developer" + }, + { + "name": "Armin Ronacher", + "email": "armin.ronacher@active-4.com", + "role": "Project Founder" + }, + { + "name": "Twig Team", + "homepage": "http://twig.sensiolabs.org/contributors", + "role": "Contributors" + } + ], + "description": "Twig, the flexible, fast, and secure template language for PHP", + "homepage": "http://twig.sensiolabs.org", + "keywords": [ + "templating" + ], + "time": "2017-06-07T18:47:58+00:00" + }, + { + "name": "twilio/sdk", + "version": "5.11.0", + "source": { + "type": "git", + "url": "https://github.com/twilio/twilio-php.git", + "reference": "6887cc761df5b011bce5460ad643e846ad8a5548" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/twilio/twilio-php/zipball/6887cc761df5b011bce5460ad643e846ad8a5548", + "reference": "6887cc761df5b011bce5460ad643e846ad8a5548", + "shasum": "" + }, + "require": { + "php": ">=5.3.0" + }, + "require-dev": { + "apigen/apigen": "^4.1", + "phpunit/phpunit": "4.5.*" + }, + "type": "library", + "autoload": { + "psr-4": { + "Twilio\\": "Twilio/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Twilio API Team", + "email": "api@twilio.com" + } + ], + "description": "A PHP wrapper for Twilio's API", + "homepage": "http://github.com/twilio/twilio-php", + "keywords": [ + "api", + "sms", + "twilio" + ], + "time": "2017-06-16T20:19:46+00:00" + } + ], + "packages-dev": [ + { + "name": "doctrine/instantiator", + "version": "1.0.5", + "source": { + "type": "git", + "url": "https://github.com/doctrine/instantiator.git", + "reference": "8e884e78f9f0eb1329e445619e04456e64d8051d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/doctrine/instantiator/zipball/8e884e78f9f0eb1329e445619e04456e64d8051d", + "reference": "8e884e78f9f0eb1329e445619e04456e64d8051d", + "shasum": "" + }, + "require": { + "php": ">=5.3,<8.0-DEV" + }, + "require-dev": { + "athletic/athletic": "~0.1.8", + "ext-pdo": "*", + "ext-phar": "*", + "phpunit/phpunit": "~4.0", + "squizlabs/php_codesniffer": "~2.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Doctrine\\Instantiator\\": "src/Doctrine/Instantiator/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Marco Pivetta", + "email": "ocramius@gmail.com", + "homepage": "http://ocramius.github.com/" + } + ], + "description": "A small, lightweight utility to instantiate objects in PHP without invoking their constructors", + "homepage": "https://github.com/doctrine/instantiator", + "keywords": [ + "constructor", + "instantiate" + ], + "time": "2015-06-14T21:17:01+00:00" + }, + { + "name": "hamcrest/hamcrest-php", + "version": "v2.0.0", + "source": { + "type": "git", + "url": "https://github.com/hamcrest/hamcrest-php.git", + "reference": "776503d3a8e85d4f9a1148614f95b7a608b046ad" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/hamcrest/hamcrest-php/zipball/776503d3a8e85d4f9a1148614f95b7a608b046ad", + "reference": "776503d3a8e85d4f9a1148614f95b7a608b046ad", + "shasum": "" + }, + "require": { + "php": "^5.3|^7.0" + }, + "replace": { + "cordoval/hamcrest-php": "*", + "davedevelopment/hamcrest-php": "*", + "kodova/hamcrest-php": "*" + }, + "require-dev": { + "phpunit/php-file-iterator": "1.3.3", + "phpunit/phpunit": "~4.0", + "satooshi/php-coveralls": "^1.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0-dev" + } + }, + "autoload": { + "classmap": [ + "hamcrest" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD" + ], + "description": "This is the PHP port of Hamcrest Matchers", + "keywords": [ + "test" + ], + "time": "2016-01-20T08:20:44+00:00" + }, + { + "name": "mockery/mockery", + "version": "dev-master", + "source": { + "type": "git", + "url": "https://github.com/mockery/mockery.git", + "reference": "c90a17247147543081e4d00f46911e422b49e583" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/mockery/mockery/zipball/c90a17247147543081e4d00f46911e422b49e583", + "reference": "c90a17247147543081e4d00f46911e422b49e583", + "shasum": "" + }, + "require": { + "hamcrest/hamcrest-php": "~2.0", + "lib-pcre": ">=7.0", + "php": ">=5.6.0" + }, + "require-dev": { + "phpunit/phpunit": "~5.7|~6.1" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-0": { + "Mockery": "library/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Pádraic Brady", + "email": "padraic.brady@gmail.com", + "homepage": "http://blog.astrumfutura.com" + }, + { + "name": "Dave Marshall", + "email": "dave.marshall@atstsolutions.co.uk", + "homepage": "http://davedevelopment.co.uk" + } + ], + "description": "Mockery is a simple yet flexible PHP mock object framework for use in unit testing with PHPUnit, PHPSpec or any other testing framework. Its core goal is to offer a test double framework with a succinct API capable of clearly defining all possible object operations and interactions using a human readable Domain Specific Language (DSL). Designed as a drop in alternative to PHPUnit's phpunit-mock-objects library, Mockery is easy to integrate with PHPUnit and can operate alongside phpunit-mock-objects without the World ending.", + "homepage": "http://github.com/mockery/mockery", + "keywords": [ + "BDD", + "TDD", + "library", + "mock", + "mock objects", + "mockery", + "stub", + "test", + "test double", + "testing" + ], + "time": "2017-06-22 13:56:23" + }, + { + "name": "myclabs/deep-copy", + "version": "1.6.1", + "source": { + "type": "git", + "url": "https://github.com/myclabs/DeepCopy.git", + "reference": "8e6e04167378abf1ddb4d3522d8755c5fd90d102" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/8e6e04167378abf1ddb4d3522d8755c5fd90d102", + "reference": "8e6e04167378abf1ddb4d3522d8755c5fd90d102", + "shasum": "" + }, + "require": { + "php": ">=5.4.0" + }, + "require-dev": { + "doctrine/collections": "1.*", + "phpunit/phpunit": "~4.1" + }, + "type": "library", + "autoload": { + "psr-4": { + "DeepCopy\\": "src/DeepCopy/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "Create deep copies (clones) of your objects", + "homepage": "https://github.com/myclabs/DeepCopy", + "keywords": [ + "clone", + "copy", + "duplicate", + "object", + "object graph" + ], + "time": "2017-04-12T18:52:22+00:00" + }, + { + "name": "phar-io/manifest", + "version": "1.0.1", + "source": { + "type": "git", + "url": "https://github.com/phar-io/manifest.git", + "reference": "2df402786ab5368a0169091f61a7c1e0eb6852d0" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phar-io/manifest/zipball/2df402786ab5368a0169091f61a7c1e0eb6852d0", + "reference": "2df402786ab5368a0169091f61a7c1e0eb6852d0", + "shasum": "" + }, + "require": { + "ext-dom": "*", + "ext-phar": "*", + "phar-io/version": "^1.0.1", + "php": "^5.6 || ^7.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Arne Blankerts", + "email": "arne@blankerts.de", + "role": "Developer" + }, + { + "name": "Sebastian Heuer", + "email": "sebastian@phpeople.de", + "role": "Developer" + }, + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "Developer" + } + ], + "description": "Component for reading phar.io manifest information from a PHP Archive (PHAR)", + "time": "2017-03-05T18:14:27+00:00" + }, + { + "name": "phar-io/version", + "version": "1.0.1", + "source": { + "type": "git", + "url": "https://github.com/phar-io/version.git", + "reference": "a70c0ced4be299a63d32fa96d9281d03e94041df" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phar-io/version/zipball/a70c0ced4be299a63d32fa96d9281d03e94041df", + "reference": "a70c0ced4be299a63d32fa96d9281d03e94041df", + "shasum": "" + }, + "require": { + "php": "^5.6 || ^7.0" + }, + "type": "library", + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Arne Blankerts", + "email": "arne@blankerts.de", + "role": "Developer" + }, + { + "name": "Sebastian Heuer", + "email": "sebastian@phpeople.de", + "role": "Developer" + }, + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "Developer" + } + ], + "description": "Library for handling version information and constraints", + "time": "2017-03-05T17:38:23+00:00" + }, + { + "name": "phpdocumentor/reflection-common", + "version": "1.0", + "source": { + "type": "git", + "url": "https://github.com/phpDocumentor/ReflectionCommon.git", + "reference": "144c307535e82c8fdcaacbcfc1d6d8eeb896687c" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpDocumentor/ReflectionCommon/zipball/144c307535e82c8fdcaacbcfc1d6d8eeb896687c", + "reference": "144c307535e82c8fdcaacbcfc1d6d8eeb896687c", + "shasum": "" + }, + "require": { + "php": ">=5.5" + }, + "require-dev": { + "phpunit/phpunit": "^4.6" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "phpDocumentor\\Reflection\\": [ + "src" + ] + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Jaap van Otterdijk", + "email": "opensource@ijaap.nl" + } + ], + "description": "Common reflection classes used by phpdocumentor to reflect the code structure", + "homepage": "http://www.phpdoc.org", + "keywords": [ + "FQSEN", + "phpDocumentor", + "phpdoc", + "reflection", + "static analysis" + ], + "time": "2015-12-27T11:43:31+00:00" + }, + { + "name": "phpdocumentor/reflection-docblock", + "version": "3.1.1", + "source": { + "type": "git", + "url": "https://github.com/phpDocumentor/ReflectionDocBlock.git", + "reference": "8331b5efe816ae05461b7ca1e721c01b46bafb3e" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/8331b5efe816ae05461b7ca1e721c01b46bafb3e", + "reference": "8331b5efe816ae05461b7ca1e721c01b46bafb3e", + "shasum": "" + }, + "require": { + "php": ">=5.5", + "phpdocumentor/reflection-common": "^1.0@dev", + "phpdocumentor/type-resolver": "^0.2.0", + "webmozart/assert": "^1.0" + }, + "require-dev": { + "mockery/mockery": "^0.9.4", + "phpunit/phpunit": "^4.4" + }, + "type": "library", + "autoload": { + "psr-4": { + "phpDocumentor\\Reflection\\": [ + "src/" + ] + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Mike van Riel", + "email": "me@mikevanriel.com" + } + ], + "description": "With this component, a library can provide support for annotations via DocBlocks or otherwise retrieve information that is embedded in a DocBlock.", + "time": "2016-09-30T07:12:33+00:00" + }, + { + "name": "phpdocumentor/type-resolver", + "version": "0.2.1", + "source": { + "type": "git", + "url": "https://github.com/phpDocumentor/TypeResolver.git", + "reference": "e224fb2ea2fba6d3ad6fdaef91cd09a172155ccb" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/e224fb2ea2fba6d3ad6fdaef91cd09a172155ccb", + "reference": "e224fb2ea2fba6d3ad6fdaef91cd09a172155ccb", + "shasum": "" + }, + "require": { + "php": ">=5.5", + "phpdocumentor/reflection-common": "^1.0" + }, + "require-dev": { + "mockery/mockery": "^0.9.4", + "phpunit/phpunit": "^5.2||^4.8.24" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "phpDocumentor\\Reflection\\": [ + "src/" + ] + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Mike van Riel", + "email": "me@mikevanriel.com" + } + ], + "time": "2016-11-25T06:54:22+00:00" + }, + { + "name": "phpspec/prophecy", + "version": "v1.7.0", + "source": { + "type": "git", + "url": "https://github.com/phpspec/prophecy.git", + "reference": "93d39f1f7f9326d746203c7c056f300f7f126073" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpspec/prophecy/zipball/93d39f1f7f9326d746203c7c056f300f7f126073", + "reference": "93d39f1f7f9326d746203c7c056f300f7f126073", + "shasum": "" + }, + "require": { + "doctrine/instantiator": "^1.0.2", + "php": "^5.3|^7.0", + "phpdocumentor/reflection-docblock": "^2.0|^3.0.2", + "sebastian/comparator": "^1.1|^2.0", + "sebastian/recursion-context": "^1.0|^2.0|^3.0" + }, + "require-dev": { + "phpspec/phpspec": "^2.5|^3.2", + "phpunit/phpunit": "^4.8 || ^5.6.5" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.6.x-dev" + } + }, + "autoload": { + "psr-0": { + "Prophecy\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Konstantin Kudryashov", + "email": "ever.zet@gmail.com", + "homepage": "http://everzet.com" + }, + { + "name": "Marcello Duarte", + "email": "marcello.duarte@gmail.com" + } + ], + "description": "Highly opinionated mocking framework for PHP 5.3+", + "homepage": "https://github.com/phpspec/prophecy", + "keywords": [ + "Double", + "Dummy", + "fake", + "mock", + "spy", + "stub" + ], + "time": "2017-03-02T20:05:34+00:00" + }, + { + "name": "phpunit/php-code-coverage", + "version": "5.2.1", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-code-coverage.git", + "reference": "dc421f9ca5082a0c0cb04afb171c765f79add85b" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/dc421f9ca5082a0c0cb04afb171c765f79add85b", + "reference": "dc421f9ca5082a0c0cb04afb171c765f79add85b", + "shasum": "" + }, + "require": { + "ext-dom": "*", + "ext-xmlwriter": "*", + "php": "^7.0", + "phpunit/php-file-iterator": "^1.3", + "phpunit/php-text-template": "^1.2", + "phpunit/php-token-stream": "^1.4.11 || ^2.0", + "sebastian/code-unit-reverse-lookup": "^1.0", + "sebastian/environment": "^3.0", + "sebastian/version": "^2.0", + "theseer/tokenizer": "^1.1" + }, + "require-dev": { + "ext-xdebug": "^2.5", + "phpunit/phpunit": "^6.0" + }, + "suggest": { + "ext-xdebug": "^2.5.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "5.2.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sb@sebastian-bergmann.de", + "role": "lead" + } + ], + "description": "Library that provides collection, processing, and rendering functionality for PHP code coverage information.", + "homepage": "https://github.com/sebastianbergmann/php-code-coverage", + "keywords": [ + "coverage", + "testing", + "xunit" + ], + "time": "2017-04-21T08:03:57+00:00" + }, + { + "name": "phpunit/php-file-iterator", + "version": "1.4.2", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-file-iterator.git", + "reference": "3cc8f69b3028d0f96a9078e6295d86e9bf019be5" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/3cc8f69b3028d0f96a9078e6295d86e9bf019be5", + "reference": "3cc8f69b3028d0f96a9078e6295d86e9bf019be5", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.4.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sb@sebastian-bergmann.de", + "role": "lead" + } + ], + "description": "FilterIterator implementation that filters files based on a list of suffixes.", + "homepage": "https://github.com/sebastianbergmann/php-file-iterator/", + "keywords": [ + "filesystem", + "iterator" + ], + "time": "2016-10-03T07:40:28+00:00" + }, + { + "name": "phpunit/php-text-template", + "version": "1.2.1", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-text-template.git", + "reference": "31f8b717e51d9a2afca6c9f046f5d69fc27c8686" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-text-template/zipball/31f8b717e51d9a2afca6c9f046f5d69fc27c8686", + "reference": "31f8b717e51d9a2afca6c9f046f5d69fc27c8686", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "type": "library", + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Simple template engine.", + "homepage": "https://github.com/sebastianbergmann/php-text-template/", + "keywords": [ + "template" + ], + "time": "2015-06-21T13:50:34+00:00" + }, + { + "name": "phpunit/php-timer", + "version": "1.0.9", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-timer.git", + "reference": "3dcf38ca72b158baf0bc245e9184d3fdffa9c46f" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/3dcf38ca72b158baf0bc245e9184d3fdffa9c46f", + "reference": "3dcf38ca72b158baf0bc245e9184d3fdffa9c46f", + "shasum": "" + }, + "require": { + "php": "^5.3.3 || ^7.0" + }, + "require-dev": { + "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sb@sebastian-bergmann.de", + "role": "lead" + } + ], + "description": "Utility class for timing", + "homepage": "https://github.com/sebastianbergmann/php-timer/", + "keywords": [ + "timer" + ], + "time": "2017-02-26T11:10:40+00:00" + }, + { + "name": "phpunit/php-token-stream", + "version": "1.4.11", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-token-stream.git", + "reference": "e03f8f67534427a787e21a385a67ec3ca6978ea7" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/e03f8f67534427a787e21a385a67ec3ca6978ea7", + "reference": "e03f8f67534427a787e21a385a67ec3ca6978ea7", + "shasum": "" + }, + "require": { + "ext-tokenizer": "*", + "php": ">=5.3.3" + }, + "require-dev": { + "phpunit/phpunit": "~4.2" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.4-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Wrapper around PHP's tokenizer extension.", + "homepage": "https://github.com/sebastianbergmann/php-token-stream/", + "keywords": [ + "tokenizer" + ], + "time": "2017-02-27T10:12:30+00:00" + }, + { + "name": "phpunit/phpunit", + "version": "6.2.3", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/phpunit.git", + "reference": "fa5711d0559fc4b64deba0702be52d41434cbcb7" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/fa5711d0559fc4b64deba0702be52d41434cbcb7", + "reference": "fa5711d0559fc4b64deba0702be52d41434cbcb7", + "shasum": "" + }, + "require": { + "ext-dom": "*", + "ext-json": "*", + "ext-libxml": "*", + "ext-mbstring": "*", + "ext-xml": "*", + "myclabs/deep-copy": "^1.3", + "phar-io/manifest": "^1.0.1", + "phar-io/version": "^1.0", + "php": "^7.0", + "phpspec/prophecy": "^1.7", + "phpunit/php-code-coverage": "^5.2", + "phpunit/php-file-iterator": "^1.4", + "phpunit/php-text-template": "^1.2", + "phpunit/php-timer": "^1.0.6", + "phpunit/phpunit-mock-objects": "^4.0", + "sebastian/comparator": "^2.0", + "sebastian/diff": "^1.4.3 || ^2.0", + "sebastian/environment": "^3.0.2", + "sebastian/exporter": "^3.1", + "sebastian/global-state": "^1.1 || ^2.0", + "sebastian/object-enumerator": "^3.0.2", + "sebastian/resource-operations": "^1.0", + "sebastian/version": "^2.0" + }, + "conflict": { + "phpdocumentor/reflection-docblock": "3.0.2", + "phpunit/dbunit": "<3.0" + }, + "require-dev": { + "ext-pdo": "*" + }, + "suggest": { + "ext-xdebug": "*", + "phpunit/php-invoker": "^1.1" + }, + "bin": [ + "phpunit" + ], + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "6.2.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "The PHP Unit Testing framework.", + "homepage": "https://phpunit.de/", + "keywords": [ + "phpunit", + "testing", + "xunit" + ], + "time": "2017-07-03T15:54:24+00:00" + }, + { + "name": "phpunit/phpunit-mock-objects", + "version": "4.0.2", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/phpunit-mock-objects.git", + "reference": "d8833b396dce9162bb2eb5d59aee5a3ab3cfa5b4" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit-mock-objects/zipball/d8833b396dce9162bb2eb5d59aee5a3ab3cfa5b4", + "reference": "d8833b396dce9162bb2eb5d59aee5a3ab3cfa5b4", + "shasum": "" + }, + "require": { + "doctrine/instantiator": "^1.0.2", + "php": "^7.0", + "phpunit/php-text-template": "^1.2", + "sebastian/exporter": "^3.0" + }, + "conflict": { + "phpunit/phpunit": "<6.0" + }, + "require-dev": { + "phpunit/phpunit": "^6.0" + }, + "suggest": { + "ext-soap": "*" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "4.0.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sb@sebastian-bergmann.de", + "role": "lead" + } + ], + "description": "Mock Object library for PHPUnit", + "homepage": "https://github.com/sebastianbergmann/phpunit-mock-objects/", + "keywords": [ + "mock", + "xunit" + ], + "time": "2017-06-30T08:15:21+00:00" + }, + { + "name": "sebastian/code-unit-reverse-lookup", + "version": "1.0.1", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/code-unit-reverse-lookup.git", + "reference": "4419fcdb5eabb9caa61a27c7a1db532a6b55dd18" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/code-unit-reverse-lookup/zipball/4419fcdb5eabb9caa61a27c7a1db532a6b55dd18", + "reference": "4419fcdb5eabb9caa61a27c7a1db532a6b55dd18", + "shasum": "" + }, + "require": { + "php": "^5.6 || ^7.0" + }, + "require-dev": { + "phpunit/phpunit": "^5.7 || ^6.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Looks up which function or method a line of code belongs to", + "homepage": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/", + "time": "2017-03-04T06:30:41+00:00" + }, + { + "name": "sebastian/comparator", + "version": "2.0.0", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/comparator.git", + "reference": "20f84f468cb67efee293246e6a09619b891f55f0" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/20f84f468cb67efee293246e6a09619b891f55f0", + "reference": "20f84f468cb67efee293246e6a09619b891f55f0", + "shasum": "" + }, + "require": { + "php": "^7.0", + "sebastian/diff": "^1.2", + "sebastian/exporter": "^3.0" + }, + "require-dev": { + "phpunit/phpunit": "^6.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Jeff Welch", + "email": "whatthejeff@gmail.com" + }, + { + "name": "Volker Dusch", + "email": "github@wallbash.com" + }, + { + "name": "Bernhard Schussek", + "email": "bschussek@2bepublished.at" + }, + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Provides the functionality to compare PHP values for equality", + "homepage": "http://www.github.com/sebastianbergmann/comparator", + "keywords": [ + "comparator", + "compare", + "equality" + ], + "time": "2017-03-03T06:26:08+00:00" + }, + { + "name": "sebastian/diff", + "version": "1.4.3", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/diff.git", + "reference": "7f066a26a962dbe58ddea9f72a4e82874a3975a4" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/7f066a26a962dbe58ddea9f72a4e82874a3975a4", + "reference": "7f066a26a962dbe58ddea9f72a4e82874a3975a4", + "shasum": "" + }, + "require": { + "php": "^5.3.3 || ^7.0" + }, + "require-dev": { + "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.4-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Kore Nordmann", + "email": "mail@kore-nordmann.de" + }, + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Diff implementation", + "homepage": "https://github.com/sebastianbergmann/diff", + "keywords": [ + "diff" + ], + "time": "2017-05-22T07:24:03+00:00" + }, + { + "name": "sebastian/environment", + "version": "3.1.0", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/environment.git", + "reference": "cd0871b3975fb7fc44d11314fd1ee20925fce4f5" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/cd0871b3975fb7fc44d11314fd1ee20925fce4f5", + "reference": "cd0871b3975fb7fc44d11314fd1ee20925fce4f5", + "shasum": "" + }, + "require": { + "php": "^7.0" + }, + "require-dev": { + "phpunit/phpunit": "^6.1" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.1.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Provides functionality to handle HHVM/PHP environments", + "homepage": "http://www.github.com/sebastianbergmann/environment", + "keywords": [ + "Xdebug", + "environment", + "hhvm" + ], + "time": "2017-07-01T08:51:00+00:00" + }, + { + "name": "sebastian/exporter", + "version": "3.1.0", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/exporter.git", + "reference": "234199f4528de6d12aaa58b612e98f7d36adb937" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/234199f4528de6d12aaa58b612e98f7d36adb937", + "reference": "234199f4528de6d12aaa58b612e98f7d36adb937", + "shasum": "" + }, + "require": { + "php": "^7.0", + "sebastian/recursion-context": "^3.0" + }, + "require-dev": { + "ext-mbstring": "*", + "phpunit/phpunit": "^6.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.1.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Jeff Welch", + "email": "whatthejeff@gmail.com" + }, + { + "name": "Volker Dusch", + "email": "github@wallbash.com" + }, + { + "name": "Bernhard Schussek", + "email": "bschussek@2bepublished.at" + }, + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + }, + { + "name": "Adam Harvey", + "email": "aharvey@php.net" + } + ], + "description": "Provides the functionality to export PHP variables for visualization", + "homepage": "http://www.github.com/sebastianbergmann/exporter", + "keywords": [ + "export", + "exporter" + ], + "time": "2017-04-03T13:19:02+00:00" + }, + { + "name": "sebastian/global-state", + "version": "2.0.0", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/global-state.git", + "reference": "e8ba02eed7bbbb9e59e43dedd3dddeff4a56b0c4" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/e8ba02eed7bbbb9e59e43dedd3dddeff4a56b0c4", + "reference": "e8ba02eed7bbbb9e59e43dedd3dddeff4a56b0c4", + "shasum": "" + }, + "require": { + "php": "^7.0" + }, + "require-dev": { + "phpunit/phpunit": "^6.0" + }, + "suggest": { + "ext-uopz": "*" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Snapshotting of global state", + "homepage": "http://www.github.com/sebastianbergmann/global-state", + "keywords": [ + "global state" + ], + "time": "2017-04-27T15:39:26+00:00" + }, + { + "name": "sebastian/object-enumerator", + "version": "3.0.2", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/object-enumerator.git", + "reference": "31dd3379d16446c5d86dec32ab1ad1f378581ad8" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/object-enumerator/zipball/31dd3379d16446c5d86dec32ab1ad1f378581ad8", + "reference": "31dd3379d16446c5d86dec32ab1ad1f378581ad8", + "shasum": "" + }, + "require": { + "php": "^7.0", + "sebastian/object-reflector": "^1.0", + "sebastian/recursion-context": "^3.0" + }, + "require-dev": { + "phpunit/phpunit": "^6.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.0.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Traverses array structures and object graphs to enumerate all referenced objects", + "homepage": "https://github.com/sebastianbergmann/object-enumerator/", + "time": "2017-03-12T15:17:29+00:00" + }, + { + "name": "sebastian/object-reflector", + "version": "1.1.1", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/object-reflector.git", + "reference": "773f97c67f28de00d397be301821b06708fca0be" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/object-reflector/zipball/773f97c67f28de00d397be301821b06708fca0be", + "reference": "773f97c67f28de00d397be301821b06708fca0be", + "shasum": "" + }, + "require": { + "php": "^7.0" + }, + "require-dev": { + "phpunit/phpunit": "^6.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.1-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Allows reflection of object attributes, including inherited and non-public ones", + "homepage": "https://github.com/sebastianbergmann/object-reflector/", + "time": "2017-03-29T09:07:27+00:00" + }, + { + "name": "sebastian/recursion-context", + "version": "3.0.0", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/recursion-context.git", + "reference": "5b0cd723502bac3b006cbf3dbf7a1e3fcefe4fa8" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/5b0cd723502bac3b006cbf3dbf7a1e3fcefe4fa8", + "reference": "5b0cd723502bac3b006cbf3dbf7a1e3fcefe4fa8", + "shasum": "" + }, + "require": { + "php": "^7.0" + }, + "require-dev": { + "phpunit/phpunit": "^6.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.0.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Jeff Welch", + "email": "whatthejeff@gmail.com" + }, + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + }, + { + "name": "Adam Harvey", + "email": "aharvey@php.net" + } + ], + "description": "Provides functionality to recursively process PHP variables", + "homepage": "http://www.github.com/sebastianbergmann/recursion-context", + "time": "2017-03-03T06:23:57+00:00" + }, + { + "name": "sebastian/resource-operations", + "version": "1.0.0", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/resource-operations.git", + "reference": "ce990bb21759f94aeafd30209e8cfcdfa8bc3f52" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/resource-operations/zipball/ce990bb21759f94aeafd30209e8cfcdfa8bc3f52", + "reference": "ce990bb21759f94aeafd30209e8cfcdfa8bc3f52", + "shasum": "" + }, + "require": { + "php": ">=5.6.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Provides a list of PHP built-in functions that operate on resources", + "homepage": "https://www.github.com/sebastianbergmann/resource-operations", + "time": "2015-07-28T20:34:47+00:00" + }, + { + "name": "sebastian/version", + "version": "2.0.1", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/version.git", + "reference": "99732be0ddb3361e16ad77b68ba41efc8e979019" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/version/zipball/99732be0ddb3361e16ad77b68ba41efc8e979019", + "reference": "99732be0ddb3361e16ad77b68ba41efc8e979019", + "shasum": "" + }, + "require": { + "php": ">=5.6" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Library that helps with managing the version number of Git-hosted PHP projects", + "homepage": "https://github.com/sebastianbergmann/version", + "time": "2016-10-03T07:35:21+00:00" + }, + { + "name": "squizlabs/php_codesniffer", + "version": "3.0.1", + "source": { + "type": "git", + "url": "https://github.com/squizlabs/PHP_CodeSniffer.git", + "reference": "f9eaf037edf22fdfccf04cb0ab57ebcb1e166219" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/f9eaf037edf22fdfccf04cb0ab57ebcb1e166219", + "reference": "f9eaf037edf22fdfccf04cb0ab57ebcb1e166219", + "shasum": "" + }, + "require": { + "ext-simplexml": "*", + "ext-tokenizer": "*", + "ext-xmlwriter": "*", + "php": ">=5.4.0" + }, + "require-dev": { + "phpunit/phpunit": "~4.0" + }, + "bin": [ + "bin/phpcs", + "bin/phpcbf" + ], + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.x-dev" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Greg Sherwood", + "role": "lead" + } + ], + "description": "PHP_CodeSniffer tokenizes PHP, JavaScript and CSS files and detects violations of a defined set of coding standards.", + "homepage": "http://www.squizlabs.com/php-codesniffer", + "keywords": [ + "phpcs", + "standards" + ], + "time": "2017-06-14T01:23:49+00:00" + }, + { + "name": "theseer/tokenizer", + "version": "1.1.0", + "source": { + "type": "git", + "url": "https://github.com/theseer/tokenizer.git", + "reference": "cb2f008f3f05af2893a87208fe6a6c4985483f8b" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/theseer/tokenizer/zipball/cb2f008f3f05af2893a87208fe6a6c4985483f8b", + "reference": "cb2f008f3f05af2893a87208fe6a6c4985483f8b", + "shasum": "" + }, + "require": { + "ext-dom": "*", + "ext-tokenizer": "*", + "ext-xmlwriter": "*", + "php": "^7.0" + }, + "type": "library", + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Arne Blankerts", + "email": "arne@blankerts.de", + "role": "Developer" + } + ], + "description": "A small library for converting tokenized PHP source code into XML and potentially other formats", + "time": "2017-04-07T12:08:54+00:00" + }, + { + "name": "webmozart/assert", + "version": "1.2.0", + "source": { + "type": "git", + "url": "https://github.com/webmozart/assert.git", + "reference": "2db61e59ff05fe5126d152bd0655c9ea113e550f" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/webmozart/assert/zipball/2db61e59ff05fe5126d152bd0655c9ea113e550f", + "reference": "2db61e59ff05fe5126d152bd0655c9ea113e550f", + "shasum": "" + }, + "require": { + "php": "^5.3.3 || ^7.0" + }, + "require-dev": { + "phpunit/phpunit": "^4.6", + "sebastian/version": "^1.0.1" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.3-dev" + } + }, + "autoload": { + "psr-4": { + "Webmozart\\Assert\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Bernhard Schussek", + "email": "bschussek@gmail.com" + } + ], + "description": "Assertions to validate method input/output with nice error messages.", + "keywords": [ + "assert", + "check", + "validate" + ], + "time": "2016-11-23T20:04:58+00:00" + } + ], + "aliases": [], + "minimum-stability": "stable", + "stability-flags": { + "mockery/mockery": 20 + }, + "prefer-stable": false, + "prefer-lowest": false, + "platform": { + "php": "^7.0.0" + }, + "platform-dev": [] +} diff --git a/docs/config/firstaide.sql/firstaide.sql b/docs/config/firstaide.sql/firstaide.sql new file mode 100644 index 0000000..ed7cc1a --- /dev/null +++ b/docs/config/firstaide.sql/firstaide.sql @@ -0,0 +1,104 @@ +-- phpMyAdmin SQL Dump +-- version 4.7.0 +-- https://www.phpmyadmin.net/ +-- +-- Host: 127.0.0.1 +-- Generation Time: Aug 30, 2017 at 09:55 AM +-- Server version: 10.1.25-MariaDB +-- PHP Version: 7.1.7 + +SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO"; +SET AUTOCOMMIT = 0; +START TRANSACTION; +SET time_zone = "+00:00"; + + +/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; +/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; +/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; +/*!40101 SET NAMES utf8mb4 */; + +-- +-- Database: `firstaide` +-- + +-- -------------------------------------------------------- + +-- +-- Table structure for table `comrades` +-- + +CREATE TABLE `comrades` ( + `user_id` int(11) NOT NULL, + `comrade_details` varchar(128) NOT NULL +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +-- -------------------------------------------------------- + +-- +-- Table structure for table `users` +-- + +CREATE TABLE `users` ( + `user_id` int(11) NOT NULL, + `email` varchar(128) NOT NULL, + `name` varchar(128) NOT NULL, + `password` varchar(256) NOT NULL, + `country` varchar(32) NOT NULL +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +-- -------------------------------------------------------- + +-- +-- Table structure for table `user_session` +-- + +CREATE TABLE `user_session` ( + `session_numeric_id` int(11) NOT NULL, + `session_token` varchar(256) COLLATE utf8_bin NOT NULL, + `user_id` int(11) NOT NULL +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin; + +-- +-- Indexes for dumped tables +-- + +-- +-- Indexes for table `comrades` +-- +ALTER TABLE `comrades` + ADD PRIMARY KEY (`user_id`); + +-- +-- Indexes for table `users` +-- +ALTER TABLE `users` + ADD PRIMARY KEY (`user_id`), + ADD UNIQUE KEY `email` (`email`); + +-- +-- Indexes for table `user_session` +-- +ALTER TABLE `user_session` + ADD PRIMARY KEY (`session_numeric_id`), + ADD KEY `session_id` (`session_token`(255)), + ADD KEY `user_id` (`user_id`); + +-- +-- AUTO_INCREMENT for dumped tables +-- + +-- +-- AUTO_INCREMENT for table `users` +-- +ALTER TABLE `users` + MODIFY `user_id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=10; +-- +-- AUTO_INCREMENT for table `user_session` +-- +ALTER TABLE `user_session` + MODIFY `session_numeric_id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=6;COMMIT; + +/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; +/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; +/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; diff --git a/docs/images/activityDiagram.png b/docs/images/activityDiagram.png new file mode 100644 index 0000000..0b774dd Binary files /dev/null and b/docs/images/activityDiagram.png differ diff --git a/docs/images/classDiagram.png b/docs/images/classDiagram.png new file mode 100644 index 0000000..895d2f2 Binary files /dev/null and b/docs/images/classDiagram.png differ diff --git a/docs/images/sequenceDiagram.jpg b/docs/images/sequenceDiagram.jpg new file mode 100644 index 0000000..dff51a5 Binary files /dev/null and b/docs/images/sequenceDiagram.jpg differ diff --git a/fonts/icons.eot b/fonts/icons.eot new file mode 100755 index 0000000..e9f60ca Binary files /dev/null and b/fonts/icons.eot differ diff --git a/fonts/icons.otf b/fonts/icons.otf new file mode 100755 index 0000000..f7936cc Binary files /dev/null and b/fonts/icons.otf differ diff --git a/fonts/icons.svg b/fonts/icons.svg new file mode 100755 index 0000000..855c845 --- /dev/null +++ b/fonts/icons.svg @@ -0,0 +1,2671 @@ + + + + +Created by FontForge 20120731 at Mon Oct 24 17:37:40 2016 + By ,,, +Copyright Dave Gandy 2016. All rights reserved. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/fonts/icons.ttf b/fonts/icons.ttf new file mode 100755 index 0000000..35acda2 Binary files /dev/null and b/fonts/icons.ttf differ diff --git a/fonts/icons.woff b/fonts/icons.woff new file mode 100755 index 0000000..400014a Binary files /dev/null and b/fonts/icons.woff differ diff --git a/fonts/icons.woff2 b/fonts/icons.woff2 new file mode 100755 index 0000000..4d13fc6 Binary files /dev/null and b/fonts/icons.woff2 differ diff --git a/gulpfile.js b/gulpfile.js new file mode 100644 index 0000000..c9eba86 --- /dev/null +++ b/gulpfile.js @@ -0,0 +1,14 @@ +var gulp = require('gulp'); +var rename = require("gulp-rename"); +var minify = require('gulp-minify-css'); + + +gulp.task('css', function(){ + gulp.src('stylesheets/src/*.css') + .pipe(minify()) + .pipe(rename({ suffix: '.min' })) + .pipe(gulp.dest('stylesheets/min/')); +}); + +gulp.task('default',['css'],function(){ +}); \ No newline at end of file diff --git a/images/comrade.png b/images/comrade.png new file mode 100644 index 0000000..4ce790d Binary files /dev/null and b/images/comrade.png differ diff --git a/images/firstaide_logo.png b/images/firstaide_logo.png new file mode 100644 index 0000000..8c37c11 Binary files /dev/null and b/images/firstaide_logo.png differ diff --git a/images/flags.png b/images/flags.png new file mode 100755 index 0000000..cdd33c3 Binary files /dev/null and b/images/flags.png differ diff --git a/images/help.png b/images/help.png new file mode 100644 index 0000000..f3882c7 Binary files /dev/null and b/images/help.png differ diff --git a/images/logo.png b/images/logo.png new file mode 100644 index 0000000..1b5f472 Binary files /dev/null and b/images/logo.png differ diff --git a/includes/application.php b/includes/application.php new file mode 100755 index 0000000..edc4220 --- /dev/null +++ b/includes/application.php @@ -0,0 +1,74 @@ + 3600)) { + session_unset(); + session_destroy(); + } + $_SESSION['last_activity'] = time(); + + // Create CSRF token if it doesn't exist + if (!isset($_SESSION['csrf_token'])) { + $csrf_token = md5(uniqid(rand(), true)); + $_SESSION['csrf_token'] = $csrf_token; + } else { + $csrf_token = $_SESSION['csrf_token']; + } + + $redirect = ''; + + $UserObj = new FirstAide\User($DB, '', 0); + // Validate session token, if exists + if (!empty($_SESSION['session_token'])) { + $UserAuth = FirstAide\Authentication::createInstanceWithSessionToken($DB, $_SESSION['session_token']); + if (empty($UserAuth)) { + $redirect = HOST; + } else { + $UserObj = new FirstAide\User($DB, '', $UserAuth->getUserId()); + $user_email = $UserObj->getEmailAddress(); + if ($requested_url == HOST) { + $redirect = FirstAide\Router::LOGIN_SUCCESS_URL; + } + } + } else { + $redirect = HOST; + } + + // Redirect to correct URL, if already not there + if (!empty($redirect) + && $requested_url != $redirect + && strpos($requested_url, HOST.'request') === false + ) { + header("Location: ".$redirect); + die(); + } + + $_GET = filter_input_array(INPUT_GET, FILTER_SANITIZE_STRING); + $_POST = filter_input_array(INPUT_POST, FILTER_SANITIZE_STRING); diff --git a/includes/constants.php b/includes/constants.php new file mode 100644 index 0000000..c662a31 --- /dev/null +++ b/includes/constants.php @@ -0,0 +1,3 @@ + 'logo', + 'img_src' => 'images/logo.png', + 'text' => 'Home', + 'url' => HOST + ); + $menu['items'][] = array( + 'text' => 'Get Help Now', + 'url' => FirstAide\Router::getPageUrl( + FirstAide\Router::HOME, + FirstAide\Router::PAGE_GET_HELP_NOW + ) + ); + $menu['items'][] = array( + 'text' => 'Circle of Trust', + 'url' => FirstAide\Router::getPageUrl( + FirstAide\Router::HOME, + FirstAide\Router::PAGE_CIRCLE_OF_TRUST + ) + ); + $menu['items'][] = array( + 'text' => 'Safety Tools', + 'url' => HOST.'p/safety-tools', + 'sub_menu' => array( + array( + 'text' => 'Personal Security Strategies', + 'url' => FirstAide\Router::getPageUrl( + FirstAide\Router::HOME, + FirstAide\Router::PAGE_ADDED_SOON + ) + ), + array( + 'text' => 'RADAR', + 'url' => FirstAide\Router::getPageUrl( + FirstAide\Router::HOME, + FirstAide\Router::PAGE_RADAR + ) + ), + array( + 'text' => 'Coping with Unwanted Strategies', + 'url' => FirstAide\Router::getPageUrl( + FirstAide\Router::HOME, + FirstAide\Router::PAGE_UNWANTED_ATTENTION + ) + ), + array( + 'text' => 'Commonalities of Sexual Predators', + 'url' => FirstAide\Router::getPageUrl( + FirstAide\Router::HOME, + FirstAide\Router::PAGE_SEXUAL_PREDATORS + ) + ), + array( + 'text' => 'Bystander Intervention', + 'url' => FirstAide\Router::getPageUrl( + FirstAide\Router::HOME, + FirstAide\Router::PAGE_BYSTANDER_INTERVENTION + ) + ), + array( + 'text' => 'Safety Plan Basics', + 'url' => FirstAide\Router::getPageUrl( + FirstAide\Router::HOME, + FirstAide\Router::PAGE_SAFETY_PLAN_BASICS + ) + ), + array( + 'text' => 'Safety Plan Worksheet', + 'url' => FirstAide\Router::getPageUrl( + FirstAide\Router::HOME, + FirstAide\Router::PAGE_SAFETY_PLAN_WORKSHEET + ) + ) + ) + ); + $menu['items'][] = array( + 'text' => 'Support Services', + 'url' => HOST.'p/support-services', + 'sub_menu' => array( + array( + 'text' => 'Benefits of Seeking Staff Support', + 'url' => FirstAide\Router::getPageUrl( + FirstAide\Router::HOME, + FirstAide\Router::PAGE_SEEKING_STAFF_SUPPORT + ) + ), + array( + 'text' => 'Available Services after a Sexual Assault', + 'url' => FirstAide\Router::getPageUrl( + FirstAide\Router::HOME, + FirstAide\Router::PAGE_SERVICES_AFTER_ASSAULT + ) + ), + array( + 'text' => 'Peace Corps Commitment to Victims of Sexual Assualt', + 'url' => FirstAide\Router::getPageUrl( + FirstAide\Router::HOME, + FirstAide\Router::PAGE_PEACE_CORPS_COMMITMENT + ) + ), + array( + 'text' => 'What to do After an Assault', + 'url' => FirstAide\Router::getPageUrl( + FirstAide\Router::HOME, + FirstAide\Router::PAGE_ADDED_SOON + ) + ), + array( + 'text' => 'Confidentiality', + 'url' => FirstAide\Router::getPageUrl( + FirstAide\Router::HOME, + FirstAide\Router::PAGE_CONFIDENTIALITY + ) + ), + array( + 'text' => 'Peace Corps Mythbusters', + 'url' => FirstAide\Router::getPageUrl( + FirstAide\Router::HOME, + FirstAide\Router::PAGE_MYTHBUSTERS + ) + ) + ) + ); + $menu['items'][] = array( + 'text' => 'Sexual Assault Awareness', + 'url' => HOST.'p/sexual-assault-awareness', + 'sub_menu' => array( + array( + 'text' => 'Was it Sexual Assault', + 'url' => FirstAide\Router::getPageUrl( + FirstAide\Router::HOME, + FirstAide\Router::PAGE_SEXUAL_ASSAULT + ) + ), + array( + 'text' => 'Sexual Assault Common Questions', + 'url' => FirstAide\Router::getPageUrl( + FirstAide\Router::HOME, + FirstAide\Router::PAGE_COMMON_QUESTIONS + ) + ), + array( + 'text' => 'Impact of Sexual Assault', + 'url' => FirstAide\Router::getPageUrl( + FirstAide\Router::HOME, + FirstAide\Router::PAGE_IMPACT_OF_ASSAULT + ) + ), + array( + 'text' => 'Sexual Harassment', + 'url' => FirstAide\Router::getPageUrl( + FirstAide\Router::HOME, + FirstAide\Router::PAGE_SEXUAL_HARASSMENT + ) + ), + array( + 'text' => 'Helping a Friend or a Community Member', + 'url' => FirstAide\Router::getPageUrl( + FirstAide\Router::HOME, + FirstAide\Router::PAGE_HELP_A_FRIEND + ) + ) + ) + ); + $menu['items'][] = array( + 'text' => 'Policies and Glossary', + 'url' => HOST.'p/policies-and-glossary', + 'sub_menu' => array( + array( + 'text' => 'Peace Corps Policy Summary Sheet', + 'url' => FirstAide\Router::getPageUrl( + FirstAide\Router::HOME, + FirstAide\Router::PAGE_POLICY_SUMMARY + ) + ), + array( + 'text' => 'Glossary', + 'url' => FirstAide\Router::getPageUrl( + FirstAide\Router::HOME, + FirstAide\Router::PAGE_GLOSSARY + ) + ), + array( + 'text' => 'Further Resources', + 'url' => FirstAide\Router::getPageUrl( + FirstAide\Router::HOME, + FirstAide\Router::PAGE_FURTHER_RESOURCES + ) + ) + ) + ); + $menu['items'][] = array( + 'text' => 'Settings', + 'url' => FirstAide\Router::getPageUrl( + FirstAide\Router::HOME, + FirstAide\Router::PAGE_SETTINGS + ) + ); + + $user_name = 'Username'; + if (isset($UserObj)) { + $user_name = $UserObj->getName() != '' + ? $UserObj->getName() : $user_name; + } + + $menu['items'][] = array( + 'text' => 'Logged in as: ' . $user_name, + 'url' => FirstAide\Router::getPageUrl( + FirstAide\Router::HOME, + FirstAide\Router::PAGE_SETTINGS + ) + ); + $menu['items'][] = array( + 'elementId' => 'logout', + 'text' => 'Logout', + 'url' => '#' + ); + + $page['menu'] = $menu; + $page['javascripts'][] = 'menu.js'; +} diff --git a/includes/page_bottom.php b/includes/page_bottom.php new file mode 100644 index 0000000..86b8e3b --- /dev/null +++ b/includes/page_bottom.php @@ -0,0 +1,10 @@ +'; + } +} + echo ''; +?> + + diff --git a/includes/page_top.php b/includes/page_top.php new file mode 100644 index 0000000..8e3a8a8 --- /dev/null +++ b/includes/page_top.php @@ -0,0 +1,35 @@ + + + + + + + + + + <?php echo (isset($page['title']) ? $page['title'].' | ' : ''); ?>FirstAide, Peacecorps + ' : + '' ?> + ' : '' ?> + + + + + diff --git a/includes/settings.php b/includes/settings.php new file mode 100644 index 0000000..4282afc --- /dev/null +++ b/includes/settings.php @@ -0,0 +1,43 @@ + $page)); + + require_once($APPLICATION_DIR.'/includes/page_bottom.php'); diff --git a/install.sh b/install.sh new file mode 100755 index 0000000..95e1628 --- /dev/null +++ b/install.sh @@ -0,0 +1,25 @@ +# install php7 and mysql +sudo apt-get install php7.0 php7.0-fpm php7.0-mysql -y + +# install composer, a package dependency manager +php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" +php composer-setup.php +php -r "unlink('composer-setup.php');" + +# install node and npm for minification of css +sudo apt-get install nodejs npm + +# install npm gulp cli globally for css minification +sudo npm install -g gulp-cli + +# installing packages using composer +composer update + +# installing packages using npm (such as gulp) +npm install + +# Changing permissions of cache directory +sudo chmod -R 777 cache/ + +# running gulp tasks for minifying css +gulp diff --git a/jasmine.config.js b/jasmine.config.js new file mode 100644 index 0000000..3ad7e62 --- /dev/null +++ b/jasmine.config.js @@ -0,0 +1,64 @@ +// Karma configuration +// Generated on Fri May 08 2015 21:55:21 GMT-0400 (Eastern Daylight Time) + +module.exports = function(config) { + config.set({ + + // base path that will be used to resolve all patterns (eg. files, exclude) + basePath: '', + + // frameworks to use + // available frameworks: https://npmjs.org/browse/keyword/karma-adapter + frameworks: ['jasmine-jquery', 'jasmine'], + + // list of files / patterns to load in the browser + files: [ + 'js/jquery-3.2.1.min.js', + 'js/*.js' , 'tests/**/*Spec.js' + ], + + // list of files to exclude + exclude: [ + ], + + // preprocess matching files before serving them to the browser + // available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor + preprocessors: { + }, + + // test results reporter to use + // possible values: 'dots', 'progress' + // available reporters: https://npmjs.org/browse/keyword/karma-reporter + reporters: ['progress', 'coverage'], + + // web server port + port: 9876, + + // enable / disable colors in the output (reporters and logs) + colors: true, + + // level of logging + // possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG + logLevel: config.LOG_INFO, + + // enable / disable watching file and executing tests whenever any file changes + autoWatch: false, + + // start these browsers + // available browser launchers: https://npmjs.org/browse/keyword/karma-launcher + //browsers: ['Firefox'], + browsers: ['PhantomJS'], + + // Which plugins to enable + plugins: [ + 'karma-phantomjs-launcher', + 'karma-jasmine-jquery', + 'karma-coverage', + 'karma-jasmine', + ], + + // Continuous Integration mode + // if true, Karma captures browsers, runs the tests and exits + singleRun: false + }); +}; diff --git a/js/circle_of_trust.js b/js/circle_of_trust.js new file mode 100644 index 0000000..c12a9d0 --- /dev/null +++ b/js/circle_of_trust.js @@ -0,0 +1,161 @@ +/** + * showResponseModal() displays a modal on receiving response + * + * @response{dictionary} contains ajax call response + * @pageReload{bool value} used to determine if the page needs to be loaded or not based on the response + */ +function showResponseModal(response, pageReload) { + if (typeof response !== 'undefined') { + if (typeof pageReload === 'undefined') { pageReload = true; } + if (!response.response) { + $('.ui.modal').find('.header').text('Are you lost?'); + } else { + $('.ui.modal').find('.header').text('Reloading'); + } + $('.ui.modal').find('.content').text(response.message); + $('.ui.modal').modal('show'); + if (pageReload) { + setTimeout(function() { + location.reload(); + }, 4000); + } + } +} + +/** + * placeCircleOfTrustIcons() used to place all the comrade icons in a circle + * + */ +function placeCircleOfTrustIcons() { + //circle type - 1 whole, 0.5 half, 0.25 quarter + var type = 1, + //distance from center + radius = '200%', + //shift start from 0 + start = -90, + $elements = $('.circle li:not(:first-child)'), + //For even distro of elements of comrades + numberOfElements = (type === 1) ? $elements.length : $elements.length - 1, + slice = 360 * type / numberOfElements; + + $elements.each(function(i) { + var $self = $(this), + rotate = slice * i + start, + rotateReverse = rotate * -1; + + $self.css({ + 'transform': 'rotate(' + rotate + 'deg) translate(' + radius + ') rotate(' + rotateReverse + 'deg)' + }); + }); +} + +/** + * toggleCircleOfTrustSections() used to toggle views between circle of trust section, edit comrades details section and get help via sms section + * + * @action{string} determines the action based on which the view is rendered + */ +function toggleCircleOfTrustSections(action) { + var circleOfTrust = $('.circle-of-trust-page .circle-of-trust'), + editComrades = $('.circle-of-trust-page .edit-comrades-section'), + comradeAction = $('.circle-of-trust-page .comrade-action-section'); + + + if (action === 'back') { + editComrades.fadeOut('slow'); + comradeAction.fadeOut('slow'); + circleOfTrust.delay(500).fadeIn('slow'); + } else if (action === 'edit') { + comradeAction.fadeOut('slow'); + circleOfTrust.fadeOut('slow'); + editComrades.delay(500).fadeIn('slow'); + } else if (action === 'help') { + circleOfTrust.fadeOut('slow'); + editComrades.fadeOut('slow'); + comradeAction.delay(500).fadeIn('slow'); + } +} + + +$(document).ready(function() { + $('button').attr("disabled", false); + + placeCircleOfTrustIcons(); + $('.circle-of-trust-page .circle-of-trust').fadeIn(); + $('.icon.angle.left').on('click', function() { + toggleCircleOfTrustSections('back'); + }); + + $('.icon.edit').on('click', function() { + toggleCircleOfTrustSections('edit'); + }); + + $('.get-help-button').on('click', function() { + toggleCircleOfTrustSections('help'); + }); + + $('.comrade-form .submit').on('click', function(e) { + e.preventDefault(); + var comradesData = [], + comradesDataElement = '.comrade-data', + validData = true; + $(comradesDataElement).each(function(i) { + var ele = $(comradesDataElement)[i], + eleId = '#' + ele.id, + val = $(eleId).val().trim(); + + if (val.length > 0) { + if (validation.isPhoneNumber(val) && val.length > 5 && val.length < 16) { + comradesData.push(val); + } else { + validData = false; + showError($(eleId).parent(), 'Please enter a valid number'); + } + } + }); + if (comradesData.length == 0) { + validData = false; + showError($('#' + $('.comrade-data')[0].id).parent(), 'Please enter atleast one valid number'); + } + + if (validData) { + var postData = { + type: 'update_circle_data', + comrades_data: comradesData, + csrf_token: CSRF_TOKEN + } + try { + $.ajax({ + url: 'request/circle_of_trust.php', + type: "POST", + dataType: 'json', + data: postData, + success: function(response) { + showResponseModal(response); + } + }); + } catch (error) { + return false; + } + } + }); + + $('.comrade-action-button').on('click', function() { + var postData = { + type: 'send_sms_circle_of_trust', + msg_type: $(this).attr('id') + } + try { + $.ajax({ + url: 'request/send_notification.php', + type: "POST", + dataType: 'json', + data: postData, + success: function(response) { + showResponseModal(response, false); + } + }); + } catch (error) { + return false; + } + }); +}); diff --git a/js/country_list.json b/js/country_list.json new file mode 100644 index 0000000..554b1f4 --- /dev/null +++ b/js/country_list.json @@ -0,0 +1 @@ +{"AF":"Afghanistan","AX":"\u00c5land Islands","AL":"Albania","DZ":"Algeria","AS":"American Samoa","AD":"Andorra","AO":"Angola","AI":"Anguilla","AQ":"Antarctica","AG":"Antigua & Barbuda","AR":"Argentina","AM":"Armenia","AW":"Aruba","AC":"Ascension Island","AU":"Australia","AT":"Austria","AZ":"Azerbaijan","BS":"Bahamas","BH":"Bahrain","BD":"Bangladesh","BB":"Barbados","BY":"Belarus","BE":"Belgium","BZ":"Belize","BJ":"Benin","BM":"Bermuda","BT":"Bhutan","BO":"Bolivia","BA":"Bosnia & Herzegovina","BW":"Botswana","BR":"Brazil","IO":"British Indian Ocean Territory","VG":"British Virgin Islands","BN":"Brunei","BG":"Bulgaria","BF":"Burkina Faso","BI":"Burundi","KH":"Cambodia","CM":"Cameroon","CA":"Canada","IC":"Canary Islands","CV":"Cape Verde","BQ":"Caribbean Netherlands","KY":"Cayman Islands","CF":"Central African Republic","EA":"Ceuta & Melilla","TD":"Chad","CL":"Chile","CN":"China","CX":"Christmas Island","CC":"Cocos (Keeling) Islands","CO":"Colombia","KM":"Comoros","CG":"Congo - Brazzaville","CD":"Congo - Kinshasa","CK":"Cook Islands","CR":"Costa Rica","CI":"C\u00f4te d\u2019Ivoire","HR":"Croatia","CU":"Cuba","CW":"Cura\u00e7ao","CY":"Cyprus","CZ":"Czech Republic","DK":"Denmark","DG":"Diego Garcia","DJ":"Djibouti","DM":"Dominica","DO":"Dominican Republic","EC":"Ecuador","EG":"Egypt","SV":"El Salvador","GQ":"Equatorial Guinea","ER":"Eritrea","EE":"Estonia","ET":"Ethiopia","FK":"Falkland Islands","FO":"Faroe Islands","FJ":"Fiji","FI":"Finland","FR":"France","GF":"French Guiana","PF":"French Polynesia","TF":"French Southern Territories","GA":"Gabon","GM":"Gambia","GE":"Georgia","DE":"Germany","GH":"Ghana","GI":"Gibraltar","GR":"Greece","GL":"Greenland","GD":"Grenada","GP":"Guadeloupe","GU":"Guam","GT":"Guatemala","GG":"Guernsey","GN":"Guinea","GW":"Guinea-Bissau","GY":"Guyana","HT":"Haiti","HN":"Honduras","HK":"Hong Kong SAR China","HU":"Hungary","IS":"Iceland","IN":"India","ID":"Indonesia","IR":"Iran","IQ":"Iraq","IE":"Ireland","IM":"Isle of Man","IL":"Israel","IT":"Italy","JM":"Jamaica","JP":"Japan","JE":"Jersey","JO":"Jordan","KZ":"Kazakhstan","KE":"Kenya","KI":"Kiribati","XK":"Kosovo","KW":"Kuwait","KG":"Kyrgyzstan","LA":"Laos","LV":"Latvia","LB":"Lebanon","LS":"Lesotho","LR":"Liberia","LY":"Libya","LI":"Liechtenstein","LT":"Lithuania","LU":"Luxembourg","MO":"Macau SAR China","MK":"Macedonia","MG":"Madagascar","MW":"Malawi","MY":"Malaysia","MV":"Maldives","ML":"Mali","MT":"Malta","MH":"Marshall Islands","MQ":"Martinique","MR":"Mauritania","MU":"Mauritius","YT":"Mayotte","MX":"Mexico","FM":"Micronesia","MD":"Moldova","MC":"Monaco","MN":"Mongolia","ME":"Montenegro","MS":"Montserrat","MA":"Morocco","MZ":"Mozambique","MM":"Myanmar (Burma)","NA":"Namibia","NR":"Nauru","NP":"Nepal","NL":"Netherlands","NC":"New Caledonia","NZ":"New Zealand","NI":"Nicaragua","NE":"Niger","NG":"Nigeria","NU":"Niue","NF":"Norfolk Island","KP":"North Korea","MP":"Northern Mariana Islands","NO":"Norway","OM":"Oman","PK":"Pakistan","PW":"Palau","PS":"Palestinian Territories","PA":"Panama","PG":"Papua New Guinea","PY":"Paraguay","PE":"Peru","PH":"Philippines","PN":"Pitcairn Islands","PL":"Poland","PT":"Portugal","PR":"Puerto Rico","QA":"Qatar","RE":"R\u00e9union","RO":"Romania","RU":"Russia","RW":"Rwanda","WS":"Samoa","SM":"San Marino","ST":"S\u00e3o Tom\u00e9 & Pr\u00edncipe","SA":"Saudi Arabia","SN":"Senegal","RS":"Serbia","SC":"Seychelles","SL":"Sierra Leone","SG":"Singapore","SX":"Sint Maarten","SK":"Slovakia","SI":"Slovenia","SB":"Solomon Islands","SO":"Somalia","ZA":"South Africa","GS":"South Georgia & South Sandwich Islands","KR":"South Korea","SS":"South Sudan","ES":"Spain","LK":"Sri Lanka","BL":"St. Barth\u00e9lemy","SH":"St. Helena","KN":"St. Kitts & Nevis","LC":"St. Lucia","MF":"St. Martin","PM":"St. Pierre & Miquelon","VC":"St. Vincent & Grenadines","SD":"Sudan","SR":"Suriname","SJ":"Svalbard & Jan Mayen","SZ":"Swaziland","SE":"Sweden","CH":"Switzerland","SY":"Syria","TW":"Taiwan","TJ":"Tajikistan","TZ":"Tanzania","TH":"Thailand","TL":"Timor-Leste","TG":"Togo","TK":"Tokelau","TO":"Tonga","TT":"Trinidad & Tobago","TA":"Tristan da Cunha","TN":"Tunisia","TR":"Turkey","TM":"Turkmenistan","TC":"Turks & Caicos Islands","TV":"Tuvalu","UM":"U.S. Outlying Islands","VI":"U.S. Virgin Islands","UG":"Uganda","UA":"Ukraine","AE":"United Arab Emirates","GB":"United Kingdom","US":"United States","UY":"Uruguay","UZ":"Uzbekistan","VU":"Vanuatu","VA":"Vatican City","VE":"Venezuela","VN":"Vietnam","WF":"Wallis & Futuna","EH":"Western Sahara","YE":"Yemen","ZM":"Zambia","ZW":"Zimbabwe"} \ No newline at end of file diff --git a/js/error.js b/js/error.js new file mode 100644 index 0000000..74e96ec --- /dev/null +++ b/js/error.js @@ -0,0 +1,29 @@ +/** + * showError() displays error divisions + * with given message(msg) + * for a short span of time inside given element + * + * @element {DOM element} element in which error will be shown + * @msg {string} The message to be displayed for the error + */ +function showError(element, msg) { + if (typeof element !== 'undefined') { + element.addClass('error'); + element.find('.ui.red.pointing').text(msg); + element.find('.ui.red.pointing').show(); + setTimeout(function() {element.find('.ui.red').hide();}, 7000); + } +} + +/** + * hideError() hides error divisions + * inside given element + * + * @element {DOM element} element where the error will be hidden + */ +function hideError(element) { + if (typeof element !== 'undefined') { + element.removeClass('error'); + element.find('.ui.red.pointing').hide(); + } +} diff --git a/js/get_help_now.js b/js/get_help_now.js new file mode 100644 index 0000000..6f45efe --- /dev/null +++ b/js/get_help_now.js @@ -0,0 +1,42 @@ +/** + * showGetHelpActionSection() displays the page section + * where the user has options to seek help + * such as call or message + */ +function showGetHelpActionSection () { + var getHelpSection = $('#get-help-section'), + getHelpActionSection = $('#get-help-action-section'); + getHelpSection.fadeOut('slow'); + getHelpActionSection.delay(500).fadeIn('slow'); +} + +/** + * hideGetHelpActionSection() hides the get help page section + * and navigate to other section + */ +function hideGetHelpActionSection() { + var getHelpSection = $('#get-help-section'), + getHelpActionSection = $('#get-help-action-section'); + getHelpActionSection.fadeOut('slow'); + getHelpSection.delay(500).fadeIn('slow'); + setTimeout(function() { + $('#content-container').addClass('hide'); + $('#content-container > div > div').addClass('hide'); + }, 600); +} +$(document).ready(function() { + $('.contact-button').on('click', function() { + var thisId = $(this).attr('id'); + $('#get-help-call').attr('data-info', thisId); + $('#get-help-sms').attr('data-info', thisId); + if ($('#content-container #' + thisId + '-container').length > 0) { + $('#content-container').removeClass('hide'); + $('#content-container #' + thisId + '-container').removeClass('hide'); + } + showGetHelpActionSection(); + }); + + $('#get-help-action-section .remove.icon').on('click', function() { + hideGetHelpActionSection(); + }); +}); diff --git a/js/index.js b/js/index.js new file mode 100644 index 0000000..a66c9de --- /dev/null +++ b/js/index.js @@ -0,0 +1,288 @@ +/** + * notEmpty() checks if the given input field is empty + * + * @elementData {dictionary} contains field element to check + * an error message to show + */ +function notEmpty(elementData) { + if (typeof elementData.element !== 'undefined') { + if (elementData.element.val().trim().length <= 0) { + showError(elementData.element.parent(), elementData.text); + return false; + } else { + hideError(elementData.element.parent()); + return true; + } + } + return false; +} + +/** + * showResponse() displays modal on receiving response + * + * @thisElement {DOM element} The element to fadeOut + * on receiving successfull response + * @response {dictionary} contains ajax call response + */ +function showResponse(thisElement, response) { + if (!response.response) { + $('.ui.modal').find('.header').text('Are you lost?'); + $('.ui.modal').find('.content').text(response.message); + $('.ui.modal').modal('show'); + } else { + setTimeout(function() { + thisElement.fadeOut('slow', function() { + $('.processing').fadeIn('slow'); + }); + }, 100); + + var val = 85; + $('.processing .progress').progress({percent: val}); + setTimeout(function() { + $('.ui.modal').find('.header').text('Yippee'); + $('.ui.modal').find('.content').text(response.message); + $('.ui.modal').modal('show'); + }, 2000); + + if (response.redirect_url) { + setTimeout(function() { + window.location.href = response.redirect_url; + }, 5500); + } else if(typeof response.reload !== 'undefined' && response.reload) { + setTimeout(function() { + location.reload(); + }, 4000); + } + } +} + +/** + * passwordScore() calculates the password score + * + * @pass {string} The password string + */ +function passwordScore(pass) { + var score = 1, + error = []; + + if (/[A-Z]/.test(pass)) { + score++; + } else { + error.push("at least one upper case letters"); + } + + if (/[0-9]/.test(pass)) { + score++; + } else { + error.push("at least one number"); + } + + if (!(/^[a-zA-Z0-9- ]*$/.test(pass))) { + score++; + } else { + error.push("at least one special character"); + } + + if (pass.length < 6) { + score = 0; + error.push("minimum 6 characters long"); + } + else { + score++; + } + return {score: score, error: error}; +} + +/** + * passwordFieldKeyUp() displays error messages for password field + * on keyUp event + * + * @passwordField {DOM element} The password input field + */ +function passwordFieldKeyUp(passwordField) { + if (typeof passwordField !== 'undefined') { + var scoreData = passwordScore(passwordField.val()), + element = $('#password-strength-status'); + element.parent().show(); + hideError(passwordField.parent()); + switch(scoreData.score) { + case 7: + case 6: + case 5: + case 4: + element.progress({percent: 95}); + element.removeClass().addClass('ui green progress'); + element.find('.label').html("Password Strength: Very Strong"); + break; + case 3: + element.progress({percent: 75}); + element.removeClass().addClass('ui orange progress'); + element.find('.label').html("Password Strength: Strong"); + break; + case 2: + element.progress({percent: 45}); + element.removeClass().addClass('ui yellow progress'); + element.find('.label').html("Password Strength: Weak"); + break; + default: + element.progress({percent: 25}); + element.removeClass().addClass('ui red progress'); + element.find('.label').html("Password Strength: Very Weak"); + showError(passwordField.parent(), 'Minimum 6 characters long'); + break; + } + } +} + +$('.signup-form').find('#password').keyup(function() { + passwordFieldKeyUp($(this)); +}); + +$(document).ready(function() { + $(function() { + $('.ui.dropdown').dropdown(); + $('#example1').progress(); + if (typeof window.USERS_COUNTRY !== 'undefined') { + $('.item[data-value~="' + window.USERS_COUNTRY +'"]').trigger( "click" ); + } + }); + setTimeout(function() { + $('.preloader').fadeOut('slow', function() { + $('.content').fadeIn('slow'); + }); + }, 1000); + $( "#sign-up-link" ).click(function(e) { + e.preventDefault(); + $('.login-form-main').fadeOut('slow', function() { + $('.signup-form-main').fadeIn('slow'); + }); + }); + $( "#login-link" ).click(function(e) { + e.preventDefault(); + $('.signup-form-main').fadeOut('slow', function() { + $('.login-form-main').fadeIn('slow'); + }); + }); + + $( ".login-form .submit" ).click(function(e) { + e.preventDefault(); + var thisElement = $('.login-form'), + emailElement = thisElement.find('#email'), + passwordElement = thisElement.find('#password'), + email = emailElement.val().trim(), + password = passwordElement.val().trim(); + + var validData = true; + if (!validation.isEmailAddress(email)) { + showError(emailElement.parent(), 'Please enter a valid email'); + validData = false; + } else { + hideError(emailElement.parent()); + } + validData = notEmpty({ element: passwordElement, text: 'Please enter your password'}); + + if (validData) { + var postData = { + type: 'login', + email: email, + password: password, + csrf_token: CSRF_TOKEN + } + try { + $.ajax({ + url: 'request/auth.php', + type: "POST", + dataType: 'json', + data: postData, + success: function(response) { + showResponse(thisElement, response); + } + }); + } catch (error) { + return false; + } + } + }); + $( ".signup-form .submit" ).click(function(e) { + e.preventDefault(); + var thisElement = $('.signup-form'), + emailElement = thisElement.find('#email'), + nameElement = thisElement.find('#name'), + passwordElement = thisElement.find('#password'), + confirmPasswordElement = thisElement.find('#confirm_password'), + countryElement = thisElement.find('#country'), + email = emailElement.val().trim(), + name = nameElement.val().trim(), + password = passwordElement.val().trim(), + confirm_password = confirmPasswordElement.val().trim(), + country = countryElement.val().trim(), + type = 'signup'; + + var validData = true; + if (!validation.isEmailAddress(email)) { + showError(emailElement.parent(), 'Please enter a valid email'); + validData = false; + } else { + hideError(emailElement.parent()); + } + if (password.length < 6) { + showError(passwordElement.parent(), 'Minimum 6 characters long'); + validData = false; + } else { + hideError(passwordElement.parent()); + } + var elements = { + name: { + element: nameElement, + text: 'Please enter your name' + }, + password: { + element: passwordElement, + text: 'Please enter your password' + }, + confirmPassword: { + element: confirmPasswordElement, + text: 'Please retype your password' + }, + country: { + element: countryElement, + text: 'Please select your country' + } + } + for (var key in elements) { + validData = validData ? notEmpty(elements[key]) : validData; + } + if (password !== confirm_password) { + confirmPasswordElement.val(''); + notEmpty({element: confirmPasswordElement, text: 'Password did not match'}); + validData = false; + } + if ($('#request_type').length && $('#request_type').val() == 'update_user_info') { + type = 'update'; + } + if (validData) { + var postData = { + type: type, + email: email, + name: name, + password: password, + confirm_password: confirm_password, + country: country, + csrf_token: CSRF_TOKEN + } + try { + $.ajax({ + url: 'request/auth.php', + type: "POST", + dataType: 'json', + data: postData, + success: function(response) { + showResponse(thisElement, response); + } + }); + } catch (error) { + return false; + } + } + }); +}); diff --git a/js/jquery-3.2.1.min.js b/js/jquery-3.2.1.min.js new file mode 100644 index 0000000..644d35e --- /dev/null +++ b/js/jquery-3.2.1.min.js @@ -0,0 +1,4 @@ +/*! jQuery v3.2.1 | (c) JS Foundation and other contributors | jquery.org/license */ +!function(a,b){"use strict";"object"==typeof module&&"object"==typeof module.exports?module.exports=a.document?b(a,!0):function(a){if(!a.document)throw new Error("jQuery requires a window with a document");return b(a)}:b(a)}("undefined"!=typeof window?window:this,function(a,b){"use strict";var c=[],d=a.document,e=Object.getPrototypeOf,f=c.slice,g=c.concat,h=c.push,i=c.indexOf,j={},k=j.toString,l=j.hasOwnProperty,m=l.toString,n=m.call(Object),o={};function p(a,b){b=b||d;var c=b.createElement("script");c.text=a,b.head.appendChild(c).parentNode.removeChild(c)}var q="3.2.1",r=function(a,b){return new r.fn.init(a,b)},s=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,t=/^-ms-/,u=/-([a-z])/g,v=function(a,b){return b.toUpperCase()};r.fn=r.prototype={jquery:q,constructor:r,length:0,toArray:function(){return f.call(this)},get:function(a){return null==a?f.call(this):a<0?this[a+this.length]:this[a]},pushStack:function(a){var b=r.merge(this.constructor(),a);return b.prevObject=this,b},each:function(a){return r.each(this,a)},map:function(a){return this.pushStack(r.map(this,function(b,c){return a.call(b,c,b)}))},slice:function(){return this.pushStack(f.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},eq:function(a){var b=this.length,c=+a+(a<0?b:0);return this.pushStack(c>=0&&c0&&b-1 in a)}var x=function(a){var b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u="sizzle"+1*new Date,v=a.document,w=0,x=0,y=ha(),z=ha(),A=ha(),B=function(a,b){return a===b&&(l=!0),0},C={}.hasOwnProperty,D=[],E=D.pop,F=D.push,G=D.push,H=D.slice,I=function(a,b){for(var c=0,d=a.length;c+~]|"+K+")"+K+"*"),S=new RegExp("="+K+"*([^\\]'\"]*?)"+K+"*\\]","g"),T=new RegExp(N),U=new RegExp("^"+L+"$"),V={ID:new RegExp("^#("+L+")"),CLASS:new RegExp("^\\.("+L+")"),TAG:new RegExp("^("+L+"|[*])"),ATTR:new RegExp("^"+M),PSEUDO:new RegExp("^"+N),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+K+"*(even|odd|(([+-]|)(\\d*)n|)"+K+"*(?:([+-]|)"+K+"*(\\d+)|))"+K+"*\\)|)","i"),bool:new RegExp("^(?:"+J+")$","i"),needsContext:new RegExp("^"+K+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+K+"*((?:-\\d)?\\d*)"+K+"*\\)|)(?=[^-]|$)","i")},W=/^(?:input|select|textarea|button)$/i,X=/^h\d$/i,Y=/^[^{]+\{\s*\[native \w/,Z=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,$=/[+~]/,_=new RegExp("\\\\([\\da-f]{1,6}"+K+"?|("+K+")|.)","ig"),aa=function(a,b,c){var d="0x"+b-65536;return d!==d||c?b:d<0?String.fromCharCode(d+65536):String.fromCharCode(d>>10|55296,1023&d|56320)},ba=/([\0-\x1f\x7f]|^-?\d)|^-$|[^\0-\x1f\x7f-\uFFFF\w-]/g,ca=function(a,b){return b?"\0"===a?"\ufffd":a.slice(0,-1)+"\\"+a.charCodeAt(a.length-1).toString(16)+" ":"\\"+a},da=function(){m()},ea=ta(function(a){return a.disabled===!0&&("form"in a||"label"in a)},{dir:"parentNode",next:"legend"});try{G.apply(D=H.call(v.childNodes),v.childNodes),D[v.childNodes.length].nodeType}catch(fa){G={apply:D.length?function(a,b){F.apply(a,H.call(b))}:function(a,b){var c=a.length,d=0;while(a[c++]=b[d++]);a.length=c-1}}}function ga(a,b,d,e){var f,h,j,k,l,o,r,s=b&&b.ownerDocument,w=b?b.nodeType:9;if(d=d||[],"string"!=typeof a||!a||1!==w&&9!==w&&11!==w)return d;if(!e&&((b?b.ownerDocument||b:v)!==n&&m(b),b=b||n,p)){if(11!==w&&(l=Z.exec(a)))if(f=l[1]){if(9===w){if(!(j=b.getElementById(f)))return d;if(j.id===f)return d.push(j),d}else if(s&&(j=s.getElementById(f))&&t(b,j)&&j.id===f)return d.push(j),d}else{if(l[2])return G.apply(d,b.getElementsByTagName(a)),d;if((f=l[3])&&c.getElementsByClassName&&b.getElementsByClassName)return G.apply(d,b.getElementsByClassName(f)),d}if(c.qsa&&!A[a+" "]&&(!q||!q.test(a))){if(1!==w)s=b,r=a;else if("object"!==b.nodeName.toLowerCase()){(k=b.getAttribute("id"))?k=k.replace(ba,ca):b.setAttribute("id",k=u),o=g(a),h=o.length;while(h--)o[h]="#"+k+" "+sa(o[h]);r=o.join(","),s=$.test(a)&&qa(b.parentNode)||b}if(r)try{return G.apply(d,s.querySelectorAll(r)),d}catch(x){}finally{k===u&&b.removeAttribute("id")}}}return i(a.replace(P,"$1"),b,d,e)}function ha(){var a=[];function b(c,e){return a.push(c+" ")>d.cacheLength&&delete b[a.shift()],b[c+" "]=e}return b}function ia(a){return a[u]=!0,a}function ja(a){var b=n.createElement("fieldset");try{return!!a(b)}catch(c){return!1}finally{b.parentNode&&b.parentNode.removeChild(b),b=null}}function ka(a,b){var c=a.split("|"),e=c.length;while(e--)d.attrHandle[c[e]]=b}function la(a,b){var c=b&&a,d=c&&1===a.nodeType&&1===b.nodeType&&a.sourceIndex-b.sourceIndex;if(d)return d;if(c)while(c=c.nextSibling)if(c===b)return-1;return a?1:-1}function ma(a){return function(b){var c=b.nodeName.toLowerCase();return"input"===c&&b.type===a}}function na(a){return function(b){var c=b.nodeName.toLowerCase();return("input"===c||"button"===c)&&b.type===a}}function oa(a){return function(b){return"form"in b?b.parentNode&&b.disabled===!1?"label"in b?"label"in b.parentNode?b.parentNode.disabled===a:b.disabled===a:b.isDisabled===a||b.isDisabled!==!a&&ea(b)===a:b.disabled===a:"label"in b&&b.disabled===a}}function pa(a){return ia(function(b){return b=+b,ia(function(c,d){var e,f=a([],c.length,b),g=f.length;while(g--)c[e=f[g]]&&(c[e]=!(d[e]=c[e]))})})}function qa(a){return a&&"undefined"!=typeof a.getElementsByTagName&&a}c=ga.support={},f=ga.isXML=function(a){var b=a&&(a.ownerDocument||a).documentElement;return!!b&&"HTML"!==b.nodeName},m=ga.setDocument=function(a){var b,e,g=a?a.ownerDocument||a:v;return g!==n&&9===g.nodeType&&g.documentElement?(n=g,o=n.documentElement,p=!f(n),v!==n&&(e=n.defaultView)&&e.top!==e&&(e.addEventListener?e.addEventListener("unload",da,!1):e.attachEvent&&e.attachEvent("onunload",da)),c.attributes=ja(function(a){return a.className="i",!a.getAttribute("className")}),c.getElementsByTagName=ja(function(a){return a.appendChild(n.createComment("")),!a.getElementsByTagName("*").length}),c.getElementsByClassName=Y.test(n.getElementsByClassName),c.getById=ja(function(a){return o.appendChild(a).id=u,!n.getElementsByName||!n.getElementsByName(u).length}),c.getById?(d.filter.ID=function(a){var b=a.replace(_,aa);return function(a){return a.getAttribute("id")===b}},d.find.ID=function(a,b){if("undefined"!=typeof b.getElementById&&p){var c=b.getElementById(a);return c?[c]:[]}}):(d.filter.ID=function(a){var b=a.replace(_,aa);return function(a){var c="undefined"!=typeof a.getAttributeNode&&a.getAttributeNode("id");return c&&c.value===b}},d.find.ID=function(a,b){if("undefined"!=typeof b.getElementById&&p){var c,d,e,f=b.getElementById(a);if(f){if(c=f.getAttributeNode("id"),c&&c.value===a)return[f];e=b.getElementsByName(a),d=0;while(f=e[d++])if(c=f.getAttributeNode("id"),c&&c.value===a)return[f]}return[]}}),d.find.TAG=c.getElementsByTagName?function(a,b){return"undefined"!=typeof b.getElementsByTagName?b.getElementsByTagName(a):c.qsa?b.querySelectorAll(a):void 0}:function(a,b){var c,d=[],e=0,f=b.getElementsByTagName(a);if("*"===a){while(c=f[e++])1===c.nodeType&&d.push(c);return d}return f},d.find.CLASS=c.getElementsByClassName&&function(a,b){if("undefined"!=typeof b.getElementsByClassName&&p)return b.getElementsByClassName(a)},r=[],q=[],(c.qsa=Y.test(n.querySelectorAll))&&(ja(function(a){o.appendChild(a).innerHTML="",a.querySelectorAll("[msallowcapture^='']").length&&q.push("[*^$]="+K+"*(?:''|\"\")"),a.querySelectorAll("[selected]").length||q.push("\\["+K+"*(?:value|"+J+")"),a.querySelectorAll("[id~="+u+"-]").length||q.push("~="),a.querySelectorAll(":checked").length||q.push(":checked"),a.querySelectorAll("a#"+u+"+*").length||q.push(".#.+[+~]")}),ja(function(a){a.innerHTML="";var b=n.createElement("input");b.setAttribute("type","hidden"),a.appendChild(b).setAttribute("name","D"),a.querySelectorAll("[name=d]").length&&q.push("name"+K+"*[*^$|!~]?="),2!==a.querySelectorAll(":enabled").length&&q.push(":enabled",":disabled"),o.appendChild(a).disabled=!0,2!==a.querySelectorAll(":disabled").length&&q.push(":enabled",":disabled"),a.querySelectorAll("*,:x"),q.push(",.*:")})),(c.matchesSelector=Y.test(s=o.matches||o.webkitMatchesSelector||o.mozMatchesSelector||o.oMatchesSelector||o.msMatchesSelector))&&ja(function(a){c.disconnectedMatch=s.call(a,"*"),s.call(a,"[s!='']:x"),r.push("!=",N)}),q=q.length&&new RegExp(q.join("|")),r=r.length&&new RegExp(r.join("|")),b=Y.test(o.compareDocumentPosition),t=b||Y.test(o.contains)?function(a,b){var c=9===a.nodeType?a.documentElement:a,d=b&&b.parentNode;return a===d||!(!d||1!==d.nodeType||!(c.contains?c.contains(d):a.compareDocumentPosition&&16&a.compareDocumentPosition(d)))}:function(a,b){if(b)while(b=b.parentNode)if(b===a)return!0;return!1},B=b?function(a,b){if(a===b)return l=!0,0;var d=!a.compareDocumentPosition-!b.compareDocumentPosition;return d?d:(d=(a.ownerDocument||a)===(b.ownerDocument||b)?a.compareDocumentPosition(b):1,1&d||!c.sortDetached&&b.compareDocumentPosition(a)===d?a===n||a.ownerDocument===v&&t(v,a)?-1:b===n||b.ownerDocument===v&&t(v,b)?1:k?I(k,a)-I(k,b):0:4&d?-1:1)}:function(a,b){if(a===b)return l=!0,0;var c,d=0,e=a.parentNode,f=b.parentNode,g=[a],h=[b];if(!e||!f)return a===n?-1:b===n?1:e?-1:f?1:k?I(k,a)-I(k,b):0;if(e===f)return la(a,b);c=a;while(c=c.parentNode)g.unshift(c);c=b;while(c=c.parentNode)h.unshift(c);while(g[d]===h[d])d++;return d?la(g[d],h[d]):g[d]===v?-1:h[d]===v?1:0},n):n},ga.matches=function(a,b){return ga(a,null,null,b)},ga.matchesSelector=function(a,b){if((a.ownerDocument||a)!==n&&m(a),b=b.replace(S,"='$1']"),c.matchesSelector&&p&&!A[b+" "]&&(!r||!r.test(b))&&(!q||!q.test(b)))try{var d=s.call(a,b);if(d||c.disconnectedMatch||a.document&&11!==a.document.nodeType)return d}catch(e){}return ga(b,n,null,[a]).length>0},ga.contains=function(a,b){return(a.ownerDocument||a)!==n&&m(a),t(a,b)},ga.attr=function(a,b){(a.ownerDocument||a)!==n&&m(a);var e=d.attrHandle[b.toLowerCase()],f=e&&C.call(d.attrHandle,b.toLowerCase())?e(a,b,!p):void 0;return void 0!==f?f:c.attributes||!p?a.getAttribute(b):(f=a.getAttributeNode(b))&&f.specified?f.value:null},ga.escape=function(a){return(a+"").replace(ba,ca)},ga.error=function(a){throw new Error("Syntax error, unrecognized expression: "+a)},ga.uniqueSort=function(a){var b,d=[],e=0,f=0;if(l=!c.detectDuplicates,k=!c.sortStable&&a.slice(0),a.sort(B),l){while(b=a[f++])b===a[f]&&(e=d.push(f));while(e--)a.splice(d[e],1)}return k=null,a},e=ga.getText=function(a){var b,c="",d=0,f=a.nodeType;if(f){if(1===f||9===f||11===f){if("string"==typeof a.textContent)return a.textContent;for(a=a.firstChild;a;a=a.nextSibling)c+=e(a)}else if(3===f||4===f)return a.nodeValue}else while(b=a[d++])c+=e(b);return c},d=ga.selectors={cacheLength:50,createPseudo:ia,match:V,attrHandle:{},find:{},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(a){return a[1]=a[1].replace(_,aa),a[3]=(a[3]||a[4]||a[5]||"").replace(_,aa),"~="===a[2]&&(a[3]=" "+a[3]+" "),a.slice(0,4)},CHILD:function(a){return a[1]=a[1].toLowerCase(),"nth"===a[1].slice(0,3)?(a[3]||ga.error(a[0]),a[4]=+(a[4]?a[5]+(a[6]||1):2*("even"===a[3]||"odd"===a[3])),a[5]=+(a[7]+a[8]||"odd"===a[3])):a[3]&&ga.error(a[0]),a},PSEUDO:function(a){var b,c=!a[6]&&a[2];return V.CHILD.test(a[0])?null:(a[3]?a[2]=a[4]||a[5]||"":c&&T.test(c)&&(b=g(c,!0))&&(b=c.indexOf(")",c.length-b)-c.length)&&(a[0]=a[0].slice(0,b),a[2]=c.slice(0,b)),a.slice(0,3))}},filter:{TAG:function(a){var b=a.replace(_,aa).toLowerCase();return"*"===a?function(){return!0}:function(a){return a.nodeName&&a.nodeName.toLowerCase()===b}},CLASS:function(a){var b=y[a+" "];return b||(b=new RegExp("(^|"+K+")"+a+"("+K+"|$)"))&&y(a,function(a){return b.test("string"==typeof a.className&&a.className||"undefined"!=typeof a.getAttribute&&a.getAttribute("class")||"")})},ATTR:function(a,b,c){return function(d){var e=ga.attr(d,a);return null==e?"!="===b:!b||(e+="","="===b?e===c:"!="===b?e!==c:"^="===b?c&&0===e.indexOf(c):"*="===b?c&&e.indexOf(c)>-1:"$="===b?c&&e.slice(-c.length)===c:"~="===b?(" "+e.replace(O," ")+" ").indexOf(c)>-1:"|="===b&&(e===c||e.slice(0,c.length+1)===c+"-"))}},CHILD:function(a,b,c,d,e){var f="nth"!==a.slice(0,3),g="last"!==a.slice(-4),h="of-type"===b;return 1===d&&0===e?function(a){return!!a.parentNode}:function(b,c,i){var j,k,l,m,n,o,p=f!==g?"nextSibling":"previousSibling",q=b.parentNode,r=h&&b.nodeName.toLowerCase(),s=!i&&!h,t=!1;if(q){if(f){while(p){m=b;while(m=m[p])if(h?m.nodeName.toLowerCase()===r:1===m.nodeType)return!1;o=p="only"===a&&!o&&"nextSibling"}return!0}if(o=[g?q.firstChild:q.lastChild],g&&s){m=q,l=m[u]||(m[u]={}),k=l[m.uniqueID]||(l[m.uniqueID]={}),j=k[a]||[],n=j[0]===w&&j[1],t=n&&j[2],m=n&&q.childNodes[n];while(m=++n&&m&&m[p]||(t=n=0)||o.pop())if(1===m.nodeType&&++t&&m===b){k[a]=[w,n,t];break}}else if(s&&(m=b,l=m[u]||(m[u]={}),k=l[m.uniqueID]||(l[m.uniqueID]={}),j=k[a]||[],n=j[0]===w&&j[1],t=n),t===!1)while(m=++n&&m&&m[p]||(t=n=0)||o.pop())if((h?m.nodeName.toLowerCase()===r:1===m.nodeType)&&++t&&(s&&(l=m[u]||(m[u]={}),k=l[m.uniqueID]||(l[m.uniqueID]={}),k[a]=[w,t]),m===b))break;return t-=e,t===d||t%d===0&&t/d>=0}}},PSEUDO:function(a,b){var c,e=d.pseudos[a]||d.setFilters[a.toLowerCase()]||ga.error("unsupported pseudo: "+a);return e[u]?e(b):e.length>1?(c=[a,a,"",b],d.setFilters.hasOwnProperty(a.toLowerCase())?ia(function(a,c){var d,f=e(a,b),g=f.length;while(g--)d=I(a,f[g]),a[d]=!(c[d]=f[g])}):function(a){return e(a,0,c)}):e}},pseudos:{not:ia(function(a){var b=[],c=[],d=h(a.replace(P,"$1"));return d[u]?ia(function(a,b,c,e){var f,g=d(a,null,e,[]),h=a.length;while(h--)(f=g[h])&&(a[h]=!(b[h]=f))}):function(a,e,f){return b[0]=a,d(b,null,f,c),b[0]=null,!c.pop()}}),has:ia(function(a){return function(b){return ga(a,b).length>0}}),contains:ia(function(a){return a=a.replace(_,aa),function(b){return(b.textContent||b.innerText||e(b)).indexOf(a)>-1}}),lang:ia(function(a){return U.test(a||"")||ga.error("unsupported lang: "+a),a=a.replace(_,aa).toLowerCase(),function(b){var c;do if(c=p?b.lang:b.getAttribute("xml:lang")||b.getAttribute("lang"))return c=c.toLowerCase(),c===a||0===c.indexOf(a+"-");while((b=b.parentNode)&&1===b.nodeType);return!1}}),target:function(b){var c=a.location&&a.location.hash;return c&&c.slice(1)===b.id},root:function(a){return a===o},focus:function(a){return a===n.activeElement&&(!n.hasFocus||n.hasFocus())&&!!(a.type||a.href||~a.tabIndex)},enabled:oa(!1),disabled:oa(!0),checked:function(a){var b=a.nodeName.toLowerCase();return"input"===b&&!!a.checked||"option"===b&&!!a.selected},selected:function(a){return a.parentNode&&a.parentNode.selectedIndex,a.selected===!0},empty:function(a){for(a=a.firstChild;a;a=a.nextSibling)if(a.nodeType<6)return!1;return!0},parent:function(a){return!d.pseudos.empty(a)},header:function(a){return X.test(a.nodeName)},input:function(a){return W.test(a.nodeName)},button:function(a){var b=a.nodeName.toLowerCase();return"input"===b&&"button"===a.type||"button"===b},text:function(a){var b;return"input"===a.nodeName.toLowerCase()&&"text"===a.type&&(null==(b=a.getAttribute("type"))||"text"===b.toLowerCase())},first:pa(function(){return[0]}),last:pa(function(a,b){return[b-1]}),eq:pa(function(a,b,c){return[c<0?c+b:c]}),even:pa(function(a,b){for(var c=0;c=0;)a.push(d);return a}),gt:pa(function(a,b,c){for(var d=c<0?c+b:c;++d1?function(b,c,d){var e=a.length;while(e--)if(!a[e](b,c,d))return!1;return!0}:a[0]}function va(a,b,c){for(var d=0,e=b.length;d-1&&(f[j]=!(g[j]=l))}}else r=wa(r===g?r.splice(o,r.length):r),e?e(null,g,r,i):G.apply(g,r)})}function ya(a){for(var b,c,e,f=a.length,g=d.relative[a[0].type],h=g||d.relative[" "],i=g?1:0,k=ta(function(a){return a===b},h,!0),l=ta(function(a){return I(b,a)>-1},h,!0),m=[function(a,c,d){var e=!g&&(d||c!==j)||((b=c).nodeType?k(a,c,d):l(a,c,d));return b=null,e}];i1&&ua(m),i>1&&sa(a.slice(0,i-1).concat({value:" "===a[i-2].type?"*":""})).replace(P,"$1"),c,i0,e=a.length>0,f=function(f,g,h,i,k){var l,o,q,r=0,s="0",t=f&&[],u=[],v=j,x=f||e&&d.find.TAG("*",k),y=w+=null==v?1:Math.random()||.1,z=x.length;for(k&&(j=g===n||g||k);s!==z&&null!=(l=x[s]);s++){if(e&&l){o=0,g||l.ownerDocument===n||(m(l),h=!p);while(q=a[o++])if(q(l,g||n,h)){i.push(l);break}k&&(w=y)}c&&((l=!q&&l)&&r--,f&&t.push(l))}if(r+=s,c&&s!==r){o=0;while(q=b[o++])q(t,u,g,h);if(f){if(r>0)while(s--)t[s]||u[s]||(u[s]=E.call(i));u=wa(u)}G.apply(i,u),k&&!f&&u.length>0&&r+b.length>1&&ga.uniqueSort(i)}return k&&(w=y,j=v),t};return c?ia(f):f}return h=ga.compile=function(a,b){var c,d=[],e=[],f=A[a+" "];if(!f){b||(b=g(a)),c=b.length;while(c--)f=ya(b[c]),f[u]?d.push(f):e.push(f);f=A(a,za(e,d)),f.selector=a}return f},i=ga.select=function(a,b,c,e){var f,i,j,k,l,m="function"==typeof a&&a,n=!e&&g(a=m.selector||a);if(c=c||[],1===n.length){if(i=n[0]=n[0].slice(0),i.length>2&&"ID"===(j=i[0]).type&&9===b.nodeType&&p&&d.relative[i[1].type]){if(b=(d.find.ID(j.matches[0].replace(_,aa),b)||[])[0],!b)return c;m&&(b=b.parentNode),a=a.slice(i.shift().value.length)}f=V.needsContext.test(a)?0:i.length;while(f--){if(j=i[f],d.relative[k=j.type])break;if((l=d.find[k])&&(e=l(j.matches[0].replace(_,aa),$.test(i[0].type)&&qa(b.parentNode)||b))){if(i.splice(f,1),a=e.length&&sa(i),!a)return G.apply(c,e),c;break}}}return(m||h(a,n))(e,b,!p,c,!b||$.test(a)&&qa(b.parentNode)||b),c},c.sortStable=u.split("").sort(B).join("")===u,c.detectDuplicates=!!l,m(),c.sortDetached=ja(function(a){return 1&a.compareDocumentPosition(n.createElement("fieldset"))}),ja(function(a){return a.innerHTML="","#"===a.firstChild.getAttribute("href")})||ka("type|href|height|width",function(a,b,c){if(!c)return a.getAttribute(b,"type"===b.toLowerCase()?1:2)}),c.attributes&&ja(function(a){return a.innerHTML="",a.firstChild.setAttribute("value",""),""===a.firstChild.getAttribute("value")})||ka("value",function(a,b,c){if(!c&&"input"===a.nodeName.toLowerCase())return a.defaultValue}),ja(function(a){return null==a.getAttribute("disabled")})||ka(J,function(a,b,c){var d;if(!c)return a[b]===!0?b.toLowerCase():(d=a.getAttributeNode(b))&&d.specified?d.value:null}),ga}(a);r.find=x,r.expr=x.selectors,r.expr[":"]=r.expr.pseudos,r.uniqueSort=r.unique=x.uniqueSort,r.text=x.getText,r.isXMLDoc=x.isXML,r.contains=x.contains,r.escapeSelector=x.escape;var y=function(a,b,c){var d=[],e=void 0!==c;while((a=a[b])&&9!==a.nodeType)if(1===a.nodeType){if(e&&r(a).is(c))break;d.push(a)}return d},z=function(a,b){for(var c=[];a;a=a.nextSibling)1===a.nodeType&&a!==b&&c.push(a);return c},A=r.expr.match.needsContext;function B(a,b){return a.nodeName&&a.nodeName.toLowerCase()===b.toLowerCase()}var C=/^<([a-z][^\/\0>:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i,D=/^.[^:#\[\.,]*$/;function E(a,b,c){return r.isFunction(b)?r.grep(a,function(a,d){return!!b.call(a,d,a)!==c}):b.nodeType?r.grep(a,function(a){return a===b!==c}):"string"!=typeof b?r.grep(a,function(a){return i.call(b,a)>-1!==c}):D.test(b)?r.filter(b,a,c):(b=r.filter(b,a),r.grep(a,function(a){return i.call(b,a)>-1!==c&&1===a.nodeType}))}r.filter=function(a,b,c){var d=b[0];return c&&(a=":not("+a+")"),1===b.length&&1===d.nodeType?r.find.matchesSelector(d,a)?[d]:[]:r.find.matches(a,r.grep(b,function(a){return 1===a.nodeType}))},r.fn.extend({find:function(a){var b,c,d=this.length,e=this;if("string"!=typeof a)return this.pushStack(r(a).filter(function(){for(b=0;b1?r.uniqueSort(c):c},filter:function(a){return this.pushStack(E(this,a||[],!1))},not:function(a){return this.pushStack(E(this,a||[],!0))},is:function(a){return!!E(this,"string"==typeof a&&A.test(a)?r(a):a||[],!1).length}});var F,G=/^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]+))$/,H=r.fn.init=function(a,b,c){var e,f;if(!a)return this;if(c=c||F,"string"==typeof a){if(e="<"===a[0]&&">"===a[a.length-1]&&a.length>=3?[null,a,null]:G.exec(a),!e||!e[1]&&b)return!b||b.jquery?(b||c).find(a):this.constructor(b).find(a);if(e[1]){if(b=b instanceof r?b[0]:b,r.merge(this,r.parseHTML(e[1],b&&b.nodeType?b.ownerDocument||b:d,!0)),C.test(e[1])&&r.isPlainObject(b))for(e in b)r.isFunction(this[e])?this[e](b[e]):this.attr(e,b[e]);return this}return f=d.getElementById(e[2]),f&&(this[0]=f,this.length=1),this}return a.nodeType?(this[0]=a,this.length=1,this):r.isFunction(a)?void 0!==c.ready?c.ready(a):a(r):r.makeArray(a,this)};H.prototype=r.fn,F=r(d);var I=/^(?:parents|prev(?:Until|All))/,J={children:!0,contents:!0,next:!0,prev:!0};r.fn.extend({has:function(a){var b=r(a,this),c=b.length;return this.filter(function(){for(var a=0;a-1:1===c.nodeType&&r.find.matchesSelector(c,a))){f.push(c);break}return this.pushStack(f.length>1?r.uniqueSort(f):f)},index:function(a){return a?"string"==typeof a?i.call(r(a),this[0]):i.call(this,a.jquery?a[0]:a):this[0]&&this[0].parentNode?this.first().prevAll().length:-1},add:function(a,b){return this.pushStack(r.uniqueSort(r.merge(this.get(),r(a,b))))},addBack:function(a){return this.add(null==a?this.prevObject:this.prevObject.filter(a))}});function K(a,b){while((a=a[b])&&1!==a.nodeType);return a}r.each({parent:function(a){var b=a.parentNode;return b&&11!==b.nodeType?b:null},parents:function(a){return y(a,"parentNode")},parentsUntil:function(a,b,c){return y(a,"parentNode",c)},next:function(a){return K(a,"nextSibling")},prev:function(a){return K(a,"previousSibling")},nextAll:function(a){return y(a,"nextSibling")},prevAll:function(a){return y(a,"previousSibling")},nextUntil:function(a,b,c){return y(a,"nextSibling",c)},prevUntil:function(a,b,c){return y(a,"previousSibling",c)},siblings:function(a){return z((a.parentNode||{}).firstChild,a)},children:function(a){return z(a.firstChild)},contents:function(a){return B(a,"iframe")?a.contentDocument:(B(a,"template")&&(a=a.content||a),r.merge([],a.childNodes))}},function(a,b){r.fn[a]=function(c,d){var e=r.map(this,b,c);return"Until"!==a.slice(-5)&&(d=c),d&&"string"==typeof d&&(e=r.filter(d,e)),this.length>1&&(J[a]||r.uniqueSort(e),I.test(a)&&e.reverse()),this.pushStack(e)}});var L=/[^\x20\t\r\n\f]+/g;function M(a){var b={};return r.each(a.match(L)||[],function(a,c){b[c]=!0}),b}r.Callbacks=function(a){a="string"==typeof a?M(a):r.extend({},a);var b,c,d,e,f=[],g=[],h=-1,i=function(){for(e=e||a.once,d=b=!0;g.length;h=-1){c=g.shift();while(++h-1)f.splice(c,1),c<=h&&h--}),this},has:function(a){return a?r.inArray(a,f)>-1:f.length>0},empty:function(){return f&&(f=[]),this},disable:function(){return e=g=[],f=c="",this},disabled:function(){return!f},lock:function(){return e=g=[],c||b||(f=c=""),this},locked:function(){return!!e},fireWith:function(a,c){return e||(c=c||[],c=[a,c.slice?c.slice():c],g.push(c),b||i()),this},fire:function(){return j.fireWith(this,arguments),this},fired:function(){return!!d}};return j};function N(a){return a}function O(a){throw a}function P(a,b,c,d){var e;try{a&&r.isFunction(e=a.promise)?e.call(a).done(b).fail(c):a&&r.isFunction(e=a.then)?e.call(a,b,c):b.apply(void 0,[a].slice(d))}catch(a){c.apply(void 0,[a])}}r.extend({Deferred:function(b){var c=[["notify","progress",r.Callbacks("memory"),r.Callbacks("memory"),2],["resolve","done",r.Callbacks("once memory"),r.Callbacks("once memory"),0,"resolved"],["reject","fail",r.Callbacks("once memory"),r.Callbacks("once memory"),1,"rejected"]],d="pending",e={state:function(){return d},always:function(){return f.done(arguments).fail(arguments),this},"catch":function(a){return e.then(null,a)},pipe:function(){var a=arguments;return r.Deferred(function(b){r.each(c,function(c,d){var e=r.isFunction(a[d[4]])&&a[d[4]];f[d[1]](function(){var a=e&&e.apply(this,arguments);a&&r.isFunction(a.promise)?a.promise().progress(b.notify).done(b.resolve).fail(b.reject):b[d[0]+"With"](this,e?[a]:arguments)})}),a=null}).promise()},then:function(b,d,e){var f=0;function g(b,c,d,e){return function(){var h=this,i=arguments,j=function(){var a,j;if(!(b=f&&(d!==O&&(h=void 0,i=[a]),c.rejectWith(h,i))}};b?k():(r.Deferred.getStackHook&&(k.stackTrace=r.Deferred.getStackHook()),a.setTimeout(k))}}return r.Deferred(function(a){c[0][3].add(g(0,a,r.isFunction(e)?e:N,a.notifyWith)),c[1][3].add(g(0,a,r.isFunction(b)?b:N)),c[2][3].add(g(0,a,r.isFunction(d)?d:O))}).promise()},promise:function(a){return null!=a?r.extend(a,e):e}},f={};return r.each(c,function(a,b){var g=b[2],h=b[5];e[b[1]]=g.add,h&&g.add(function(){d=h},c[3-a][2].disable,c[0][2].lock),g.add(b[3].fire),f[b[0]]=function(){return f[b[0]+"With"](this===f?void 0:this,arguments),this},f[b[0]+"With"]=g.fireWith}),e.promise(f),b&&b.call(f,f),f},when:function(a){var b=arguments.length,c=b,d=Array(c),e=f.call(arguments),g=r.Deferred(),h=function(a){return function(c){d[a]=this,e[a]=arguments.length>1?f.call(arguments):c,--b||g.resolveWith(d,e)}};if(b<=1&&(P(a,g.done(h(c)).resolve,g.reject,!b),"pending"===g.state()||r.isFunction(e[c]&&e[c].then)))return g.then();while(c--)P(e[c],h(c),g.reject);return g.promise()}});var Q=/^(Eval|Internal|Range|Reference|Syntax|Type|URI)Error$/;r.Deferred.exceptionHook=function(b,c){a.console&&a.console.warn&&b&&Q.test(b.name)&&a.console.warn("jQuery.Deferred exception: "+b.message,b.stack,c)},r.readyException=function(b){a.setTimeout(function(){throw b})};var R=r.Deferred();r.fn.ready=function(a){return R.then(a)["catch"](function(a){r.readyException(a)}),this},r.extend({isReady:!1,readyWait:1,ready:function(a){(a===!0?--r.readyWait:r.isReady)||(r.isReady=!0,a!==!0&&--r.readyWait>0||R.resolveWith(d,[r]))}}),r.ready.then=R.then;function S(){d.removeEventListener("DOMContentLoaded",S), +a.removeEventListener("load",S),r.ready()}"complete"===d.readyState||"loading"!==d.readyState&&!d.documentElement.doScroll?a.setTimeout(r.ready):(d.addEventListener("DOMContentLoaded",S),a.addEventListener("load",S));var T=function(a,b,c,d,e,f,g){var h=0,i=a.length,j=null==c;if("object"===r.type(c)){e=!0;for(h in c)T(a,b,h,c[h],!0,f,g)}else if(void 0!==d&&(e=!0,r.isFunction(d)||(g=!0),j&&(g?(b.call(a,d),b=null):(j=b,b=function(a,b,c){return j.call(r(a),c)})),b))for(;h1,null,!0)},removeData:function(a){return this.each(function(){X.remove(this,a)})}}),r.extend({queue:function(a,b,c){var d;if(a)return b=(b||"fx")+"queue",d=W.get(a,b),c&&(!d||Array.isArray(c)?d=W.access(a,b,r.makeArray(c)):d.push(c)),d||[]},dequeue:function(a,b){b=b||"fx";var c=r.queue(a,b),d=c.length,e=c.shift(),f=r._queueHooks(a,b),g=function(){r.dequeue(a,b)};"inprogress"===e&&(e=c.shift(),d--),e&&("fx"===b&&c.unshift("inprogress"),delete f.stop,e.call(a,g,f)),!d&&f&&f.empty.fire()},_queueHooks:function(a,b){var c=b+"queueHooks";return W.get(a,c)||W.access(a,c,{empty:r.Callbacks("once memory").add(function(){W.remove(a,[b+"queue",c])})})}}),r.fn.extend({queue:function(a,b){var c=2;return"string"!=typeof a&&(b=a,a="fx",c--),arguments.length\x20\t\r\n\f]+)/i,la=/^$|\/(?:java|ecma)script/i,ma={option:[1,""],thead:[1,"","
"],col:[2,"","
"],tr:[2,"","
"],td:[3,"","
"],_default:[0,"",""]};ma.optgroup=ma.option,ma.tbody=ma.tfoot=ma.colgroup=ma.caption=ma.thead,ma.th=ma.td;function na(a,b){var c;return c="undefined"!=typeof a.getElementsByTagName?a.getElementsByTagName(b||"*"):"undefined"!=typeof a.querySelectorAll?a.querySelectorAll(b||"*"):[],void 0===b||b&&B(a,b)?r.merge([a],c):c}function oa(a,b){for(var c=0,d=a.length;c-1)e&&e.push(f);else if(j=r.contains(f.ownerDocument,f),g=na(l.appendChild(f),"script"),j&&oa(g),c){k=0;while(f=g[k++])la.test(f.type||"")&&c.push(f)}return l}!function(){var a=d.createDocumentFragment(),b=a.appendChild(d.createElement("div")),c=d.createElement("input");c.setAttribute("type","radio"),c.setAttribute("checked","checked"),c.setAttribute("name","t"),b.appendChild(c),o.checkClone=b.cloneNode(!0).cloneNode(!0).lastChild.checked,b.innerHTML="",o.noCloneChecked=!!b.cloneNode(!0).lastChild.defaultValue}();var ra=d.documentElement,sa=/^key/,ta=/^(?:mouse|pointer|contextmenu|drag|drop)|click/,ua=/^([^.]*)(?:\.(.+)|)/;function va(){return!0}function wa(){return!1}function xa(){try{return d.activeElement}catch(a){}}function ya(a,b,c,d,e,f){var g,h;if("object"==typeof b){"string"!=typeof c&&(d=d||c,c=void 0);for(h in b)ya(a,h,c,d,b[h],f);return a}if(null==d&&null==e?(e=c,d=c=void 0):null==e&&("string"==typeof c?(e=d,d=void 0):(e=d,d=c,c=void 0)),e===!1)e=wa;else if(!e)return a;return 1===f&&(g=e,e=function(a){return r().off(a),g.apply(this,arguments)},e.guid=g.guid||(g.guid=r.guid++)),a.each(function(){r.event.add(this,b,e,d,c)})}r.event={global:{},add:function(a,b,c,d,e){var f,g,h,i,j,k,l,m,n,o,p,q=W.get(a);if(q){c.handler&&(f=c,c=f.handler,e=f.selector),e&&r.find.matchesSelector(ra,e),c.guid||(c.guid=r.guid++),(i=q.events)||(i=q.events={}),(g=q.handle)||(g=q.handle=function(b){return"undefined"!=typeof r&&r.event.triggered!==b.type?r.event.dispatch.apply(a,arguments):void 0}),b=(b||"").match(L)||[""],j=b.length;while(j--)h=ua.exec(b[j])||[],n=p=h[1],o=(h[2]||"").split(".").sort(),n&&(l=r.event.special[n]||{},n=(e?l.delegateType:l.bindType)||n,l=r.event.special[n]||{},k=r.extend({type:n,origType:p,data:d,handler:c,guid:c.guid,selector:e,needsContext:e&&r.expr.match.needsContext.test(e),namespace:o.join(".")},f),(m=i[n])||(m=i[n]=[],m.delegateCount=0,l.setup&&l.setup.call(a,d,o,g)!==!1||a.addEventListener&&a.addEventListener(n,g)),l.add&&(l.add.call(a,k),k.handler.guid||(k.handler.guid=c.guid)),e?m.splice(m.delegateCount++,0,k):m.push(k),r.event.global[n]=!0)}},remove:function(a,b,c,d,e){var f,g,h,i,j,k,l,m,n,o,p,q=W.hasData(a)&&W.get(a);if(q&&(i=q.events)){b=(b||"").match(L)||[""],j=b.length;while(j--)if(h=ua.exec(b[j])||[],n=p=h[1],o=(h[2]||"").split(".").sort(),n){l=r.event.special[n]||{},n=(d?l.delegateType:l.bindType)||n,m=i[n]||[],h=h[2]&&new RegExp("(^|\\.)"+o.join("\\.(?:.*\\.|)")+"(\\.|$)"),g=f=m.length;while(f--)k=m[f],!e&&p!==k.origType||c&&c.guid!==k.guid||h&&!h.test(k.namespace)||d&&d!==k.selector&&("**"!==d||!k.selector)||(m.splice(f,1),k.selector&&m.delegateCount--,l.remove&&l.remove.call(a,k));g&&!m.length&&(l.teardown&&l.teardown.call(a,o,q.handle)!==!1||r.removeEvent(a,n,q.handle),delete i[n])}else for(n in i)r.event.remove(a,n+b[j],c,d,!0);r.isEmptyObject(i)&&W.remove(a,"handle events")}},dispatch:function(a){var b=r.event.fix(a),c,d,e,f,g,h,i=new Array(arguments.length),j=(W.get(this,"events")||{})[b.type]||[],k=r.event.special[b.type]||{};for(i[0]=b,c=1;c=1))for(;j!==this;j=j.parentNode||this)if(1===j.nodeType&&("click"!==a.type||j.disabled!==!0)){for(f=[],g={},c=0;c-1:r.find(e,this,null,[j]).length),g[e]&&f.push(d);f.length&&h.push({elem:j,handlers:f})}return j=this,i\x20\t\r\n\f]*)[^>]*)\/>/gi,Aa=/\s*$/g;function Ea(a,b){return B(a,"table")&&B(11!==b.nodeType?b:b.firstChild,"tr")?r(">tbody",a)[0]||a:a}function Fa(a){return a.type=(null!==a.getAttribute("type"))+"/"+a.type,a}function Ga(a){var b=Ca.exec(a.type);return b?a.type=b[1]:a.removeAttribute("type"),a}function Ha(a,b){var c,d,e,f,g,h,i,j;if(1===b.nodeType){if(W.hasData(a)&&(f=W.access(a),g=W.set(b,f),j=f.events)){delete g.handle,g.events={};for(e in j)for(c=0,d=j[e].length;c1&&"string"==typeof q&&!o.checkClone&&Ba.test(q))return a.each(function(e){var f=a.eq(e);s&&(b[0]=q.call(this,e,f.html())),Ja(f,b,c,d)});if(m&&(e=qa(b,a[0].ownerDocument,!1,a,d),f=e.firstChild,1===e.childNodes.length&&(e=f),f||d)){for(h=r.map(na(e,"script"),Fa),i=h.length;l")},clone:function(a,b,c){var d,e,f,g,h=a.cloneNode(!0),i=r.contains(a.ownerDocument,a);if(!(o.noCloneChecked||1!==a.nodeType&&11!==a.nodeType||r.isXMLDoc(a)))for(g=na(h),f=na(a),d=0,e=f.length;d0&&oa(g,!i&&na(a,"script")),h},cleanData:function(a){for(var b,c,d,e=r.event.special,f=0;void 0!==(c=a[f]);f++)if(U(c)){if(b=c[W.expando]){if(b.events)for(d in b.events)e[d]?r.event.remove(c,d):r.removeEvent(c,d,b.handle);c[W.expando]=void 0}c[X.expando]&&(c[X.expando]=void 0)}}}),r.fn.extend({detach:function(a){return Ka(this,a,!0)},remove:function(a){return Ka(this,a)},text:function(a){return T(this,function(a){return void 0===a?r.text(this):this.empty().each(function(){1!==this.nodeType&&11!==this.nodeType&&9!==this.nodeType||(this.textContent=a)})},null,a,arguments.length)},append:function(){return Ja(this,arguments,function(a){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var b=Ea(this,a);b.appendChild(a)}})},prepend:function(){return Ja(this,arguments,function(a){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var b=Ea(this,a);b.insertBefore(a,b.firstChild)}})},before:function(){return Ja(this,arguments,function(a){this.parentNode&&this.parentNode.insertBefore(a,this)})},after:function(){return Ja(this,arguments,function(a){this.parentNode&&this.parentNode.insertBefore(a,this.nextSibling)})},empty:function(){for(var a,b=0;null!=(a=this[b]);b++)1===a.nodeType&&(r.cleanData(na(a,!1)),a.textContent="");return this},clone:function(a,b){return a=null!=a&&a,b=null==b?a:b,this.map(function(){return r.clone(this,a,b)})},html:function(a){return T(this,function(a){var b=this[0]||{},c=0,d=this.length;if(void 0===a&&1===b.nodeType)return b.innerHTML;if("string"==typeof a&&!Aa.test(a)&&!ma[(ka.exec(a)||["",""])[1].toLowerCase()]){a=r.htmlPrefilter(a);try{for(;c1)}});function _a(a,b,c,d,e){return new _a.prototype.init(a,b,c,d,e)}r.Tween=_a,_a.prototype={constructor:_a,init:function(a,b,c,d,e,f){this.elem=a,this.prop=c,this.easing=e||r.easing._default,this.options=b,this.start=this.now=this.cur(),this.end=d,this.unit=f||(r.cssNumber[c]?"":"px")},cur:function(){var a=_a.propHooks[this.prop];return a&&a.get?a.get(this):_a.propHooks._default.get(this)},run:function(a){var b,c=_a.propHooks[this.prop];return this.options.duration?this.pos=b=r.easing[this.easing](a,this.options.duration*a,0,1,this.options.duration):this.pos=b=a,this.now=(this.end-this.start)*b+this.start,this.options.step&&this.options.step.call(this.elem,this.now,this),c&&c.set?c.set(this):_a.propHooks._default.set(this),this}},_a.prototype.init.prototype=_a.prototype,_a.propHooks={_default:{get:function(a){var b;return 1!==a.elem.nodeType||null!=a.elem[a.prop]&&null==a.elem.style[a.prop]?a.elem[a.prop]:(b=r.css(a.elem,a.prop,""),b&&"auto"!==b?b:0)},set:function(a){r.fx.step[a.prop]?r.fx.step[a.prop](a):1!==a.elem.nodeType||null==a.elem.style[r.cssProps[a.prop]]&&!r.cssHooks[a.prop]?a.elem[a.prop]=a.now:r.style(a.elem,a.prop,a.now+a.unit)}}},_a.propHooks.scrollTop=_a.propHooks.scrollLeft={set:function(a){a.elem.nodeType&&a.elem.parentNode&&(a.elem[a.prop]=a.now)}},r.easing={linear:function(a){return a},swing:function(a){return.5-Math.cos(a*Math.PI)/2},_default:"swing"},r.fx=_a.prototype.init,r.fx.step={};var ab,bb,cb=/^(?:toggle|show|hide)$/,db=/queueHooks$/;function eb(){bb&&(d.hidden===!1&&a.requestAnimationFrame?a.requestAnimationFrame(eb):a.setTimeout(eb,r.fx.interval),r.fx.tick())}function fb(){return a.setTimeout(function(){ab=void 0}),ab=r.now()}function gb(a,b){var c,d=0,e={height:a};for(b=b?1:0;d<4;d+=2-b)c=ca[d],e["margin"+c]=e["padding"+c]=a;return b&&(e.opacity=e.width=a),e}function hb(a,b,c){for(var d,e=(kb.tweeners[b]||[]).concat(kb.tweeners["*"]),f=0,g=e.length;f1)},removeAttr:function(a){return this.each(function(){r.removeAttr(this,a)})}}),r.extend({attr:function(a,b,c){var d,e,f=a.nodeType;if(3!==f&&8!==f&&2!==f)return"undefined"==typeof a.getAttribute?r.prop(a,b,c):(1===f&&r.isXMLDoc(a)||(e=r.attrHooks[b.toLowerCase()]||(r.expr.match.bool.test(b)?lb:void 0)),void 0!==c?null===c?void r.removeAttr(a,b):e&&"set"in e&&void 0!==(d=e.set(a,c,b))?d:(a.setAttribute(b,c+""),c):e&&"get"in e&&null!==(d=e.get(a,b))?d:(d=r.find.attr(a,b), +null==d?void 0:d))},attrHooks:{type:{set:function(a,b){if(!o.radioValue&&"radio"===b&&B(a,"input")){var c=a.value;return a.setAttribute("type",b),c&&(a.value=c),b}}}},removeAttr:function(a,b){var c,d=0,e=b&&b.match(L);if(e&&1===a.nodeType)while(c=e[d++])a.removeAttribute(c)}}),lb={set:function(a,b,c){return b===!1?r.removeAttr(a,c):a.setAttribute(c,c),c}},r.each(r.expr.match.bool.source.match(/\w+/g),function(a,b){var c=mb[b]||r.find.attr;mb[b]=function(a,b,d){var e,f,g=b.toLowerCase();return d||(f=mb[g],mb[g]=e,e=null!=c(a,b,d)?g:null,mb[g]=f),e}});var nb=/^(?:input|select|textarea|button)$/i,ob=/^(?:a|area)$/i;r.fn.extend({prop:function(a,b){return T(this,r.prop,a,b,arguments.length>1)},removeProp:function(a){return this.each(function(){delete this[r.propFix[a]||a]})}}),r.extend({prop:function(a,b,c){var d,e,f=a.nodeType;if(3!==f&&8!==f&&2!==f)return 1===f&&r.isXMLDoc(a)||(b=r.propFix[b]||b,e=r.propHooks[b]),void 0!==c?e&&"set"in e&&void 0!==(d=e.set(a,c,b))?d:a[b]=c:e&&"get"in e&&null!==(d=e.get(a,b))?d:a[b]},propHooks:{tabIndex:{get:function(a){var b=r.find.attr(a,"tabindex");return b?parseInt(b,10):nb.test(a.nodeName)||ob.test(a.nodeName)&&a.href?0:-1}}},propFix:{"for":"htmlFor","class":"className"}}),o.optSelected||(r.propHooks.selected={get:function(a){var b=a.parentNode;return b&&b.parentNode&&b.parentNode.selectedIndex,null},set:function(a){var b=a.parentNode;b&&(b.selectedIndex,b.parentNode&&b.parentNode.selectedIndex)}}),r.each(["tabIndex","readOnly","maxLength","cellSpacing","cellPadding","rowSpan","colSpan","useMap","frameBorder","contentEditable"],function(){r.propFix[this.toLowerCase()]=this});function pb(a){var b=a.match(L)||[];return b.join(" ")}function qb(a){return a.getAttribute&&a.getAttribute("class")||""}r.fn.extend({addClass:function(a){var b,c,d,e,f,g,h,i=0;if(r.isFunction(a))return this.each(function(b){r(this).addClass(a.call(this,b,qb(this)))});if("string"==typeof a&&a){b=a.match(L)||[];while(c=this[i++])if(e=qb(c),d=1===c.nodeType&&" "+pb(e)+" "){g=0;while(f=b[g++])d.indexOf(" "+f+" ")<0&&(d+=f+" ");h=pb(d),e!==h&&c.setAttribute("class",h)}}return this},removeClass:function(a){var b,c,d,e,f,g,h,i=0;if(r.isFunction(a))return this.each(function(b){r(this).removeClass(a.call(this,b,qb(this)))});if(!arguments.length)return this.attr("class","");if("string"==typeof a&&a){b=a.match(L)||[];while(c=this[i++])if(e=qb(c),d=1===c.nodeType&&" "+pb(e)+" "){g=0;while(f=b[g++])while(d.indexOf(" "+f+" ")>-1)d=d.replace(" "+f+" "," ");h=pb(d),e!==h&&c.setAttribute("class",h)}}return this},toggleClass:function(a,b){var c=typeof a;return"boolean"==typeof b&&"string"===c?b?this.addClass(a):this.removeClass(a):r.isFunction(a)?this.each(function(c){r(this).toggleClass(a.call(this,c,qb(this),b),b)}):this.each(function(){var b,d,e,f;if("string"===c){d=0,e=r(this),f=a.match(L)||[];while(b=f[d++])e.hasClass(b)?e.removeClass(b):e.addClass(b)}else void 0!==a&&"boolean"!==c||(b=qb(this),b&&W.set(this,"__className__",b),this.setAttribute&&this.setAttribute("class",b||a===!1?"":W.get(this,"__className__")||""))})},hasClass:function(a){var b,c,d=0;b=" "+a+" ";while(c=this[d++])if(1===c.nodeType&&(" "+pb(qb(c))+" ").indexOf(b)>-1)return!0;return!1}});var rb=/\r/g;r.fn.extend({val:function(a){var b,c,d,e=this[0];{if(arguments.length)return d=r.isFunction(a),this.each(function(c){var e;1===this.nodeType&&(e=d?a.call(this,c,r(this).val()):a,null==e?e="":"number"==typeof e?e+="":Array.isArray(e)&&(e=r.map(e,function(a){return null==a?"":a+""})),b=r.valHooks[this.type]||r.valHooks[this.nodeName.toLowerCase()],b&&"set"in b&&void 0!==b.set(this,e,"value")||(this.value=e))});if(e)return b=r.valHooks[e.type]||r.valHooks[e.nodeName.toLowerCase()],b&&"get"in b&&void 0!==(c=b.get(e,"value"))?c:(c=e.value,"string"==typeof c?c.replace(rb,""):null==c?"":c)}}}),r.extend({valHooks:{option:{get:function(a){var b=r.find.attr(a,"value");return null!=b?b:pb(r.text(a))}},select:{get:function(a){var b,c,d,e=a.options,f=a.selectedIndex,g="select-one"===a.type,h=g?null:[],i=g?f+1:e.length;for(d=f<0?i:g?f:0;d-1)&&(c=!0);return c||(a.selectedIndex=-1),f}}}}),r.each(["radio","checkbox"],function(){r.valHooks[this]={set:function(a,b){if(Array.isArray(b))return a.checked=r.inArray(r(a).val(),b)>-1}},o.checkOn||(r.valHooks[this].get=function(a){return null===a.getAttribute("value")?"on":a.value})});var sb=/^(?:focusinfocus|focusoutblur)$/;r.extend(r.event,{trigger:function(b,c,e,f){var g,h,i,j,k,m,n,o=[e||d],p=l.call(b,"type")?b.type:b,q=l.call(b,"namespace")?b.namespace.split("."):[];if(h=i=e=e||d,3!==e.nodeType&&8!==e.nodeType&&!sb.test(p+r.event.triggered)&&(p.indexOf(".")>-1&&(q=p.split("."),p=q.shift(),q.sort()),k=p.indexOf(":")<0&&"on"+p,b=b[r.expando]?b:new r.Event(p,"object"==typeof b&&b),b.isTrigger=f?2:3,b.namespace=q.join("."),b.rnamespace=b.namespace?new RegExp("(^|\\.)"+q.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,b.result=void 0,b.target||(b.target=e),c=null==c?[b]:r.makeArray(c,[b]),n=r.event.special[p]||{},f||!n.trigger||n.trigger.apply(e,c)!==!1)){if(!f&&!n.noBubble&&!r.isWindow(e)){for(j=n.delegateType||p,sb.test(j+p)||(h=h.parentNode);h;h=h.parentNode)o.push(h),i=h;i===(e.ownerDocument||d)&&o.push(i.defaultView||i.parentWindow||a)}g=0;while((h=o[g++])&&!b.isPropagationStopped())b.type=g>1?j:n.bindType||p,m=(W.get(h,"events")||{})[b.type]&&W.get(h,"handle"),m&&m.apply(h,c),m=k&&h[k],m&&m.apply&&U(h)&&(b.result=m.apply(h,c),b.result===!1&&b.preventDefault());return b.type=p,f||b.isDefaultPrevented()||n._default&&n._default.apply(o.pop(),c)!==!1||!U(e)||k&&r.isFunction(e[p])&&!r.isWindow(e)&&(i=e[k],i&&(e[k]=null),r.event.triggered=p,e[p](),r.event.triggered=void 0,i&&(e[k]=i)),b.result}},simulate:function(a,b,c){var d=r.extend(new r.Event,c,{type:a,isSimulated:!0});r.event.trigger(d,null,b)}}),r.fn.extend({trigger:function(a,b){return this.each(function(){r.event.trigger(a,b,this)})},triggerHandler:function(a,b){var c=this[0];if(c)return r.event.trigger(a,b,c,!0)}}),r.each("blur focus focusin focusout resize scroll click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup contextmenu".split(" "),function(a,b){r.fn[b]=function(a,c){return arguments.length>0?this.on(b,null,a,c):this.trigger(b)}}),r.fn.extend({hover:function(a,b){return this.mouseenter(a).mouseleave(b||a)}}),o.focusin="onfocusin"in a,o.focusin||r.each({focus:"focusin",blur:"focusout"},function(a,b){var c=function(a){r.event.simulate(b,a.target,r.event.fix(a))};r.event.special[b]={setup:function(){var d=this.ownerDocument||this,e=W.access(d,b);e||d.addEventListener(a,c,!0),W.access(d,b,(e||0)+1)},teardown:function(){var d=this.ownerDocument||this,e=W.access(d,b)-1;e?W.access(d,b,e):(d.removeEventListener(a,c,!0),W.remove(d,b))}}});var tb=a.location,ub=r.now(),vb=/\?/;r.parseXML=function(b){var c;if(!b||"string"!=typeof b)return null;try{c=(new a.DOMParser).parseFromString(b,"text/xml")}catch(d){c=void 0}return c&&!c.getElementsByTagName("parsererror").length||r.error("Invalid XML: "+b),c};var wb=/\[\]$/,xb=/\r?\n/g,yb=/^(?:submit|button|image|reset|file)$/i,zb=/^(?:input|select|textarea|keygen)/i;function Ab(a,b,c,d){var e;if(Array.isArray(b))r.each(b,function(b,e){c||wb.test(a)?d(a,e):Ab(a+"["+("object"==typeof e&&null!=e?b:"")+"]",e,c,d)});else if(c||"object"!==r.type(b))d(a,b);else for(e in b)Ab(a+"["+e+"]",b[e],c,d)}r.param=function(a,b){var c,d=[],e=function(a,b){var c=r.isFunction(b)?b():b;d[d.length]=encodeURIComponent(a)+"="+encodeURIComponent(null==c?"":c)};if(Array.isArray(a)||a.jquery&&!r.isPlainObject(a))r.each(a,function(){e(this.name,this.value)});else for(c in a)Ab(c,a[c],b,e);return d.join("&")},r.fn.extend({serialize:function(){return r.param(this.serializeArray())},serializeArray:function(){return this.map(function(){var a=r.prop(this,"elements");return a?r.makeArray(a):this}).filter(function(){var a=this.type;return this.name&&!r(this).is(":disabled")&&zb.test(this.nodeName)&&!yb.test(a)&&(this.checked||!ja.test(a))}).map(function(a,b){var c=r(this).val();return null==c?null:Array.isArray(c)?r.map(c,function(a){return{name:b.name,value:a.replace(xb,"\r\n")}}):{name:b.name,value:c.replace(xb,"\r\n")}}).get()}});var Bb=/%20/g,Cb=/#.*$/,Db=/([?&])_=[^&]*/,Eb=/^(.*?):[ \t]*([^\r\n]*)$/gm,Fb=/^(?:about|app|app-storage|.+-extension|file|res|widget):$/,Gb=/^(?:GET|HEAD)$/,Hb=/^\/\//,Ib={},Jb={},Kb="*/".concat("*"),Lb=d.createElement("a");Lb.href=tb.href;function Mb(a){return function(b,c){"string"!=typeof b&&(c=b,b="*");var d,e=0,f=b.toLowerCase().match(L)||[];if(r.isFunction(c))while(d=f[e++])"+"===d[0]?(d=d.slice(1)||"*",(a[d]=a[d]||[]).unshift(c)):(a[d]=a[d]||[]).push(c)}}function Nb(a,b,c,d){var e={},f=a===Jb;function g(h){var i;return e[h]=!0,r.each(a[h]||[],function(a,h){var j=h(b,c,d);return"string"!=typeof j||f||e[j]?f?!(i=j):void 0:(b.dataTypes.unshift(j),g(j),!1)}),i}return g(b.dataTypes[0])||!e["*"]&&g("*")}function Ob(a,b){var c,d,e=r.ajaxSettings.flatOptions||{};for(c in b)void 0!==b[c]&&((e[c]?a:d||(d={}))[c]=b[c]);return d&&r.extend(!0,a,d),a}function Pb(a,b,c){var d,e,f,g,h=a.contents,i=a.dataTypes;while("*"===i[0])i.shift(),void 0===d&&(d=a.mimeType||b.getResponseHeader("Content-Type"));if(d)for(e in h)if(h[e]&&h[e].test(d)){i.unshift(e);break}if(i[0]in c)f=i[0];else{for(e in c){if(!i[0]||a.converters[e+" "+i[0]]){f=e;break}g||(g=e)}f=f||g}if(f)return f!==i[0]&&i.unshift(f),c[f]}function Qb(a,b,c,d){var e,f,g,h,i,j={},k=a.dataTypes.slice();if(k[1])for(g in a.converters)j[g.toLowerCase()]=a.converters[g];f=k.shift();while(f)if(a.responseFields[f]&&(c[a.responseFields[f]]=b),!i&&d&&a.dataFilter&&(b=a.dataFilter(b,a.dataType)),i=f,f=k.shift())if("*"===f)f=i;else if("*"!==i&&i!==f){if(g=j[i+" "+f]||j["* "+f],!g)for(e in j)if(h=e.split(" "),h[1]===f&&(g=j[i+" "+h[0]]||j["* "+h[0]])){g===!0?g=j[e]:j[e]!==!0&&(f=h[0],k.unshift(h[1]));break}if(g!==!0)if(g&&a["throws"])b=g(b);else try{b=g(b)}catch(l){return{state:"parsererror",error:g?l:"No conversion from "+i+" to "+f}}}return{state:"success",data:b}}r.extend({active:0,lastModified:{},etag:{},ajaxSettings:{url:tb.href,type:"GET",isLocal:Fb.test(tb.protocol),global:!0,processData:!0,async:!0,contentType:"application/x-www-form-urlencoded; charset=UTF-8",accepts:{"*":Kb,text:"text/plain",html:"text/html",xml:"application/xml, text/xml",json:"application/json, text/javascript"},contents:{xml:/\bxml\b/,html:/\bhtml/,json:/\bjson\b/},responseFields:{xml:"responseXML",text:"responseText",json:"responseJSON"},converters:{"* text":String,"text html":!0,"text json":JSON.parse,"text xml":r.parseXML},flatOptions:{url:!0,context:!0}},ajaxSetup:function(a,b){return b?Ob(Ob(a,r.ajaxSettings),b):Ob(r.ajaxSettings,a)},ajaxPrefilter:Mb(Ib),ajaxTransport:Mb(Jb),ajax:function(b,c){"object"==typeof b&&(c=b,b=void 0),c=c||{};var e,f,g,h,i,j,k,l,m,n,o=r.ajaxSetup({},c),p=o.context||o,q=o.context&&(p.nodeType||p.jquery)?r(p):r.event,s=r.Deferred(),t=r.Callbacks("once memory"),u=o.statusCode||{},v={},w={},x="canceled",y={readyState:0,getResponseHeader:function(a){var b;if(k){if(!h){h={};while(b=Eb.exec(g))h[b[1].toLowerCase()]=b[2]}b=h[a.toLowerCase()]}return null==b?null:b},getAllResponseHeaders:function(){return k?g:null},setRequestHeader:function(a,b){return null==k&&(a=w[a.toLowerCase()]=w[a.toLowerCase()]||a,v[a]=b),this},overrideMimeType:function(a){return null==k&&(o.mimeType=a),this},statusCode:function(a){var b;if(a)if(k)y.always(a[y.status]);else for(b in a)u[b]=[u[b],a[b]];return this},abort:function(a){var b=a||x;return e&&e.abort(b),A(0,b),this}};if(s.promise(y),o.url=((b||o.url||tb.href)+"").replace(Hb,tb.protocol+"//"),o.type=c.method||c.type||o.method||o.type,o.dataTypes=(o.dataType||"*").toLowerCase().match(L)||[""],null==o.crossDomain){j=d.createElement("a");try{j.href=o.url,j.href=j.href,o.crossDomain=Lb.protocol+"//"+Lb.host!=j.protocol+"//"+j.host}catch(z){o.crossDomain=!0}}if(o.data&&o.processData&&"string"!=typeof o.data&&(o.data=r.param(o.data,o.traditional)),Nb(Ib,o,c,y),k)return y;l=r.event&&o.global,l&&0===r.active++&&r.event.trigger("ajaxStart"),o.type=o.type.toUpperCase(),o.hasContent=!Gb.test(o.type),f=o.url.replace(Cb,""),o.hasContent?o.data&&o.processData&&0===(o.contentType||"").indexOf("application/x-www-form-urlencoded")&&(o.data=o.data.replace(Bb,"+")):(n=o.url.slice(f.length),o.data&&(f+=(vb.test(f)?"&":"?")+o.data,delete o.data),o.cache===!1&&(f=f.replace(Db,"$1"),n=(vb.test(f)?"&":"?")+"_="+ub++ +n),o.url=f+n),o.ifModified&&(r.lastModified[f]&&y.setRequestHeader("If-Modified-Since",r.lastModified[f]),r.etag[f]&&y.setRequestHeader("If-None-Match",r.etag[f])),(o.data&&o.hasContent&&o.contentType!==!1||c.contentType)&&y.setRequestHeader("Content-Type",o.contentType),y.setRequestHeader("Accept",o.dataTypes[0]&&o.accepts[o.dataTypes[0]]?o.accepts[o.dataTypes[0]]+("*"!==o.dataTypes[0]?", "+Kb+"; q=0.01":""):o.accepts["*"]);for(m in o.headers)y.setRequestHeader(m,o.headers[m]);if(o.beforeSend&&(o.beforeSend.call(p,y,o)===!1||k))return y.abort();if(x="abort",t.add(o.complete),y.done(o.success),y.fail(o.error),e=Nb(Jb,o,c,y)){if(y.readyState=1,l&&q.trigger("ajaxSend",[y,o]),k)return y;o.async&&o.timeout>0&&(i=a.setTimeout(function(){y.abort("timeout")},o.timeout));try{k=!1,e.send(v,A)}catch(z){if(k)throw z;A(-1,z)}}else A(-1,"No Transport");function A(b,c,d,h){var j,m,n,v,w,x=c;k||(k=!0,i&&a.clearTimeout(i),e=void 0,g=h||"",y.readyState=b>0?4:0,j=b>=200&&b<300||304===b,d&&(v=Pb(o,y,d)),v=Qb(o,v,y,j),j?(o.ifModified&&(w=y.getResponseHeader("Last-Modified"),w&&(r.lastModified[f]=w),w=y.getResponseHeader("etag"),w&&(r.etag[f]=w)),204===b||"HEAD"===o.type?x="nocontent":304===b?x="notmodified":(x=v.state,m=v.data,n=v.error,j=!n)):(n=x,!b&&x||(x="error",b<0&&(b=0))),y.status=b,y.statusText=(c||x)+"",j?s.resolveWith(p,[m,x,y]):s.rejectWith(p,[y,x,n]),y.statusCode(u),u=void 0,l&&q.trigger(j?"ajaxSuccess":"ajaxError",[y,o,j?m:n]),t.fireWith(p,[y,x]),l&&(q.trigger("ajaxComplete",[y,o]),--r.active||r.event.trigger("ajaxStop")))}return y},getJSON:function(a,b,c){return r.get(a,b,c,"json")},getScript:function(a,b){return r.get(a,void 0,b,"script")}}),r.each(["get","post"],function(a,b){r[b]=function(a,c,d,e){return r.isFunction(c)&&(e=e||d,d=c,c=void 0),r.ajax(r.extend({url:a,type:b,dataType:e,data:c,success:d},r.isPlainObject(a)&&a))}}),r._evalUrl=function(a){return r.ajax({url:a,type:"GET",dataType:"script",cache:!0,async:!1,global:!1,"throws":!0})},r.fn.extend({wrapAll:function(a){var b;return this[0]&&(r.isFunction(a)&&(a=a.call(this[0])),b=r(a,this[0].ownerDocument).eq(0).clone(!0),this[0].parentNode&&b.insertBefore(this[0]),b.map(function(){var a=this;while(a.firstElementChild)a=a.firstElementChild;return a}).append(this)),this},wrapInner:function(a){return r.isFunction(a)?this.each(function(b){r(this).wrapInner(a.call(this,b))}):this.each(function(){var b=r(this),c=b.contents();c.length?c.wrapAll(a):b.append(a)})},wrap:function(a){var b=r.isFunction(a);return this.each(function(c){r(this).wrapAll(b?a.call(this,c):a)})},unwrap:function(a){return this.parent(a).not("body").each(function(){r(this).replaceWith(this.childNodes)}),this}}),r.expr.pseudos.hidden=function(a){return!r.expr.pseudos.visible(a)},r.expr.pseudos.visible=function(a){return!!(a.offsetWidth||a.offsetHeight||a.getClientRects().length)},r.ajaxSettings.xhr=function(){try{return new a.XMLHttpRequest}catch(b){}};var Rb={0:200,1223:204},Sb=r.ajaxSettings.xhr();o.cors=!!Sb&&"withCredentials"in Sb,o.ajax=Sb=!!Sb,r.ajaxTransport(function(b){var c,d;if(o.cors||Sb&&!b.crossDomain)return{send:function(e,f){var g,h=b.xhr();if(h.open(b.type,b.url,b.async,b.username,b.password),b.xhrFields)for(g in b.xhrFields)h[g]=b.xhrFields[g];b.mimeType&&h.overrideMimeType&&h.overrideMimeType(b.mimeType),b.crossDomain||e["X-Requested-With"]||(e["X-Requested-With"]="XMLHttpRequest");for(g in e)h.setRequestHeader(g,e[g]);c=function(a){return function(){c&&(c=d=h.onload=h.onerror=h.onabort=h.onreadystatechange=null,"abort"===a?h.abort():"error"===a?"number"!=typeof h.status?f(0,"error"):f(h.status,h.statusText):f(Rb[h.status]||h.status,h.statusText,"text"!==(h.responseType||"text")||"string"!=typeof h.responseText?{binary:h.response}:{text:h.responseText},h.getAllResponseHeaders()))}},h.onload=c(),d=h.onerror=c("error"),void 0!==h.onabort?h.onabort=d:h.onreadystatechange=function(){4===h.readyState&&a.setTimeout(function(){c&&d()})},c=c("abort");try{h.send(b.hasContent&&b.data||null)}catch(i){if(c)throw i}},abort:function(){c&&c()}}}),r.ajaxPrefilter(function(a){a.crossDomain&&(a.contents.script=!1)}),r.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/\b(?:java|ecma)script\b/},converters:{"text script":function(a){return r.globalEval(a),a}}}),r.ajaxPrefilter("script",function(a){void 0===a.cache&&(a.cache=!1),a.crossDomain&&(a.type="GET")}),r.ajaxTransport("script",function(a){if(a.crossDomain){var b,c;return{send:function(e,f){b=r(" +{% endif %} + diff --git a/template/partial/sexual_assault.html b/template/partial/sexual_assault.html new file mode 100644 index 0000000..27a23bf --- /dev/null +++ b/template/partial/sexual_assault.html @@ -0,0 +1,6 @@ +

Even though the laws vary between countries, Peace Corps recognizes that sexual assault takes many forms. These include rape, attempted rape, and unwanted sexual contact, such as grabbing, fondling, or forced kissing.

+

The legal definition of sexual assault differs among Peace Corps countries. However, Peace Corps asks these questions to help the agency classify crimes of a sexual nature

+

Sexual Assault:Was there unwanted kissing on the mouth or touching of the Volunteer's genitalia, anus, groin, breast, inner thigh or buttocks? Were any of these acts attempted?

+

Aggravated Sexual Assault:Was there contact with the Volunteer’s genitalia, anus, groin, breast, inner thigh, or buttocks, or disrobing, or kissing AND any of the following: use of or threat of use of a weapon; or the use or threat of use of force or intimidation; or the Volunteer was incapable of giving consent? Were any of these acts attempted?

+

Rape: +Was the vagina, anus or mouth penetrated against the will of the Volunteer? Was the Volunteer forced to perform oral sex on another person or penetrate another person against his/her will?

diff --git a/template/partial/sexual_assault_more.html b/template/partial/sexual_assault_more.html new file mode 100644 index 0000000..e13d306 --- /dev/null +++ b/template/partial/sexual_assault_more.html @@ -0,0 +1,10 @@ +

+

If it is not consensual, then it is a crime. Consensual means that both people are old enough to consent, have the capacity to consent, and agreed to the sexual contact. There are two main considerations to help Volunteers judge whether or not a sexual act is consensual.

+
    +
  1. Did both people have the physical, mental, and legal capacity to consent? Those with diminished capacity – for example, some people with disabilities, some elderly people and people who have been drugged or are unconscious – may not have the ability to consent to have sex.
  2. +
  3. Did both participants agree to take part? Did someone use physical force to make you have sexual contact with him/her? Has someone threatened you or coerced you to make you have intercourse with them? If so, it is sexual assault.
  4. +
+

If someone does not have the capacity to consent because they are too scared to say no, drunk or otherwise incapacitated, or one person does not want sexual contact, then it is sexual assault. This applies to rape or sexual assault of a Volunteer or Trainee by another Volunteer or Trainee. If a Volunteer is drunk or otherwise incapacitated then it is not consensual sex. + If you are not sure if you were sexually assaulted, or even if something made you uncomfortable, don’t be afraid to discuss the incident with your PCMO or someone else you trust for support. + Even if weeks, months, or years have passed, it is never too late to report an incident of sexual assault so you can receive support to aid your healing and recovery.

+

diff --git a/template/partial/sexual_harassment.html b/template/partial/sexual_harassment.html new file mode 100644 index 0000000..416b2c9 --- /dev/null +++ b/template/partial/sexual_harassment.html @@ -0,0 +1,5 @@ +

The Peace Corps is committed to maintaining high standards of conduct in the workplace and providing all employees, Volunteers, and trainees a work environment that is free from harassment of any kind. The Office of Civil Rights and Diversity, or OCRD, handles claims of harassment, including sexual harassment of a Volunteer or Trainee by a Peace Corps staff member or fellow Volunteer/ Trainee.

+

Sexual Harassment: Unwelcome sexual advances, requests for sexual favors, and other verbal or physical conduct of a sexual nature. Sexual harassment is behavior that is unwelcome, offensive, can cause fear or anxiety and can impact job performance.

+

The actions you may think are within tolerable ranges of acceptability may be offensive to others. People have different thresholds of tolerance for many of these behaviors. The bottom line is that ‘unwelcomed’ is determined by the recipient, not the person displaying the offensive conduct.

+

If you feel you are being sexually harassed, sharing this with either a Volunteer or staff will better ensure that you get the help and support you deserve.

+

Cases of sexual harassment committed by a PCV or Peace Corps Staff member against a PCV can be reported to the Office of Civil Rights and Diversity (OCRD)

diff --git a/template/partial/sexual_predators_1.html b/template/partial/sexual_predators_1.html new file mode 100644 index 0000000..0971e59 --- /dev/null +++ b/template/partial/sexual_predators_1.html @@ -0,0 +1 @@ +While cultural misunderstandings can contribute to increased risk, most sexual assaults are not the result of cross-cultural misinterpretations. They are the result of deliberate planning by the sexual predator. Ultimately, sexual assault is a crime of motive and opportunity. While you can never completely protect yourself from sexual assault, there are some things you can do to help reduce your risk of being assaulted. \ No newline at end of file diff --git a/template/partial/sexual_predators_2.html b/template/partial/sexual_predators_2.html new file mode 100644 index 0000000..10d130b --- /dev/null +++ b/template/partial/sexual_predators_2.html @@ -0,0 +1,8 @@ +Characteristics of assaults: +
    +
  • Sexual predators often plan sexual assaults. +

    Sexual assault is not an accident. Sexual predators know what they want to do, even if they have not already identified a specific target. Most of them have a plan in mind for how they will select and control someone, or they will seek out an area where a potential victim might be isolated and unable to get help. When we say planned to some extent it may not mean days or weeks in advance but also planned in the particular moment.

  • +
  • Sexual predators often watch for vulnerabilities and opportunities. +

    Sexual predators look for cues to indicate they can dominate and control a potential victim. They look for signs indicating that someone would be unlikely or unable to resist. For instance, people who are unaware of their surroundings, alone or lost; someone who is intoxicated or in some way incapacitated.

  • +
  • Sexual predators often test the boundaries of potential victims. +

    Testing boundaries may involve inappropriate comments, unwanted touching or invading personal space. It is a way of measuring the amount of resistance a potential victim might offer. A person who offers little or no resistance to these advances might be seen as a suitable target.

  • \ No newline at end of file diff --git a/template/partial/sexual_predators_3.html b/template/partial/sexual_predators_3.html new file mode 100644 index 0000000..db11e8f --- /dev/null +++ b/template/partial/sexual_predators_3.html @@ -0,0 +1,16 @@ +Both in Peace Corps and worldwide, the majority of sexual assault have these similarities: +
      +
    • Predators know the victim.
    • +
    • Occur when the victim is isolated.
    • +
    • Occur at night.
    • +
    + +Tactics used by sexual predators: +
      +
    • Attempt to isolate their potential victim. They may target someone who is already alone. For example, walking alone, or they may try to get their target alone by offering a ride in their car.
    • +
    • Persuasion and confidence. This is the “Smooth Talker” who puts you at ease. They make you feel comfortable and relaxed so you are not aware of their true intent. They may try to persuade you to do something you feel uncomfortable about. They might promise that they won’t try anything with you or reassure you by saying “You can trust me.”
    • +
    • Pressure and guilt. Sexual predators may try to coerce you by pressuring you to go farther in a relationship than you are ready or willing to go. They may try to make you feel guilty if you do not give in to their advances. They might say “You are offending me culturally” or something similar to make Volunteers feel guilty.
    • +
    • Threats and intimidation. Sometimes the sexual predator threatens to physically harm the Volunteer or someone they care about. They might also threaten to blackmail the Volunteer unless they comply.
    • +
    • Force and violence. Force and Violence involves a direct physical attack to overpower a Volunteer. It is what we frequently see on TV and in movies…like when the assailant jumps out of the bushes with a knife and attacks an unsuspecting jogger.
    • +
    • Drugs, including alcohol.
    • +
    \ No newline at end of file diff --git a/template/partial/unwanted_attention_1.html b/template/partial/unwanted_attention_1.html new file mode 100644 index 0000000..7bf666f --- /dev/null +++ b/template/partial/unwanted_attention_1.html @@ -0,0 +1,3 @@ +

    All PCVs will deal with some type of unwanted attention at some point in their service. This occurs across all cultures. The reaction someone has in response is highly personal and depends on the type of unwanted attention. Reactions may range from a slight feeling of discomfort to anger to fearing for one’s safety. You do not have to “be nice” if you feel unsafe or even uncomfortable. Peace Corps staff are here to help and have been trained on how to help PCVs cope. It’s important to report unwanted attention that is severe in nature so you can get the help and support you deserve.

    + +

    There’s a difference between unwanted attention and stalking. Stalking and cyber-stalking are defined as repeated threatening behavior from a single person that causes a Volunteer to fear for his or her safety or suffer substantial emotional distress. Unwanted physical contact, such as grabbing or touching, is considered assault, not unwanted attention.

    \ No newline at end of file diff --git a/template/partial/unwanted_attention_2.html b/template/partial/unwanted_attention_2.html new file mode 100644 index 0000000..b48e7f3 --- /dev/null +++ b/template/partial/unwanted_attention_2.html @@ -0,0 +1,13 @@ +Coping with Unwanted Attention Strategies +
      +
    • Walk purposefully. Always walk with confidence and purpose.
    • +
    • Look assertive. Hold your head high, shoulders back and present yourself as a professional demanding respect.
    • +
    • Nod (to acknowledge) and keep on walking. Simply recognizing the person can help ward off unwanted attention. Many times an inappropriate comment is an effort to get attention.
    • +
    • Dress appropriately. Keep in mind what is culturally appropriate.
    • +
    • Greetings. Sometimes a polite “Good Morning” can thwart a potential unwanted comment, but at other times it can escalate the situation. If this strategy does not work, try a different one.
    • +
    • Pretend that you heard something else. “I agree, it HAS been really great weather recently. Have a nice day, bye!”
    • +
    • Humor. Use humor to lighten the moment and solicit another response. For example, if you are told that you would make a good lover, reply that your spouse is sure to agree! Keep walking. This may not work with a persistent individual, so please keep trying different strategies when needed.
    • +
    • Be polite but firm. It is quite normal to stand your ground. “I am offended by your comment; please do not address me in that manner.”
    • +
    • Maintain your composure. Try to remain calm even if you feel upset. The converse is also true; try not to show hostility as this may provoke a confrontation. It is best to remove yourself from a situation if you feel that you are losing control.
    • +
    • Never say “next time.” Make no promises for another time, because you can be sure that the next time they see you, they will remind you of that promise.
    • +
    \ No newline at end of file diff --git a/tests/jsTests/circleOfTrustsSpec.js b/tests/jsTests/circleOfTrustsSpec.js new file mode 100644 index 0000000..5d63d65 --- /dev/null +++ b/tests/jsTests/circleOfTrustsSpec.js @@ -0,0 +1,248 @@ +/** + * Suite : Tests for success response modal + * Description : This is a test suite for checking for a modal (a prompt) + * when the response is a success + */ +describe("Tests for success response modal", function() { + var msg = 'This is a test message when the response is a success'; + beforeEach(function() { + jasmine.clock().install(); + setFixtures('
    \ +
    \ + '); + $('.ui.modal').hide(); + + // mock modal show call + spyOn($.fn, "modal").and.returnValue($('.ui.modal').show()); + showResponseModal({ response: true, message: msg }, false); + + // creating delay of 400ms + jasmine.clock().tick(4000); + }); + + afterEach(function() { + jasmine.clock().uninstall(); + }); + + it("should be visible", function() { + expect($('.content')).toContainText(msg); + expect($('.ui.modal')).toBeVisible(); + }); +}); + +/** + * Suite : Tests for failed response modal + * Description : This is a test suite for a failed response modal + * in case of a failure + */ +describe("Tests for failed response modal", function() { + var msg = 'This is a test message for a failed response modal'; + beforeEach(function() { + jasmine.clock().install(); + setFixtures('
    \ + '); + $('.ui.modal').hide(); + + // mock modal show call + spyOn($.fn, "modal").and.returnValue($('.ui.modal').show()); + showResponseModal({ response: false, message: msg }, false); + + // creating delay of 400ms + jasmine.clock().tick(4000); + }); + + afterEach(function() { + jasmine.clock().uninstall(); + }); + + it("should be visible", function() { + expect($('.content')).toContainText(msg); + expect($('.header')).toContainText('Are you lost?'); + expect($('.ui.modal')).toBeVisible(); + }); +}); + +/** + * Suite : Tests for undefined response + * Description : This is a test suite for a undefined response + * in case of a failure + */ +describe("Tests for undefined response", function() { + var msg = 'This is a test message for a failed response modal'; + beforeEach(function() { + jasmine.clock().install(); + setFixtures('
    \ + '); + $('.ui.modal').hide(); + + showResponseModal(); + jasmine.clock().tick(4000); + }); + + afterEach(function() { + jasmine.clock().uninstall(); + }); + + it("should be visible", function() { + expect($('.ui.modal')).toBeHidden(); + }); +}); + +/** + * Suite : Tests to place circle of trust icons in circle + * Description : This is a test suite for checking if all the icons in the circle of trust are placed in a circle + */ +describe("Tests to place circle of trust icons in circle", function() { + beforeEach(function() { + jasmine.clock().install(); + setFixtures('
    \ +
      \ +
    • first
    • \ +
    • second
    • \ +
    • third
    • \ +
    • fourth
    • \ +
    • fifth
    • \ +
    • sixth
    • \ +
    • seventh
    • \ +
    \ +
    '); + placeCircleOfTrustIcons(); + // creating delay of 400ms + jasmine.clock().tick(4000); + }); + + it("should transform elements", function() { + expect($('.circle li')[1].style.webkitTransform).toBe('rotate(-90deg) translate(200%) rotate(90deg)'); + expect($('.circle li')[2].style.webkitTransform).toBe('rotate(-30deg) translate(200%) rotate(30deg)'); + expect($('.circle li')[3].style.webkitTransform).toBe('rotate(30deg) translate(200%) rotate(-30deg)'); + expect($('.circle li')[4].style.webkitTransform).toBe('rotate(90deg) translate(200%) rotate(-90deg)'); + expect($('.circle li')[5].style.webkitTransform).toBe('rotate(150deg) translate(200%) rotate(-150deg)'); + expect($('.circle li')[6].style.webkitTransform).toBe('rotate(210deg) translate(200%) rotate(-210deg)'); + }); + + afterEach(function() { + jasmine.clock().uninstall(); + }); +}); + +/** + * Suite : Tests to show circle of trust icons + * Description : This is a validating if all the icons of circle of trust are placed in a circle + */ +describe("Tests to show circle of trust icons", function() { + var msg = 'This is a test message for showing error'; + beforeEach(function() { + jasmine.clock().install(); + setFixtures('
    \ +
    \ +
    \ +
    \ +
    '); + spyOn($.fn, "fadeOut").and.callFake(function() { + $(this).hide(); + }); + spyOn($.fn, "fadeIn").and.callFake(function() { + $(this).show(); + }); + toggleCircleOfTrustSections('back'); + jasmine.clock().tick(4000); + }); + + it("back button clicked", function() { + expect($('.circle-of-trust-page .edit-comrades-section')).toBeHidden(); + expect($('.circle-of-trust-page .comrade-action-section')).toBeHidden(); + expect($('.circle-of-trust-page .circle-of-trust')).toBeVisible(); + }); + + afterEach(function() { + jasmine.clock().uninstall(); + }); +}); + +/** + * Suite : Tests for showing error on incorrect field entry + * Description : This is a test suite for showing error in case of an invalid field entry + */ +describe("Tests to show edit circle of trust section", function() { + var msg = 'This is a test message for showing error'; + beforeEach(function() { + jasmine.clock().install(); + setFixtures('
    \ +
    \ +
    \ +
    \ +
    '); + spyOn($.fn, "fadeOut").and.callFake(function() { + $(this).hide(); + }); + spyOn($.fn, "fadeIn").and.callFake(function() { + $(this).show(); + }); + toggleCircleOfTrustSections('edit'); + // creating delay of 400ms + jasmine.clock().tick(4000); + }); + + it("edit button clicked", function() { + expect($('.circle-of-trust-page .edit-comrades-section')).toBeVisible(); + expect($('.circle-of-trust-page .comrade-action-section')).toBeHidden(); + expect($('.circle-of-trust-page .circle-of-trust')).toBeHidden(); + }); + + afterEach(function() { + jasmine.clock().uninstall(); + }); +}); + +/** + * Suite : Tests for showing error on incorrect field entry + * Description : This is a test suite for showing error in case of an invalid field entry + */ +describe("Tests to show get help section", function() { + var msg = 'This is a test message for showing error'; + beforeEach(function() { + jasmine.clock().install(); + setFixtures('
    \ +
    \ +
    \ +
    \ +
    '); + spyOn($.fn, "fadeOut").and.callFake(function() { + $(this).hide(); + }); + spyOn($.fn, "fadeIn").and.callFake(function() { + $(this).show(); + }); + toggleCircleOfTrustSections('help'); + // creating delay of 400ms + jasmine.clock().tick(4000); + }); + + it("get help button clicked and update comrades detail section made visible", function() { + expect($('.circle-of-trust-page .edit-comrades-section')).toBeHidden(); + expect($('.circle-of-trust-page .comrade-action-section')).toBeVisible(); + expect($('.circle-of-trust-page .circle-of-trust')).toBeHidden(); + }); + + afterEach(function() { + jasmine.clock().uninstall(); + }); +}); diff --git a/tests/jsTests/errorSpec.js b/tests/jsTests/errorSpec.js new file mode 100644 index 0000000..b89fff6 --- /dev/null +++ b/tests/jsTests/errorSpec.js @@ -0,0 +1,38 @@ +/** + * Suite : Tests for showing error on incorrect field entry + * Description : This is a test suite for showing error in case of an invalid field entry + */ +describe("Tests for showing error on incorrect field entry", function() { + var msg = 'This is a test message for showing error'; + beforeEach(function() { + setFixtures('
    \ +
    \ +
    '); + showError($('.field'), msg); + }); + + it("should be visible", function() { + expect($('.field')).toHaveClass('error'); + expect($('.ui.red.pointing')).toContainText(msg); + expect($('.ui.red.pointing')).toBeVisible(); + }); +}); + +/** + * Suite : Tests for hiding error on correct field entry + * Description : This is a test suite for hiding error in case of an valid field entry + */ +describe("Tests for hiding error on correct field entry", function() { + var msg = 'This is a test message for not showing error'; + beforeEach(function() { + setFixtures('
    \ +
    ' + msg + '
    \ +
    '); + hideError($('.field')); + }); + + it("should be visible", function() { + expect($('.field')).not.toHaveClass('error'); + expect($('.ui.red.pointing')).toBeHidden(); + }); +}); diff --git a/tests/jsTests/getHelpNowSpec.js b/tests/jsTests/getHelpNowSpec.js new file mode 100644 index 0000000..efc6b7e --- /dev/null +++ b/tests/jsTests/getHelpNowSpec.js @@ -0,0 +1,67 @@ +/** + * Suite : Tests for show get help action section + * Description : This is a test suite for checking if the get-help-action section (call/sms) is visible + */ +describe("Tests for show get help action section", function() { + beforeEach(function() { + jasmine.clock().install(); + setFixtures('
    \ +
    '); + spyOn($.fn, "fadeOut").and.callFake(function() { + $(this).hide(); + }); + spyOn($.fn, "fadeIn").and.callFake(function() { + $(this).show(); + }); + showGetHelpActionSection(); + // creating delay of 400ms + jasmine.clock().tick(4000); + }); + + it("should display get-help-action-section and hide other sections", function() { + expect($('#get-help-section')).toBeHidden(); + expect($('#get-help-action-section')).toBeVisible(); + }); + + afterEach(function() { + jasmine.clock().uninstall(); + }); +}); + +/** + * Suite : Tests for hide get help action section + * Description : This is a test suite for checking if the get-help-section is visible + */ +describe("Tests for hide get help action section", function() { + beforeEach(function() { + jasmine.clock().install(); + setFixtures('
    \ +
    \ +
    \ +
    \ +
    \ +
    \ +
    \ +
    '); + spyOn($.fn, "fadeOut").and.callFake(function() { + $(this).hide(); + }); + spyOn($.fn, "fadeIn").and.callFake(function() { + $(this).show(); + }); + hideGetHelpActionSection(); + // creating delay of 400ms + jasmine.clock().tick(4000); + }); + + it("should display get-help-section and hide other sections", function() { + expect($('#get-help-section')).toBeVisible(); + expect($('#get-help-action-section')).toBeHidden(); + expect($('#content-container')).toHaveClass('hide') + expect($('#content-container > div > div')).toHaveClass('hide') + }); + + afterEach(function() { + jasmine.clock().uninstall(); + }); +}); \ No newline at end of file diff --git a/tests/jsTests/indexSpec.js b/tests/jsTests/indexSpec.js new file mode 100644 index 0000000..880a0bd --- /dev/null +++ b/tests/jsTests/indexSpec.js @@ -0,0 +1,254 @@ +/** + * Suite : Tests for not empty field + * Description : This is a test suite for checking when field is not empty + */ +describe("Tests for not empty field", function() { + var msg = 'This is a test message when field is not empty', + isNotEmpty = false; + beforeEach(function() { + setFixtures('
    \ + \ + \ +
    \ +
    '); + isNotEmpty = notEmpty({ element: $('#name'), text: msg}); + }); + + it("should be visible", function() { + expect($('.field')).not.toHaveClass('error'); + expect($('.ui.red.pointing')).toBeHidden(); + expect(isNotEmpty).toBeTruthy(); + }); +}); + +/** + * Suite : Tests for empty field + * Description : This is a test suite for checking when feild is empty + */ +describe("Tests for empty field", function() { + var msg = 'This is a test message when input field is empty', + isNotEmpty = false; + beforeEach(function() { + setFixtures('
    \ + \ + \ +
    \ +
    '); + isNotEmpty = notEmpty({ element: $('#name'), text: msg}); + }); + + it("should be visible", function() { + expect($('.field')).toHaveClass('error'); + expect($('.ui.red.pointing')).toContainText(msg); + expect($('.ui.red.pointing')).toBeVisible(); + expect(isNotEmpty).not.toBeTruthy(); + }); +}); + +/** + * Suite : Tests for success response modal + * Description : This is a test suite for checking when the response is a success + */ + +describe("Tests for success response modal", function() { + var msg = 'This is a test message when the response is a success'; + beforeEach(function() { + jasmine.clock().install(); + setFixtures('
    \ +
    \ + '); + $('.ui.modal').hide(); + + // mock modal show call + spyOn($.fn, "modal").and.returnValue($('.ui.modal').show()); + showResponse($('element'), { response: true, message: msg }); + jasmine.clock().tick(4000); + }); + + afterEach(function() { + jasmine.clock().uninstall(); + }); + + it("should be visible", function() { + expect($('.content')).toContainText(msg); + expect($('.ui.modal')).toBeVisible(); + }); +}); + +/** + * Suite : Tests for failed response modal + * Description : This is a test suite for a failed response modal + */ +describe("Tests for failed response modal", function() { + var msg = 'This is a test message for a failed response modal'; + beforeEach(function() { + jasmine.clock().install(); + setFixtures('
    \ + '); + $('.ui.modal').hide(); + + // mock modal show call + spyOn($.fn, "modal").and.returnValue($('.ui.modal').show()); + showResponse($('element'), { response: false, message: msg }); + jasmine.clock().tick(4000); + }); + + afterEach(function() { + jasmine.clock().uninstall(); + }); + + it("should be visible", function() { + expect($('.content')).toContainText(msg); + expect($('.header')).toContainText('Are you lost?'); + expect($('.ui.modal')).toBeVisible(); + }); +}); + +/** + * Suite : Tests for password score + * Description : This is a test suite for checking password score + */ +describe("Tests for password score", function() { + it("should be visible", function() { + var passwords = { + 0: { + 'text': 'psswd', + 'errorCount': 4, + 'score': 0 + }, + 1: { + 'text': 'password', + 'errorCount': 3, + 'score': 2 + }, + 2: { + 'text': 'Password', + 'errorCount': 2, + 'score': 3 + }, + 3: { + 'text': 'password1', + 'errorCount': 2, + 'score': 3 + }, + 4: { + 'text': 'password#', + 'errorCount': 2, + 'score': 3 + }, + 5: { + 'text': 'Password1', + 'errorCount': 1, + 'score': 4 + }, + 6: { + 'text': 'Password#', + 'errorCount': 1, + 'score': 4 + }, + 7: { + 'text': 'Password#1', + 'errorCount': 0, + 'score': 5 + }, + 8: { + 'text': 'Password3#', + 'errorCount': 0, + 'score': 5 + } + } + for (var key in passwords) { + if (passwords.hasOwnProperty(key)) { + var s = passwordScore(passwords[key]['text']); + expect(s['score']).toBe(passwords[key]['score']); + expect(s['error'].length).toBe(passwords[key]['errorCount']); + } + } + }); +}); + +/** + * Suite : Tests for password field + * Description : Unit test to verify password with varying character limits to analyze strength progress bar percentage based on score + */ +describe("Tests for password field", function() { + beforeEach(function() { + setFixtures('
    \ + \ + \ +
    \ +
    \ +
    \ +
    \ +
    '); + + spyOn($.fn, "progress").and.callFake(function() { + $('#password-strength-status').data('percent',arguments[0]['percent']); + }); + }); + + it("should be visible", function() { + + var passwords = { + 0: { + 'text': 'psswd', + 'percent': 25 + }, + 1: { + 'text': 'password', + 'percent': 45 + }, + 2: { + 'text': 'Password', + 'percent': 75 + }, + 3: { + 'text': 'password1', + 'percent': 75 + }, + 4: { + 'text': 'password#', + 'percent': 75 + }, + 5: { + 'text': 'Password1', + 'percent': 95 + }, + 6: { + 'text': 'Password#', + 'percent': 95 + }, + 7: { + 'text': 'Password#1', + 'percent': 95 + }, + 8: { + 'text': 'Password3#', + 'percent': 95 + } + } + for (var k in passwords) { + $('.field.password-strength').hide(); + if (passwords.hasOwnProperty(k)) { + $('#password').val(passwords[k]['text']); + + expect($('.field.password-strength')).toBeHidden(); + passwordFieldKeyUp($('#password')); + expect($('.field.password-strength')).toBeVisible(); + expect($('#password-strength-status').data('percent')).toBe(passwords[k]['percent']); + } + } + }); +}); diff --git a/tests/jsTests/menuSpec.js b/tests/jsTests/menuSpec.js new file mode 100644 index 0000000..0d583c5 --- /dev/null +++ b/tests/jsTests/menuSpec.js @@ -0,0 +1,80 @@ +/** + * Suite : Tests for showing and hiding of menu + * Description : This is a test suite for showing and hiding menu for smaller screens. + */ +describe("Tests for show and hide menu", function() { + beforeEach(function() { + setFixtures(' \ +
    \ + \ +
    \ +
    \ + '); + }); + + it("should have visible class", function() { + showMenu(); + expect($('.ui.vertical.sidebar')).toHaveClass('overlay'); + expect($('.ui.vertical.sidebar')).toHaveClass('visible'); + }); + + it("should not have visible class", function() { + hideMenu(); + expect($('.ui.vertical.sidebar')).not.toHaveClass('overlay'); + expect($('.ui.vertical.sidebar')).not.toHaveClass('visible'); + }); +}); + +/** + * Suite : Tests for showing sub menu items + * Description : This is a test suite for showing sub menu items inside menu. + */ +describe("Tests to show sub menu", function() { + beforeEach(function() { + setFixtures(''); + $('.menu').hide(); + toggleSubMenuVisibility($('.menu')); + }); + + it("should show sub menu", function() { + expect($('.menu')).not.toBeHidden(); + }); +}); + +/** + * Suite : Tests for hiding sub menu items + * Description : This is a test suite for hiding sub menu items inside menu. + */ +describe("Tests to hide sub menu", function() { + beforeEach(function() { + jasmine.clock().install(); + setFixtures(''); + + + // mock slideUp function + spyOn($.fn, "slideUp").and.callFake(function(arguments) { + $('.menu').hide(); + }); + $('.menu').show(); + toggleSubMenuVisibility($('.menu')); + jasmine.clock().tick(4000); + }); + + it("should show sub menu", function() { + expect($('.menu')).toBeHidden(); + }); + + afterEach(function() { + jasmine.clock().uninstall(); + }); +}); diff --git a/tests/jsTests/multiSegmentSpec.js b/tests/jsTests/multiSegmentSpec.js new file mode 100644 index 0000000..5d5e018 --- /dev/null +++ b/tests/jsTests/multiSegmentSpec.js @@ -0,0 +1,67 @@ +/** + * Suite : Tests for showing next segment + * Description : This is a test suite for testing if the next segment of the page + * with different cards is visible + */ +describe("Tests for showing next segment", function() { + var current = 0; + beforeEach(function() { + setFixtures('
    \ +
    \ +
    \ +
    \ +
    \ +
    \ +
    '); + + // mock function + spyOn($.fn, "show").and.callFake(function() { + $(this).addClass('hide'); + }); + spyOn($.fn, "hide").and.callFake(function() { + $(this).removeClass('hide'); + }); + current = nextSegment(current); + }); + + it("next segment should be visible", function() { + expect(current).toBe(1); + expect($('.ui.grid.multi-segment')[current-1]).toHaveClass('hide'); + expect($('.ui.grid.multi-segment')[current]).not.toHaveClass('hide'); + expect($(".previous-button")).toBeTruthy(); + }); +}); + +/** + * Suite : Tests for showing previous segment + * Description : This is a test suite for testing if the previous segment of the page + * with different cards is visible + */ +describe("Tests for showing previous segment", function() { + var current = 3; + beforeEach(function() { + setFixtures('
    \ +
    \ +
    \ +
    \ +
    \ +
    \ +
    '); + + // mock function + spyOn($.fn, "show").and.callFake(function() { + $(this).addClass('hide'); + }); + spyOn($.fn, "hide").and.callFake(function() { + $(this).removeClass('hide'); + }); + current = previousSegment(current); + }); + + it("previous segment should be visible", function() { + expect(current).toBe(2); + expect($('.ui.grid.multi-segment')[current-1]).toHaveClass('hide'); + expect($('.ui.grid.multi-segment')[current]).not.toHaveClass('hide'); + expect($(".next-button").hasClass('hide')).toBeTruthy(); + }); +}); diff --git a/tests/jsTests/validationSpec.js b/tests/jsTests/validationSpec.js new file mode 100644 index 0000000..ed1a5d2 --- /dev/null +++ b/tests/jsTests/validationSpec.js @@ -0,0 +1,27 @@ +/** + * Suite : validateNumber + * Description : Test suite to validate comrades'phone number + */ +describe('validateNumber', function() { + it('Should be phone number', function() { + expect(validation.isPhoneNumber('342345235')).toBeTruthy(); + }); + + it('Should not be phone number', function() { + expect(validation.isPhoneNumber('324fdgfd215235')).not.toBeTruthy(); + }); +}); + +/** + * Suite : validateEmail + * Description : Test suite to validate users' email address + */ +describe('validateEmail', function() { + it('Should be email', function() { + expect(validation.isEmailAddress('abc@def.com')).toBeTruthy(); + }); + + it('Should be email', function() { + expect(validation.isEmailAddress('mail.google.com')).not.toBeTruthy(); + }); +}); \ No newline at end of file diff --git a/tests/phpUnitTests/MysqlWrapperMockTrait.php b/tests/phpUnitTests/MysqlWrapperMockTrait.php new file mode 100644 index 0000000..b425abc --- /dev/null +++ b/tests/phpUnitTests/MysqlWrapperMockTrait.php @@ -0,0 +1,137 @@ +mysqli = $this->getMockBuilder(MysqlDatabase::class) + ->setMethods( + array( + 'prepare', + 'bindParams', + 'execute', + 'getResults', + 'getAffectedRows', + 'close' + ) + ) + ->disableOriginalConstructor() + ->getMock(); + + $this->mysqli->expects($this->any()) + ->method('prepare') + ->will($this->returnCallback(function ($query) { + $this->tmp_query = preg_replace( + '/[ \t]+/', + ' ', + preg_replace('/[\r\n]+/', " ", trim($query)) + ); + return $this->mysqli; + })); + + $this->mysqli->expects($this->any()) + ->method('bindParams') + ->will($this->returnCallback(function () use ($mockData, $replacePatterns) { + $func_args = func_get_args(); + $types = str_split(array_shift($func_args)); + foreach ($func_args as $v) { + $type = array_shift($types); + $string_to_replace = '?'; + $replace_with = $type == 's' ? ("'".$v."'") : $v; + + $string_to_replace = '/'.preg_quote($string_to_replace, '/').'/'; + $this->tmp_query = preg_replace( + $string_to_replace, + $replace_with, + $this->tmp_query, + 1 + ); + } + + foreach ($replacePatterns as $p) { + preg_match( + $p['pattern'], + $this->tmp_query, + $output_array + ); + if (!empty($output_array) && !empty($output_array[$p['regex_reponse_index']])) { + $this->tmp_query = str_replace( + $output_array[$p['regex_reponse_index']], + $p['replace_with'], + $this->tmp_query + ); + } + } + + return $this->mysqli; + })); + + $this->mysqli->expects($this->any()) + ->method('execute') + ->will($this->returnCallback(function () use ($mockData) { + $this->results = isset($mockData[$this->tmp_query]) + ? array($mockData[$this->tmp_query]) + : array(); + $this->affected_rows = count($this->results); + return $this->mysqli; + })); + + $this->mysqli->expects($this->any()) + ->method('getAffectedRows') + ->will($this->returnCallback(function () use ($mockData) { + return $this->affected_rows; + })); + + $this->mysqli->expects($this->any()) + ->method('close') + ->will($this->returnCallback(function () { + return $this->mysqli; + })); + + $this->mysqli->expects($this->any()) + ->method('getResults') + ->will($this->returnCallback(function () use ($mockData) { + + $results = $this->results; + + $this->mysqliResult = $this->getMockBuilder(MysqlResult::class) + ->setMethods(array('fetchAssoc', 'fetchArray', 'getNumRows')) + ->disableOriginalConstructor() + ->getMock(); + + $this->mysqliResult + ->expects($this->any()) + ->method('fetchAssoc') + ->will($this->returnCallback(function () use ($results) { + static $fetch_assoc_count = 0; + return isset($results[$fetch_assoc_count]) ? $results[$fetch_assoc_count++] : false; + })); + + $this->mysqliResult + ->expects($this->any()) + ->method('fetchArray') + ->will($this->returnCallback(function () use ($results) { + static $i = 0; + return isset($results[$i]) ? $results[$i++] : false; + })); + + $this->mysqliResult + ->expects($this->any()) + ->method('getNumRows') + ->will($this->returnCallback(function () use ($results) { + return count($results); + })); + + return $this->mysqliResult; + })); + + return $this->mysqli; + } +} diff --git a/tests/phpUnitTests/modules/AuthenticationTest.php b/tests/phpUnitTests/modules/AuthenticationTest.php new file mode 100644 index 0000000..2d00122 --- /dev/null +++ b/tests/phpUnitTests/modules/AuthenticationTest.php @@ -0,0 +1,276 @@ +assertInstanceOf(Authentication::class, $UserAuth); + $this->assertTrue($UserAuth->isValid()); + $this->assertEquals($UserAuth->getUserId(), $user['user_id']); + $userCounter += 1; + } + $this->assertEquals(count($expectedUsers), $userCounter); + } + + /** + * Method : assertSessionFoundForEmailAndPassword + * Description : Method to assert if session is found for valid user credentials + * @databaseMock MysqlDatabase : mock MysqlDatabase instance + * @espectedUsers array : array of expected users + */ + private function assertSessionFoundForEmailAndPassword( + MysqlDatabase $databaseMock, + array $expectedUsers + ) { + $userCounter = 0; + foreach ($expectedUsers as $user) { + $UserAuth = Authentication::createInstanceWithEmailPassword( + $databaseMock, + $user['email'], + $user['password'] + ); + $this->assertInstanceOf(Authentication::class, $UserAuth); + $this->assertTrue($UserAuth->isValid()); + $this->assertEquals($UserAuth->getUserId(), $user['user_id']); + $userCounter += 1; + } + $this->assertEquals(count($expectedUsers), $userCounter); + } + + /** + * Method : assertMultipleUniqueSessions + * Description : Method to assert multiple unique sessions + * @databaseMock MysqlDatabase : mock MysqlDatabase instance + * @expectedUsers array : array of expected users + */ + private function assertMultipleUniqueSessions( + MysqlDatabase $databaseMock, + array $expectedUsers + ) { + $userCounter = 0; + $sessionTokens = array(); + foreach ($expectedUsers as $user_id) { + $sessionToken = Authentication::createSession( + $databaseMock, + $user_id + ); + $this->assertNotFalse($sessionToken); + $this->assertTrue(!in_array($sessionToken, $sessionTokens)); + $sessionTokens[] = $sessionToken; + $userCounter += 1; + } + $this->assertEquals(count($expectedUsers), $userCounter); + } + + /** + * Method : testMultipleSessionToken + * Description : Method to test multiple session tokens + * @databaseMock MysqlDatabase : mock MysqlDatabase instance + * + * @dataProvider mysqlMockProvider + */ + public function testMultipleSessionToken($databaseMock) + { + $this->assertSessionFoundForSessionToken( + $databaseMock, + array( + array( + 'user_id' => 1, + 'session_token' => '0e1461b241f9c30acd59a8161e6057f1' + ), + array( + 'user_id' => 2, + 'session_token' => '0e372a4f0447f221acdd37671fd3d3a3' + ) + ) + ); + } + + /** + * Method : testMultipleSessionsForEmailAndPassword + * Description : Method to test multiple sessions for valid user credentials + * @databaseMock MysqlDatabase : mock MysqlDatabase instance + * + * @dataProvider mysqlMockProvider + */ + public function testMultipleSessionsForEmailAndPassword($databaseMock) + { + $this->assertSessionFoundForEmailAndPassword( + $databaseMock, + array( + array( + 'user_id' => 1, + 'email' => 'r@domain.com', + 'password' => 'dummypassword' + ), + array( + 'user_id' => 2, + 'email' => 'ken@domain.com', + 'password' => 'dummypassword2' + ) + ) + ); + } + + /** + * Method : testMultipleCreatedSessions + * Description : Method to test multiple created session + * @databaseMock MysqlDatabase : mock MysqlDatabase instance + * + * @dataProvider mysqlMockProvider + */ + public function testMultipleCreatedSessions($databaseMock) + { + $this->assertMultipleUniqueSessions( + $databaseMock, + array(1, 2, 3, 3, 3) + ); + } + + /** + * Method : testIsValidCsrfWithValidToken + * Description : Method to test valid csrf token + */ + public function testIsValidCsrfWithValidToken() + { + $this->assertTrue( + Authentication::isValidCsrf('randomvalidcsrftoken', 'randomvalidcsrftoken') + ); + } + + /** + * Method : testIsNotValidCsrfWithInvalidToken + * Description : Method to test invalid csrf token + */ + public function testIsNotValidCsrfWithInvalidToken() + { + $this->assertFalse( + Authentication::isValidCsrf('randomvalidcsrftoken', 'randominvalidcsrftoken') + ); + } + + /** + * Method : mysqlMockProvider + * Description : Method to mock MySQL queries + * + * @dataProvider mysqlMockProvider + */ + public function mysqlMockProvider(): array + { + $mockData = array( + "SELECT * FROM `users` WHERE `email` = 'r@domain.com'" => array( + 'user_id' => 1, + 'name' => 'Ragina', + 'country' => 'in', + 'password' => '7cc573c138bf8f6e731d39b14b8b0aa31ec161bb', + 'email' => 'r@domain.com' + ), + "SELECT * FROM `users` WHERE `email` = 'ken@domain.com'" => array( + 'user_id' => 2, + 'name' => 'Ken', + 'country' => 'ug', + 'password' => '5d1c650af336dc19205c974f8f4ae1319c283a78', + 'email' => 'ken@domain.com' + ), + "SELECT * FROM `users` WHERE `user_id` = 1" => array( + 'user_id' => 1, + 'name' => 'Ragina', + 'country' => 'in', + 'password' => '7cc573c138bf8f6e731d39b14b8b0aa31ec161bb', + 'email' => 'r@domain.com' + ), + "SELECT * FROM `users` WHERE `user_id` = 2" => array( + 'user_id' => 2, + 'name' => 'Ken', + 'country' => 'ug', + 'password' => '5d1c650af336dc19205c974f8f4ae1319c283a78', + 'email' => 'ken@domain.com' + ), + "SELECT * FROM `user_session` WHERE `session_token` = '0e1461b241f9c30acd59a8161e6057f1'" => array( + 'user_id' => 1, + 'name' => 'Ragina', + 'country' => 'in', + 'email' => 'r@domain.com' + ), + "SELECT * FROM `user_session` WHERE `session_token` = '0e372a4f0447f221acdd37671fd3d3a3'" => array( + 'user_id' => 2, + 'name' => 'Ken', + 'country' => 'ug', + 'email' => 'ken@domain.com' + ), + "SELECT * FROM `user_session` WHERE `user_id` = 1" => array( + 'user_id' => 1, + 'name' => 'Ragina', + 'country' => 'in', + 'email' => 'r@domain.com' + ), + "SELECT * FROM `user_session` WHERE `user_id` = 2" => array( + 'user_id' => 2, + 'name' => 'Ken', + 'country' => 'ug', + 'email' => 'ken@domain.com' + ), + "UPDATE `user_session` SET `session_token` = ? WHERE `user_id` = 1" => array( + 'user_id' => 1 + ), + "UPDATE `user_session` SET `session_token` = ? WHERE `user_id` = 2" => array( + 'user_id' => 2 + ), + "INSERT INTO `user_session` (`session_token`, `user_id`) VALUES (?, 3)" => array( + 'user_id' => 3 + ) + ); + + // for special queries where patterns need to be replaced with random values + $replacePatterns = array( + array( + 'pattern' => "/UPDATE `user_session` SET `session_token` = ('(.*)') WHERE `user_id` =/", + 'replace_with' => '?', + 'regex_reponse_index' => 1 + ), + array( + 'pattern' => "/INSERT INTO `user_session` \(`session_token`, `user_id`\) VALUES \(('(.*)')/", + 'replace_with' => '?', + 'regex_reponse_index' => 1 + ) + ); + + $databaseMock = $this->getMysqlWrapperMock($mockData, $replacePatterns); + + return [ + [$databaseMock] + ]; + } +} diff --git a/tests/phpUnitTests/modules/NotificationTest.php b/tests/phpUnitTests/modules/NotificationTest.php new file mode 100644 index 0000000..6d9a711 --- /dev/null +++ b/tests/phpUnitTests/modules/NotificationTest.php @@ -0,0 +1,84 @@ +sendSms($m['phone'], $m['msg']); + $this->assertFalse($sendNotificationRespose['response']); + $counter += 1; + } + + $this->assertEquals(count($arrayOfMessages), $counter); + } + + /** + * Method : testInvalidNotificationParameters + * Description : Method to assert invalid notification parameters + */ + public function testInvalidNotificationParameters() + { + $this->assertInvalidNotificationNotSent( + array( + array( + 'phone' => '', + 'msg' => 'This is a valid message' + ), + array( + 'phone' => '+910000000000', + 'msg' => '' + ) + ) + ); + } + + + /** + * Method : testSendSms + * Description : test to check of the response for sending a sms is a success + */ + public function testSendSms() + { + $notification = new Notification(Notification::USE_TEST_CREDENTIALS); + $sendNotificationRespose = $notification->sendSms('+910000000000', 'Test message'); + $this->assertTrue($sendNotificationRespose['response']); + } + + /** + * Method : testSendMultipleSms + * Description : tests for checking sms sent to multiple numbers + */ + public function testSendMultipleSms() + { + $arrayOfTestNumbers = array( + '+910000000000', + '+15005550006' + ); + $notification = new Notification(Notification::USE_TEST_CREDENTIALS); + $sendNotificationRespose = $notification->sendMultipleSms($arrayOfTestNumbers, 'Test message'); + $this->assertTrue($sendNotificationRespose['response']); + } +} diff --git a/tests/phpUnitTests/modules/RouterTest.php b/tests/phpUnitTests/modules/RouterTest.php new file mode 100644 index 0000000..ca931fa --- /dev/null +++ b/tests/phpUnitTests/modules/RouterTest.php @@ -0,0 +1,277 @@ +assertTrue(is_array($page_data)); + $this->assertArrayHasKey('found', $page_data); + $this->assertArrayHasKey('javascripts', $page_data); + $this->assertArrayHasKey('type', $page_data); + $this->assertArrayHasKey('template', $page_data); + + $this->assertEquals($page_data['found'], $p['validity']); + $this->assertTrue(is_array($page_data['javascripts'])); + $this->assertEquals($page_data['type'], 'index'); + $this->assertEquals($page_data['template'], Router::TEMPLATE_INDEX); + $counter++; + } + + $this->assertEquals(count($pageQueries), $counter); + } + + /** + * Method : testGetPageIndex + * Description : tests for the index page + * @databaseMock MysqlDatabase : mock MysqlDatabase instance + * @dataProvider mysqlMockProvider + */ + public function testGetPageIndex($databaseMock) + { + $this->assertIndexPage( + $databaseMock, + array( + array( + 'query' => Router::INDEX, + 'validity' => true + ), + array( + 'query' => 'randomNotExistingQuery', + 'validity' => false + ) + ) + ); + } + + /** + * Method : testGetFullPage + * Description : tests for the full card template content page + * @databaseMock MysqlDatabase : mock MysqlDatabase instance + * @dataProvider mysqlMockProvider + */ + public function testGetFullPage($databaseMock) + { + $user_email = 'r@domain.com'; + $user = new User($databaseMock, $user_email); + $page_data = Router::getPage($user, Router::HOME, Router::PAGE_SEEKING_STAFF_SUPPORT); + + $this->assertTrue(is_array($page_data)); + $this->assertArrayHasKey('found', $page_data); + $this->assertArrayHasKey('javascripts', $page_data); + $this->assertArrayHasKey('type', $page_data); + $this->assertArrayHasKey('template', $page_data); + $this->assertArrayHasKey('content', $page_data); + + $this->assertTrue($page_data['found']); + $this->assertTrue(is_array($page_data['javascripts'])); + $this->assertEquals($page_data['type'], 'home'); + $this->assertEquals($page_data['content']['template'], Router::TEMPLATE_FULL_PAGE_CARD); + } + + /** + * Method : testGetMultiCardsPage + * Description : tests for multi card template content page + * @databaseMock MysqlDatabase : mock MysqlDatabase instance + * @dataProvider mysqlMockProvider + */ + public function testGetMultiCardsPage($databaseMock) + { + $user_email = 'r@domain.com'; + $user = new User($databaseMock, $user_email); + $page_data = Router::getPage($user, Router::HOME, Router::PAGE_SEXUAL_PREDATORS); + + $this->assertTrue(is_array($page_data)); + $this->assertArrayHasKey('found', $page_data); + $this->assertArrayHasKey('javascripts', $page_data); + $this->assertArrayHasKey('type', $page_data); + $this->assertArrayHasKey('template', $page_data); + $this->assertArrayHasKey('content', $page_data); + + $this->assertTrue($page_data['found']); + $this->assertTrue(is_array($page_data['javascripts'])); + $this->assertEquals($page_data['type'], 'home'); + $this->assertEquals($page_data['content']['template'], Router::TEMPLATE_MULTI_CARDS_PAGE); + } + + /** + * Method : testGetMultiSegmentPage + * Description : tests for the multi segment template content page + * @databaseMock MysqlDatabase : mock MysqlDatabase instance + * @dataProvider mysqlMockProvider + */ + public function testGetMultiSegmentPage($databaseMock) + { + $user_email = 'r@domain.com'; + $user = new User($databaseMock, $user_email); + $page_data = Router::getPage($user, Router::HOME, Router::PAGE_COMMON_QUESTIONS); + + $this->assertTrue(is_array($page_data)); + $this->assertArrayHasKey('found', $page_data); + $this->assertArrayHasKey('javascripts', $page_data); + $this->assertArrayHasKey('type', $page_data); + $this->assertArrayHasKey('template', $page_data); + $this->assertArrayHasKey('content', $page_data); + + $this->assertTrue($page_data['found']); + $this->assertTrue(is_array($page_data['javascripts'])); + $this->assertEquals($page_data['type'], 'home'); + $this->assertEquals($page_data['content']['template'], Router::TEMPLATE_MULTI_SEGMENT_PAGE); + } + + /** + * Method : testGetMultiSegmentVerticalPage + * Description : tests for the multi segment vertical content page + * @databaseMock MysqlDatabase : mock MysqlDatabase instance + * @dataProvider mysqlMockProvider + */ + public function testGetMultiSegmentVerticalPage($databaseMock) + { + $user_email = 'r@domain.com'; + $user = new User($databaseMock, $user_email); + $page_data = Router::getPage($user, Router::HOME, Router::PAGE_MYTHBUSTERS); + + $this->assertTrue(is_array($page_data)); + $this->assertArrayHasKey('found', $page_data); + $this->assertArrayHasKey('javascripts', $page_data); + $this->assertArrayHasKey('type', $page_data); + $this->assertArrayHasKey('template', $page_data); + $this->assertArrayHasKey('content', $page_data); + + $this->assertTrue($page_data['found']); + $this->assertTrue(is_array($page_data['javascripts'])); + $this->assertEquals($page_data['type'], 'home'); + $this->assertEquals($page_data['content']['template'], Router::TEMPLATE_MULTI_SELGMENT_VERTICAL); + } + + /** + * Method : testGetCircleOfTrustPage + * Description : tests for the circle of trust template content page + * @databaseMock MysqlDatabase : mock MysqlDatabase instance + * @dataProvider mysqlMockProvider + */ + public function testGetCircleOfTrustPage($databaseMock) + { + $user_email = 'r@domain.com'; + $user = new User($databaseMock, $user_email); + $page_data = Router::getPage($user, Router::HOME, Router::PAGE_CIRCLE_OF_TRUST); + + $this->assertTrue(is_array($page_data)); + $this->assertArrayHasKey('found', $page_data); + $this->assertArrayHasKey('javascripts', $page_data); + $this->assertArrayHasKey('type', $page_data); + $this->assertArrayHasKey('template', $page_data); + $this->assertArrayHasKey('content', $page_data); + + $this->assertTrue($page_data['found']); + $this->assertTrue(is_array($page_data['javascripts'])); + $this->assertEquals($page_data['type'], 'home'); + $this->assertEquals($page_data['content']['template'], Router::TEMPLATE_CIRCLE_OF_TRUST); + } + + /** + * Method : testGetHelpNowPage + * Description : tests for the get help now template content page + * @databaseMock MysqlDatabase : mock MysqlDatabase instance + * @dataProvider mysqlMockProvider + */ + public function testGetHelpNowPage($databaseMock) + { + $user_email = 'r@domain.com'; + $user = new User($databaseMock, $user_email); + $page_data = Router::getPage($user, Router::HOME, Router::PAGE_GET_HELP_NOW); + + $this->assertTrue(is_array($page_data)); + $this->assertArrayHasKey('found', $page_data); + $this->assertArrayHasKey('javascripts', $page_data); + $this->assertArrayHasKey('type', $page_data); + $this->assertArrayHasKey('template', $page_data); + $this->assertArrayHasKey('content', $page_data); + + $this->assertTrue($page_data['found']); + $this->assertTrue(is_array($page_data['javascripts'])); + $this->assertEquals($page_data['type'], 'home'); + $this->assertEquals($page_data['content']['template'], Router::TEMPLATE_PAGE); + } + + /** + * Method : testGetPageUrl + * Description : tests for the page url generated by router + * @databaseMock MysqlDatabase : mock MysqlDatabase instance + * @dataProvider mysqlMockProvider + */ + public function testGetPageUrl($databaseMock) + { + $page_url = Router::getPageUrl( + Router::HOME, + Router::PAGE_ADDED_SOON + ); + $correct_page_url = HOST + .'?'.Router::PAGE_REQUEST_PARAM.'='.Router::HOME + .'&'.Router::PAGE_CONTENT.'='.Router::PAGE_ADDED_SOON; + + $this->assertEquals( + $page_url, + $correct_page_url + ); + } + + /** + * Method : mysqlMockProvider + * Description : Method to mock MySQL queries + */ + public function mysqlMockProvider(): array + { + $mockData = array( + "SELECT * FROM `users` WHERE `email` = 'r@domain.com'" => array( + 'user_id' => 1, + 'name' => 'Ragina', + 'country' => 'in', + 'password' => '7cc573c138bf8f6e731d39b14b8b0aa31ec161bb', + 'email' => 'r@domain.com' + ) + ); + + $databaseMock = $this->getMysqlWrapperMock($mockData); + + return [ + [$databaseMock] + ]; + } +} diff --git a/tests/phpUnitTests/modules/UserTest.php b/tests/phpUnitTests/modules/UserTest.php new file mode 100644 index 0000000..0e22712 --- /dev/null +++ b/tests/phpUnitTests/modules/UserTest.php @@ -0,0 +1,613 @@ +assertInstanceOf(User::class, $userObj); + $this->assertEquals( + $expectedUsers[$userCounter]['email'], + $userObj->getEmailAddress() + ); + $this->assertEquals( + $expectedUsers[$userCounter]['name'], + $userObj->getName() + ); + $userCounter += 1; + } + + $this->assertEquals(count($expectedUsers), $userCounter); + } + + /** + * Method to assert if user object were found with valid User ID + */ + private function assertUsersFoundWithUserId( + MysqlDatabase $databaseMock, + array $expectedUsers + ) { + $userCounter = 0; + foreach ($expectedUsers as $user) { + $userObj = new User($databaseMock, '', $user['user_id']); + $this->assertInstanceOf(User::class, $userObj); + $this->assertEquals( + $expectedUsers[$userCounter]['email'], + $userObj->getEmailAddress() + ); + $this->assertEquals( + $expectedUsers[$userCounter]['name'], + $userObj->getName() + ); + $userCounter += 1; + } + + $this->assertEquals(count($expectedUsers), $userCounter); + } + + /** + * Method to assert if user object was not found with invalid user_id + */ + private function assertUsersNotFoundWithUserId( + MysqlDatabase $databaseMock, + array $expectedUsers + ) { + $userCounter = 0; + foreach ($expectedUsers as $user) { + $userObj = new User($databaseMock, '', $user['user_id']); + $this->assertFalse($userObj->valid); + $userCounter += 1; + } + + $this->assertEquals(count($expectedUsers), $userCounter); + } + + /** + * Method to assert if user object was not found with invalid user emails + */ + private function assertUsersNotFound( + MysqlDatabase $databaseMock, + array $expectedUsers + ) { + $userCounter = 0; + foreach ($expectedUsers as $user) { + $userObj = new User($databaseMock, $user['email']); + $this->assertFalse($userObj->valid); + $userCounter += 1; + } + + $this->assertNotEquals(count($expectedUsers), 0); + } + + /** + * Method to assert if users' current country post is found + */ + private function assertCountryFound( + MysqlDatabase $databaseMock, + array $expectedUsers + ) { + $userCounter = 0; + foreach ($expectedUsers as $user) { + $userObj = new User($databaseMock, $user['email']); + $this->assertInstanceOf(User::class, $userObj); + $this->assertEquals( + $expectedUsers[$userCounter]['email'], + $userObj->getEmailAddress() + ); + $this->assertEquals($userObj->getCurrentPostCountry(), $user['country']); + $userCounter += 1; + } + + $this->assertEquals(count($expectedUsers), $userCounter); + } + + /** + * Method to assert if new user is added + */ + private function assertNewUserFound( + MysqlDatabase $databaseMock, + array $expectedUsers + ) { + $userCounter = 0; + foreach ($expectedUsers as $user) { + $userObj = new User($databaseMock, $user['email']); + $this->assertInstanceOf(User::class, $userObj); + $this->assertEquals($userObj->addUser($user), 1); + $userCounter += 1; + } + + $this->assertEquals(count($expectedUsers), $userCounter); + } + + /** + * Method to assert if new users are not added with invalid data + */ + private function assertNewUserNotFound( + MysqlDatabase $databaseMock, + array $expectedUsers + ) { + $userCounter = 0; + foreach ($expectedUsers as $user) { + $userObj = new User($databaseMock, $user['email']); + $this->assertInstanceOf(User::class, $userObj); + $this->assertFalse($userObj->addUser($user)); + $userCounter += 1; + } + + $this->assertEquals(count($expectedUsers), $userCounter); + } + + /** + * Method to assert if user credentials are valid + */ + private function assertUserValidity( + MysqlDatabase $databaseMock, + array $expectedUsers + ) { + $userCounter = 0; + foreach ($expectedUsers as $user) { + $userObj = new User($databaseMock, $user['email']); + $this->assertInstanceOf(User::class, $userObj); + $this->assertTrue($userObj->validateCredentials($user['password'])); + $userCounter += 1; + } + + $this->assertEquals(count($expectedUsers), $userCounter); + } + + /** + * Method to assert if valid comrade details for Circle of Trust found + */ + private function assertCircleOfTrustFound( + MysqlDatabase $databaseMock, + array $expectedUsers + ) { + $userCounter = 0; + foreach ($expectedUsers as $user) { + $userObj = new User($databaseMock, $user['email']); + $this->assertInstanceOf(User::class, $userObj); + $this->assertTrue(is_array($userObj->getCircleOfTrust())); + $userCounter += 1; + } + + $this->assertEquals(count($expectedUsers), $userCounter); + } + + /** + * Method to assert if valid updation of Comrade Details in Circle of Trust + */ + private function assertCircleOfTrustUpdated( + MysqlDatabase $databaseMock, + array $expectedUsers + ) { + $userCounter = 0; + foreach ($expectedUsers as $user) { + $userObj = new User($databaseMock, $user['email']); + $this->assertInstanceOf(User::class, $userObj); + $updatedResponse = $userObj->updateCircleOfTrust($user['comrades']); + $this->assertTrue($updatedResponse['response']); + $userCounter += 1; + } + + $this->assertEquals(count($expectedUsers), $userCounter); + } + + + /** + * Method : assertUserInfoUpdatedWithValidData + * Description : asserts for testing user data if it gets updated or not with valid data + * @databaseMock MysqlDatabase : mock MysqlDatabase instance + * @dataProvider mysqlMockProvider + */ + private function assertUserInfoUpdatedWithValidData( + MysqlDatabase $databaseMock, + array $expectedUsers + ) { + $userCounter = 0; + foreach ($expectedUsers as $user) { + $userObj = new User($databaseMock, $user['email']); + $this->assertInstanceOf(User::class, $userObj); + $updatedResponse = $userObj->updateUserInfo($user); + $this->assertTrue($updatedResponse['response']); + $this->assertTrue($updatedResponse['reload']); + $userCounter += 1; + } + + $this->assertEquals(count($expectedUsers), $userCounter); + } + + + /** + * Method : assertUserInfoUpdatedWithInvalidData + * Description : asserts for testing user data if it gets updated or not with invalid data + * @databaseMock MysqlDatabase : mock MysqlDatabase instance + * @dataProvider mysqlMockProvider + */ + private function assertUserInfoUpdatedWithInvalidData( + MysqlDatabase $databaseMock, + array $expectedUsers + ) { + $userCounter = 0; + foreach ($expectedUsers as $user) { + $userObj = new User($databaseMock, $user['email']); + $this->assertInstanceOf(User::class, $userObj); + $updatedResponse = $userObj->updateUserInfo($user); + $this->assertFalse($updatedResponse['response']); + $this->assertTrue($updatedResponse['reload']); + $userCounter += 1; + } + + $this->assertEquals(count($expectedUsers), $userCounter); + } + + /** + * Tests for multiple user objects with email + * @dataProvider mysqlMockProvider + */ + public function testMultipleUsersWithEmail($databaseMock) + { + $this->assertUsersFound( + $databaseMock, + array( + array( + 'email' => 'r@domain.com', + 'name' => 'Ragina' + ), + array( + 'email' => 'ken@domain.com', + 'name' => 'Ken' + ) + ) + ); + } + + /** + * Tests for multiple user objects with invalid credentials + * @dataProvider mysqlMockProvider + */ + public function testMultipleUsersWithInvalidData($databaseMock) + { + $this->assertUsersNotFound( + $databaseMock, + array( + array( + 'email' => 'r3@domain.com', + 'name' => 'Ragina' + ), + array( + 'email' => 'kfen@domain.com', + 'name' => 'Ken' + ), + array( + 'email' => 'kfendomain.com', + 'name' => 'kh23' + ) + ) + ); + } + + /** + * Tests for multiple user objects with user_id + * @dataProvider mysqlMockProvider + */ + public function testMultipleUsersWithUserId($databaseMock) + { + $this->assertUsersFoundWithUserId( + $databaseMock, + array( + array( + 'user_id' => 1, + 'email' => 'r@domain.com', + 'name' => 'Ragina' + ), + array( + 'user_id' => 2, + 'email' => 'ken@domain.com', + 'name' => 'Ken' + ) + ) + ); + } + + /** + * Tests for multiple user objects with invalid user_id + * @dataProvider mysqlMockProvider + */ + public function testMultipleUsersWithInvalidUserId($databaseMock) + { + $this->assertUsersNotFoundWithUserId( + $databaseMock, + array( + array( + 'user_id' => -1, + 'email' => 'r@domain.com' + ), + array( + 'user_id' => -2, + 'email' => 'ken@domain.com' + ) + ) + ); + } + + /** + * Tests for users' post country validity for multiple user objects + * @dataProvider mysqlMockProvider + */ + public function testCurrentPostCountry($databaseMock) + { + $this->assertCountryFound( + $databaseMock, + array( + array( + 'email' => 'r@domain.com', + 'country' => 'India' + ), + array( + 'email' => 'ken@domain.com', + 'country' => 'Uganda' + ) + ) + ); + } + + /** + * Tests for add user functionality + * @dataProvider mysqlMockProvider + */ + public function testAddUser($databaseMock) + { + $this->assertNewUserFound( + $databaseMock, + array( + array( + 'email' => 'r@domain.com', + 'name' => 'Ragina', + 'password' => 'dummypassword', + 'country' => 'in' + ) + ) + ); + } + + /** + * Tests for add user functionality with invalid data + * @dataProvider mysqlMockProvider + */ + public function testAddUserWithInvalidData($databaseMock) + { + $this->assertNewUserNotFound( + $databaseMock, + array( + array( + 'email' => 'r@domain.com', + 'password' => 'dummypassword', + 'country' => 'in' + ), + array( + 'email' => 'r@domain.com', + 'name' => 'Ragina', + 'country' => 'in' + ), + array( + 'email' => 'r@domain.com', + 'name' => 'Ragina', + 'password' => 'dummypassword', + ) + ) + ); + } + + /** + * @dataProvider mysqlMockProvider + */ + public function testValidCredentials($databaseMock) + { + $this->assertUserValidity( + $databaseMock, + array( + array( + 'email' => 'r@domain.com', + 'password' => 'dummypassword' + ), + array( + 'email' => 'ken@domain.com', + 'password' => 'dummypassword2' + ) + ) + ); + } + + /** + * Tests for comrade details of circle of Trust functionality + * @dataProvider mysqlMockProvider + */ + public function testGetCircleOfTrust($databaseMock) + { + $this->assertCircleOfTrustFound( + $databaseMock, + array( + array( + 'email' => 'r@domain.com', + 'password' => 'dummypassword' + ), + array( + 'email' => 'ken@domain.com', + 'password' => 'dummypassword2' + ) + ) + ); + } + + /** + * Tests for Update circle of Trust functionality + * @dataProvider mysqlMockProvider + */ + public function testUpdateCircleOfTrust($databaseMock) + { + $this->assertCircleOfTrustUpdated( + $databaseMock, + array( + array( + 'email' => 'r@domain.com', + 'comrades' => array('919999999999', '918999999999') + ), + array( + 'email' => 'ken@domain.com', + 'comrades' => array('917999999999', '918899999999') + ) + ) + ); + } + + /** + * Method : testUpdatedUserInfoWithValidData + * Description : Method to test user information with valid credentials + * @databaseMock MysqlDatabase : mock MysqlDatabase instance + * @dataProvider mysqlMockProvider + */ + public function testUpdatedUserInfoWithValidData($databaseMock) + { + $this->assertUserInfoUpdatedWithValidData( + $databaseMock, + array( + array( + 'email' => 'r@domain.com', + 'name' => 'ragina', + 'password' => 'newdummypassword', + 'country' => 'ug' + ), + array( + 'email' => 'ken@domain.com', + 'name' => 'KenAdams', + 'password' => 'newdummypassword', + 'country' => 'in' + ) + ) + ); + } + + /** + * Method : testUpdatedUserInfoWithInalidData + * Description : Method to test user information with invalid credentials + * @databaseMock MysqlDatabase : mock MysqlDatabase instance + * @dataProvider mysqlMockProvider + */ + public function testUpdatedUserInfoWithInvalidData($databaseMock) + { + $this->assertUserInfoUpdatedWithInvalidData( + $databaseMock, + array( + array( + 'email' => 'ken@domain.com', + 'password' => 'newdummypassword', + 'country' => 'in' + ), + + array( + 'email' => 'r@domain.com', + 'name' => 'ragina', + 'country' => 'ug' + ), + array( + 'email' => 'ken@domain.com', + 'name' => 'KenAdams', + 'password' => 'newdummypassword' + ) + ) + ); + } + + /** + * Mock MySQL Database queries and their responses for user module + */ + public function mysqlMockProvider(): array + { + $mockData = array( + "SELECT * FROM `users` WHERE `email` = 'r@domain.com'" => array( + 'user_id' => 1, + 'name' => 'Ragina', + 'country' => 'in', + 'password' => '7cc573c138bf8f6e731d39b14b8b0aa31ec161bb', + 'email' => 'r@domain.com' + ), + "SELECT * FROM `users` WHERE `email` = 'ken@domain.com'" => array( + 'user_id' => 2, + 'name' => 'Ken', + 'country' => 'ug', + 'password' => '5d1c650af336dc19205c974f8f4ae1319c283a78', + 'email' => 'ken@domain.com' + ), + "SELECT * FROM `users` WHERE `user_id` = 1" => array( + 'user_id' => 1, + 'name' => 'Ragina', + 'country' => 'in', + 'password' => '7cc573c138bf8f6e731d39b14b8b0aa31ec161bb', + 'email' => 'r@domain.com' + ), + "SELECT * FROM `users` WHERE `user_id` = 2" => array( + 'user_id' => 2, + 'name' => 'Ken', + 'country' => 'ug', + 'password' => '5d1c650af336dc19205c974f8f4ae1319c283a78', + 'email' => 'ken@domain.com' + ), + "SELECT `country` FROM `users` WHERE `email` = 'r@domain.com'" => array( + 'country' => 'in' + ), + "SELECT `country` FROM `users` WHERE `email` = 'ken@domain.com'" => array( + 'country' => 'ug' + ), + "INSERT INTO `users` (`email`, `name`, `password`, `country`) VALUES ('r@domain.com', 'Ragina', '7cc573c138bf8f6e731d39b14b8b0aa31ec161bb', 'in')" => array( + 'user_id' => 3 + ), + "SELECT * FROM `comrades` WHERE `user_id` = 1" => array( + 'user_id' => 1, + 'comrade_details' => '919999999999, 918999999999' + ), + "SELECT * FROM `comrades` WHERE `user_id` = 2" => array( + 'user_id' => 1, + 'comrade_details' => '917999999999, 918899999999' + ), + "UPDATE `users` SET `name` = 'ragina', `country` = 'al', `password` = '7cc573c138bf8f6e731d39b14b8b0aa31ec161bb' WHERE `user_id` = 1" => array( + 'user_id' => 1 + ), + "UPDATE `users` SET `name` = 'KenAdams', `country` = 'in', `password` = '7cc573c138bf8f6e731d39b14b8b0aa31ec161bb' WHERE `user_id` = 2" => array( + 'user_id' => 2 + ) + ); + + $databaseMock = $this->getMysqlWrapperMock($mockData); + + return [ + [$databaseMock] + ]; + } +} diff --git a/tests/phpUnitTests/phpunit.xml b/tests/phpUnitTests/phpunit.xml new file mode 100644 index 0000000..e483d0c --- /dev/null +++ b/tests/phpUnitTests/phpunit.xml @@ -0,0 +1,18 @@ + + + + + modules + + + + + + + + \ No newline at end of file diff --git a/vendor/README.md b/vendor/README.md new file mode 100644 index 0000000..08e3933 --- /dev/null +++ b/vendor/README.md @@ -0,0 +1,2 @@ +### Note: This directory is for composer to maintain dependencies. Please do not commit anything here. +