summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYorhel <git@yorhel.nl>2009-01-16 15:16:39 +0100
committerYorhel <git@yorhel.nl>2009-01-16 15:16:39 +0100
commit9ee7694a4b6f7dce174ec785cf5a71a5a38774bb (patch)
tree38e6dbb83d21dffec285f731fc1ae421e55801f5
parent6dc9a434619d28f87eaf768b00d3696bb7c24c61 (diff)
parent910bb9f397cec1a49526e09e7d2c9b856bd5bdae (diff)
Merge branch 'beta'2.2
-rw-r--r--COPYING661
-rw-r--r--ChangeLog (renamed from lib/ChangeLog)18
-rw-r--r--data/global.pl16
-rw-r--r--data/style.css (renamed from data/skingen/style.css)26
-rw-r--r--lib/Multi/Maintenance.pm14
-rw-r--r--lib/VNDB/DB/Producers.pm1
-rw-r--r--lib/VNDB/DB/Releases.pm9
-rw-r--r--lib/VNDB/DB/Users.pm13
-rw-r--r--lib/VNDB/DB/VN.pm15
-rw-r--r--lib/VNDB/Func.pm2
-rw-r--r--lib/VNDB/Handler/Misc.pm6
-rw-r--r--lib/VNDB/Handler/Releases.pm47
-rw-r--r--lib/VNDB/Handler/Users.pm25
-rw-r--r--lib/VNDB/Handler/VNBrowse.pm6
-rw-r--r--lib/VNDB/Handler/VNPage.pm85
-rw-r--r--lib/VNDB/Util/CommonHTML.pm9
-rw-r--r--lib/VNDB/Util/FormHTML.pm3
-rw-r--r--lib/VNDB/Util/LayoutHTML.pm25
-rw-r--r--lib/VNDB/Util/Misc.pm24
-rw-r--r--static/f/forms.js4
-rw-r--r--static/s/angel/conf2
-rw-r--r--util/dump.sql22
-rwxr-xr-xutil/skingen.pl5
-rw-r--r--util/updates/update_2.2.sql36
-rwxr-xr-xutil/vndb.pl21
25 files changed, 970 insertions, 125 deletions
diff --git a/COPYING b/COPYING
new file mode 100644
index 00000000..dba13ed2
--- /dev/null
+++ b/COPYING
@@ -0,0 +1,661 @@
+ GNU AFFERO GENERAL PUBLIC LICENSE
+ Version 3, 19 November 2007
+
+ Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
+ 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.
+
+ <one line to give the program's name and a brief idea of what it does.>
+ Copyright (C) <year> <name of author>
+
+ 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 <http://www.gnu.org/licenses/>.
+
+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
+<http://www.gnu.org/licenses/>.
diff --git a/lib/ChangeLog b/ChangeLog
index 92532247..28d23ccb 100644
--- a/lib/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,21 @@
+2.2 - ?
+ - Additional custom CSS field to user profile
+ - Search dropdown calls the return function automatically on select
+ - Revised the media list
+ - Added a checkbox to releases to indicate a patch
+ - VN popularity ranking
+ - Limit account creation to one account in 24 hours per IP address
+ - Fixed error message when uploading VN images larger than 500kB
+ - Fixed 3 grammar mistakes related to singular/plural
+ - Don't show hidden release relations on producer pages
+ - Hide the vote dropdown on v+ pages when the VN is already on the wishlist
+ - Don't search for the ADV category when searching for the Game Boy Advance
+ - Keep VN relations on r+ pages ordered by title
+ - VN search doesn't match on titles of older release revisions anymore
+ - Don't forget to update the vn.c_* columns when hiding/unhiding a release
+ - Fixed month display on VNBrowse
+ - VN search also matches on original title field of the vn entry
+
2.1 - 2008-12-29
- Skin support
- 'show all items' tab to large forms
diff --git a/data/global.pl b/data/global.pl
index c791debe..2bb84e08 100644
--- a/data/global.pl
+++ b/data/global.pl
@@ -21,6 +21,8 @@ our %S = (%S,
skin_default => 'angel',
cookie_domain => '.vndb.org',
cookie_key => 'any-private-string-here',
+ source_url => 'http://git.blicky.net/vndb.git/?h=master',
+ admin_email => 'contact@vndb.org',
sharedmem_key => 'VNDB',
user_ranks => [
# rankname allowed actions # DB number
@@ -162,7 +164,7 @@ our %S = (%S,
lin => 'Linux',
mac => 'Mac OS',
dvd => 'DVD Player',
- gba => 'Game Boy Advance',
+ gba => "Game Boy Ad\x{200B}vance",
msx => 'MSX',
nds => 'Nintendo DS',
nes => 'Famicom',
@@ -180,11 +182,15 @@ our %S = (%S,
#DB display qty
cd => [ 'CD', 1 ],
dvd => [ 'DVD', 1 ],
- gdr => [ 'GD-ROM', 1 ],
- blr => [ 'Blu-Ray disk', 1 ],
+ gdr => [ 'GD', 1 ],
+ blr => [ 'Blu-ray', 1 ],
+ flp => [ 'Floppy', 1 ],
+ mrt => [ 'Cartridge', 1 ],
+ mem => [ 'Memory card', 1 ],
+ umd => [ 'UMD', 1 ],
+ nod => [ 'Nintendo Optical Disk', 1 ],
in => [ 'Internet download', 0 ],
- pa => [ 'Patch', 0 ],
- otc => [ 'Other (console)', 0 ],
+ otc => [ 'Other', 0 ],
},
votes => [
'worst ever',
diff --git a/data/skingen/style.css b/data/style.css
index ecbba8a7..6ac89743 100644
--- a/data/skingen/style.css
+++ b/data/style.css
@@ -2,7 +2,7 @@
* {
margin: 0;
- padding: 0;
+ padding: 0;
}
body, td {
@@ -49,11 +49,8 @@ img {
font-family: "Futura", "Century New Gothic", "Arial", Serif;
font-size: 19pt;
font-style: italic;
- color: $maintitle$;
border: none!important;
-}
-#header h1.debug a {
- color: #c00;
+ $_maintitle$
}
#footer {
@@ -66,6 +63,20 @@ img {
text-decoration: underline;
}
+#debug {
+ position: fixed;
+ left: 0;
+ bottom: 0;
+ background-color: #600;
+ border-right: 1px solid #c00;
+ border-top: 1px solid #c00;
+ width: 200px;
+ height: 50px;
+ text-align: center;
+}
+#debug h2 { color: #f00!important; font-size: 20px; }
+#debug, #debug a { color: #fff!important; }
+
ul, ol {
margin-left: 35px;
}
@@ -591,6 +602,7 @@ div.vndescription p {
margin: 0 100px!important;
}
+b.patch { font-weight: normal; color: $grayedout$ }
.releases table, #screenshots table {
width: 100%;
}
@@ -666,9 +678,10 @@ a.addnew {
.votegraph { float: left; margin-right: 20px }
.votegraph td { padding: 0 2px; }
.votegraph td.number { text-align: right }
-.votegraph td div { float: left; height: 14px; background-color: $border$; margin-right: 2px; }
+.votegraph td div { float: left; height: 14px; background-color: $border$; margin-right: 2px; padding: 0; }
.votestats thead td { background: transparent; text-align: center; padding: 2px; }
.votestats tfoot td { text-align: right }
+.votestats div { text-align: center; padding-top: 5px; }
.recentvotes { width: 300px }
@@ -766,6 +779,7 @@ a.help {
.vnbrowse .tc2 { text-align: right; padding: 0; }
.vnbrowse .tc3 { padding: 0; }
+.vnbrowse .tc5 { text-align: right; padding-right: 10px; }
#q { width: 300px }
#advselect {
text-align: center;
diff --git a/lib/Multi/Maintenance.pm b/lib/Multi/Maintenance.pm
index 2fb7b2bd..e9c9b337 100644
--- a/lib/Multi/Maintenance.pm
+++ b/lib/Multi/Maintenance.pm
@@ -9,6 +9,7 @@ use strict;
use warnings;
use POE;
use PerlIO::gzip;
+use Time::HiRes 'gettimeofday', 'tv_interval';
sub spawn {
@@ -17,7 +18,7 @@ sub spawn {
my $p = shift;
POE::Session->create(
package_states => [
- $p => [qw| _start cmd_maintenance vncache usercache statscache revcache integrity unkanime logrotate |],
+ $p => [qw| _start cmd_maintenance vncache usercache statscache revcache integrity unkanime logrotate vnpopularity |],
],
);
}
@@ -25,10 +26,10 @@ sub spawn {
sub _start {
$_[KERNEL]->alias_set('maintenance');
- $_[KERNEL]->call(core => register => qr/^maintenance((?: (?:vncache|revcache|usercache|statscache|integrity|unkanime|logrotate))+)$/, 'cmd_maintenance');
+ $_[KERNEL]->call(core => register => qr/^maintenance((?: (?:vncache|revcache|usercache|statscache|integrity|unkanime|logrotate|vnpopularity))+)$/, 'cmd_maintenance');
# Perform some maintenance functions every day on 0:00
- $_[KERNEL]->post(core => addcron => '0 0 * * *', 'maintenance vncache integrity unkanime');
+ $_[KERNEL]->post(core => addcron => '0 0 * * *', 'maintenance vncache integrity unkanime vnpopularity');
# update caches and rotate logs every 1st day of the month at 0:05
$_[KERNEL]->post(core => addcron => '5 0 1 * *' => 'maintenance usercache statscache revcache logrotate');
}
@@ -169,6 +170,13 @@ sub logrotate {
}
+sub vnpopularity {
+ my $S = [gettimeofday];
+ $Multi::SQL->do(q|SELECT update_vnpopularity()|);
+ $_[KERNEL]->call(core => log => 3 => '(Re)calculated vn.c_popularity in %.2fs', tv_interval($S));
+}
+
+
1;
diff --git a/lib/VNDB/DB/Producers.pm b/lib/VNDB/DB/Producers.pm
index edee4a8a..c7abd765 100644
--- a/lib/VNDB/DB/Producers.pm
+++ b/lib/VNDB/DB/Producers.pm
@@ -69,6 +69,7 @@ sub dbProducerGet {
JOIN vn_rev vr ON vr.id = v.latest
WHERE vp.pid IN(!l)
AND v.hidden = FALSE
+ AND r.hidden = FALSE
GROUP BY v.id
ORDER BY date|,
[ keys %r ]
diff --git a/lib/VNDB/DB/Releases.pm b/lib/VNDB/DB/Releases.pm
index 6af2f736..52fea2b0 100644
--- a/lib/VNDB/DB/Releases.pm
+++ b/lib/VNDB/DB/Releases.pm
@@ -41,7 +41,7 @@ sub dbReleaseGet {
);
my @select = (
- qw|r.id r.locked r.hidden rr.title rr.original rr.gtin rr.language rr.website rr.released rr.notes rr.minage rr.type|, 'rr.id AS cid',
+ qw|r.id r.locked r.hidden rr.title rr.original rr.gtin rr.language rr.website rr.released rr.notes rr.minage rr.type rr.patch|, 'rr.id AS cid',
$o{what} =~ /changes/ ? qw|c.added c.requester c.comments r.latest u.username c.rev| : (),
);
@@ -69,7 +69,8 @@ sub dbReleaseGet {
FROM releases_vn rv
JOIN vn v ON v.id = rv.vid
JOIN vn_rev vr ON vr.id = v.latest
- WHERE rv.rid IN(!l)|,
+ WHERE rv.rid IN(!l)
+ ORDER BY vr.title|,
[ keys %r ]
)});
}
@@ -135,9 +136,9 @@ sub insert_rev {
my($self, $cid, $rid, $o) = @_;
$self->dbExec(q|
- INSERT INTO releases_rev (id, rid, title, original, gtin, language, website, released, notes, minage, type)
+ INSERT INTO releases_rev (id, rid, title, original, gtin, language, website, released, notes, minage, type, patch)
VALUES (!l)|,
- [ $cid, $rid, @$o{qw| title original gtin language website released notes minage type|} ]);
+ [ $cid, $rid, @$o{qw| title original gtin language website released notes minage type patch|} ]);
$self->dbExec(q|
INSERT INTO releases_producers (rid, pid)
diff --git a/lib/VNDB/DB/Users.pm b/lib/VNDB/DB/Users.pm
index 6f1a13c6..3a327197 100644
--- a/lib/VNDB/DB/Users.pm
+++ b/lib/VNDB/DB/Users.pm
@@ -8,7 +8,7 @@ use Exporter 'import';
our @EXPORT = qw|dbUserGet dbUserEdit dbUserAdd dbUserDel|;
-# %options->{ username passwd mail order uid results page what }
+# %options->{ username passwd mail order uid ip registered results page what }
# what: stats
sub dbUserGet {
my $s = shift;
@@ -35,6 +35,10 @@ sub dbUserGet {
'id = ?' => $o{uid} ) : (),
!$o{uid} && !$o{username} ? (
'id > 0' => 1 ) : (),
+ $o{ip} ? (
+ 'ip = ?' => $o{ip} ) : (),
+ $o{registered} ? (
+ 'registered > ?' => $o{registered} ) : (),
);
my @select = (
@@ -64,7 +68,7 @@ sub dbUserEdit {
my %h;
defined $o{$_} && ($h{$_.' = ?'} = $o{$_})
- for (qw| username mail rank show_nsfw show_list skin |);
+ for (qw| username mail rank show_nsfw show_list skin customcss |);
$h{'passwd = decode(?, \'hex\')'} = $o{passwd}
if defined $o{passwd};
@@ -77,10 +81,11 @@ sub dbUserEdit {
}
-# username, md5(pass), mail
+# username, md5(pass), mail, [ip]
sub dbUserAdd {
my($s, @o) = @_;
- $s->dbExec(q|INSERT INTO users (username, passwd, mail, registered) VALUES(?, decode(?, 'hex'), ?, ?)|, @o, time);
+ $s->dbExec(q|INSERT INTO users (username, passwd, mail, ip, registered) VALUES(?, decode(?, 'hex'), ?, ?, ?)|,
+ @o[0..2], $o[3]||$s->reqIP, time);
}
diff --git a/lib/VNDB/DB/VN.pm b/lib/VNDB/DB/VN.pm
index df2e0a03..368657fc 100644
--- a/lib/VNDB/DB/VN.pm
+++ b/lib/VNDB/DB/VN.pm
@@ -10,7 +10,7 @@ our @EXPORT = qw|dbVNGet dbVNAdd dbVNEdit dbVNImageId dbVNCache dbScreenshotAdd
# Options: id, rev, char, search, cati, cate, lang, platform, results, page, order, what
-# What: extended categories anime relations screenshots relgraph changes
+# What: extended categories anime relations screenshots relgraph ranking changes
sub dbVNGet {
my($self, %o) = @_;
$o{results} ||= 10;
@@ -50,16 +50,18 @@ sub dbVNGet {
);
if($o{search}) {
- my @w;
- for (split /[ -,]/, $o{search}) {
+ my @w = (
+ '(irr.id IS NULL OR ir.latest = irr.id)' => 1
+ );
+ for (split /[ -,._]/, $o{search}) {
s/%//g;
next if length($_) < 2;
if(/^\d+$/ && gtintype($_)) {
push @w, 'irr.gtin = ?', $_;
} else {
$_ = "%$_%";
- push @w, '(ivr.title ILIKE ? OR ivr.alias ILIKE ? OR irr.title ILIKE ? OR irr.original ILIKE ?)',
- [ $_, $_, $_, $_ ];
+ push @w, '(ivr.title ILIKE ? OR ivr.original ILIKE ? OR ivr.alias ILIKE ? OR irr.title ILIKE ? OR irr.original ILIKE ?)',
+ [ $_, $_, $_, $_, $_ ];
}
}
$where{ q|
@@ -87,12 +89,13 @@ sub dbVNGet {
);
my @select = (
- qw|v.id v.locked v.hidden v.c_released v.c_languages v.c_platforms vr.title vr.original v.rgraph|, 'vr.id AS cid',
+ qw|v.id v.locked v.hidden v.c_released v.c_languages v.c_platforms vr.title vr.original v.rgraph v.c_popularity|, 'vr.id AS cid',
$o{what} =~ /extended/ ? (
qw|vr.alias vr.image vr.img_nsfw vr.length vr.desc vr.l_wp vr.l_encubed vr.l_renai vr.l_vnn| ) : (),
$o{what} =~ /changes/ ? (
qw|c.added c.requester c.comments v.latest u.username c.rev c.causedby|) : (),
$o{what} =~ /relgraph/ ? 'rg.cmap' : (),
+ $o{what} =~ /ranking/ ? '(SELECT COUNT(*) FROM vn iv WHERE iv.c_popularity >= v.c_popularity) AS ranking' : (),
);
my($r, $np) = $self->dbPage(\%o, q|
diff --git a/lib/VNDB/Func.pm b/lib/VNDB/Func.pm
index 330dad7d..4c71d061 100644
--- a/lib/VNDB/Func.pm
+++ b/lib/VNDB/Func.pm
@@ -70,7 +70,7 @@ sub monthstr {
return 'TBA' if $y == 9999;
return 'unknown' if $y == 0;
return $y if $m == 99;
- return strftime '%b %Y', 0, 0, 0, 0, $m-1, $y-1900, 0, 0, 0;
+ return sprintf '%s %d', [qw(Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec)]->[$m-1], $y;
}
diff --git a/lib/VNDB/Handler/Misc.pm b/lib/VNDB/Handler/Misc.pm
index 5a9b9a2a..39af8155 100644
--- a/lib/VNDB/Handler/Misc.pm
+++ b/lib/VNDB/Handler/Misc.pm
@@ -326,12 +326,16 @@ sub itemmod {
return $self->htmlDenied if !$self->authCan($act eq 'hide' ? 'del' : 'lock');
my $obj = $type eq 'v' ? $self->dbVNGet(id => $iid)->[0] :
- $type eq 'r' ? $self->dbReleaseGet(id => $iid)->[0] :
+ $type eq 'r' ? $self->dbReleaseGet(id => $iid, what => 'vn')->[0] :
$self->dbProducerGet(id => $iid)->[0];
return 404 if !$obj->{id};
$self->dbItemMod($type, $iid, $act eq 'hide' ? (hidden => !$obj->{hidden}) : (locked => !$obj->{locked}));
+ # update cached vn info when hiding an r+ page
+ $self->vnCacheUpdate(map $_->{vid}, @{$obj->{vn}})
+ if $type eq 'r' && $act eq 'hide';
+
$self->resRedirect("/$type$iid", 'temp');
}
diff --git a/lib/VNDB/Handler/Releases.pm b/lib/VNDB/Handler/Releases.pm
index ff28c64b..38a1fa02 100644
--- a/lib/VNDB/Handler/Releases.pm
+++ b/lib/VNDB/Handler/Releases.pm
@@ -40,6 +40,7 @@ sub page {
map sprintf('<a href="/v%d" title="%s">%s</a>', $_->{vid}, $_->{original}||$_->{title}, shorten $_->{title}, 50), @{$_[0]};
} ],
[ type => 'Type', serialize => sub { $self->{release_types}[$_[0]] } ],
+ [ patch => 'Patch', serialize => sub { $_[0] ? 'Patch' : 'Not a patch' } ],
[ title => 'Title (romaji)', diff => 1 ],
[ original => 'Original title', diff => 1 ],
[ gtin => 'JAN/UPC/EAN', serialize => sub { $_[0]||'[none]' } ],
@@ -82,13 +83,21 @@ sub page {
sub _infotable {
my($self, $r) = @_;
table;
- Tr;
- td class => 'key', ' ';
- td ' ';
- end;
my $i = 0;
Tr ++$i % 2 ? (class => 'odd') : ();
+ td class => 'key', 'Title';
+ td $r->{title};
+ end;
+
+ if($r->{original}) {
+ Tr ++$i % 2 ? (class => 'odd') : ();
+ td 'Original title';
+ td $r->{original};
+ end;
+ }
+
+ Tr ++$i % 2 ? (class => 'odd') : ();
td 'Relation';
td;
for (@{$r->{vn}}) {
@@ -104,6 +113,7 @@ sub _infotable {
my $type = $self->{release_types}[$r->{type}];
cssicon lc(substr $type, 0, 3), $type;
txt ' '.$type;
+ txt ' patch' if $r->{patch};
end;
end;
@@ -229,17 +239,18 @@ sub edit {
my $vn = $rid ? $r->{vn} : [{ vid => $vid, title => $v->{title} }];
my %b4 = !$rid ? () : (
- (map { $_ => $r->{$_} } qw|type title original gtin language website notes minage platforms|),
+ (map { $_ => $r->{$_} } qw|type title original gtin language website notes minage platforms patch|),
released => $r->{released} =~ /^([0-9]{4})([0-9]{2})([0-9]{2})$/ ? [ $1, $2, $3 ] : [ 0, 0, 0 ],
media => join(',', sort map "$_->{medium} $_->{qty}", @{$r->{media}}),
producers => join('|||', map "$_->{id},$_->{name}", sort { $a->{id} <=> $b->{id} } @{$r->{producers}}),
);
- $b4{vn} = join('|||', map "$_->{vid},$_->{title}", sort { $a->{vid} <=> $b->{vid} } @$vn);
+ $b4{vn} = join('|||', map "$_->{vid},$_->{title}", @$vn);
my $frm;
if($self->reqMethod eq 'POST') {
$frm = $self->formValidate(
{ name => 'type', enum => [ 0..$#{$self->{release_types}} ] },
+ { name => 'patch', required => 0, default => 0 },
{ name => 'title', maxlength => 250 },
{ name => 'original', required => 0, default => '', maxlength => 250 },
{ name => 'gtin', required => 0, default => '0',
@@ -263,6 +274,7 @@ sub edit {
my $producers = [ map { /^([0-9]+)/ ? $1 : () } split /\|\|\|/, $frm->{producers} ];
my $new_vn = [ map { /^([0-9]+)/ ? $1 : () } split /\|\|\|/, $frm->{vn} ];
$frm->{platforms} = [ grep $_, @{$frm->{platforms}} ];
+ $frm->{patch} = $frm->{patch} ? 1 : 0;
return $self->resRedirect("/r$rid", 'post')
if $rid && $released == $r->{released} &&
@@ -272,7 +284,7 @@ sub edit {
!grep !/^(released|platforms|producers|vn)$/ && $frm->{$_} ne $b4{$_}, keys %b4;
my %opts = (
- (map { $_ => $frm->{$_} } qw| type title original gtin language website notes minage platforms editsum|),
+ (map { $_ => $frm->{$_} } qw| type title original gtin language website notes minage platforms editsum patch|),
vn => $new_vn,
producers => $producers,
media => $media,
@@ -284,7 +296,7 @@ sub edit {
($rid) = $self->dbReleaseAdd(%opts) if !$rid;
$self->multiCmd("ircnotify r$rid.$rev");
- _update_vncache($self, @$new_vn, map $_->{vid}, @$vn);
+ $self->vnCacheUpdate(@$new_vn, map $_->{vid}, @$vn);
return $self->resRedirect("/r$rid.$rev", 'post');
}
@@ -310,6 +322,7 @@ sub _form {
"General info" => [
[ select => short => 'type', name => 'Type',
options => [ map [ $_, $self->{release_types}[$_] ], 0..$#{$self->{release_types}} ] ],
+ [ check => short => 'patch', name => 'This release is a patch to an other release.' ],
[ input => short => 'title', name => 'Title (romaji)', width => 300 ],
[ input => short => 'original', name => 'Original title', width => 300 ],
[ static => content => 'The original title of this release, leave blank if it already is in the Latin alphabet.' ],
@@ -400,23 +413,5 @@ sub _form {
}
-# Recalculates the vn.c_* columns and regenerates the related relation graphs on any change
-sub _update_vncache {
- my($self, @vns) = @_;
-
- my $before = $self->dbVNGet(id => \@vns, order => 'v.id', what => 'relations');
- $self->dbVNCache(@vns);
- my $after = $self->dbVNGet(id => \@vns, order => 'v.id');
-
- my @upd = map {
- @{$before->[$_]{relations}} && (
- $before->[$_]{c_released} != $after->[$_]{c_released}
- || $before->[$_]{c_languages} ne $after->[$_]{c_languages}
- ) ? $before->[$_]{id} : ();
- } 0..$#$before;
- $self->multiCmd('relgraph '.join(' ', @upd)) if @upd;
-}
-
-
1;
diff --git a/lib/VNDB/Handler/Users.pm b/lib/VNDB/Handler/Users.pm
index f2bb0fa6..2b83b4a5 100644
--- a/lib/VNDB/Handler/Users.pm
+++ b/lib/VNDB/Handler/Users.pm
@@ -88,12 +88,16 @@ sub userpage {
Tr ++$i % 2 ? (class => 'odd') : ();
td 'List stats';
td !$u->{show_list} ? 'hidden' :
- sprintf '%d releases of %d visual novels', $u->{releasecount}, $u->{vncount};
+ sprintf '%d release%s of %d visual novel%s',
+ $u->{releasecount}, $u->{releasecount} != 1 ? 's' : '',
+ $u->{vncount}, $u->{vncount} != 1 ? 's' : '';
end;
Tr ++$i % 2 ? (class => 'odd') : ();
td 'Forum stats';
- td sprintf '%d posts, %d new threads', $u->{postcount}, $u->{threadcount};
+ td sprintf '%d post%s, %d new thread%s',
+ $u->{postcount}, $u->{postcount} != 1 ? 's' : '',
+ $u->{threadcount}, $u->{threadcount} != 1 ? 's' : '';
end;
end;
end;
@@ -239,6 +243,7 @@ sub register {
push @{$frm->{_err}}, 'passmatch' if $frm->{usrpass} ne $frm->{usrpass2};
push @{$frm->{_err}}, 'usrexists' if $frm->{usrname} eq 'anonymous' || !$frm->{_err} && $self->dbUserGet(username => $frm->{usrname})->[0]{id};
push @{$frm->{_err}}, 'mailexists' if !$frm->{_err} && $self->dbUserGet(mail => $frm->{mail})->[0]{id};
+ push @{$frm->{_err}}, 'oneaday' if !$frm->{_err} && $self->dbUserGet(ip => $self->reqIP, registered => time-24*3600)->[0]{id};
if(!$frm->{_err}) {
$self->dbUserAdd($frm->{usrname}, md5_hex($frm->{usrpass}), $frm->{mail});
@@ -299,17 +304,20 @@ sub edit {
{ name => 'mail', template => 'mail' },
{ name => 'usrpass', required => 0, minlength => 4, maxlength => 64, template => 'asciiprint' },
{ name => 'usrpass2', required => 0, minlength => 4, maxlength => 64, template => 'asciiprint' },
- { name => 'skin', enum => [ '', keys %{$self->{skins}} ], required => 0, default => '' },
{ name => 'flags_list', required => 0, default => 0 },
{ name => 'flags_nsfw', required => 0, default => 0 },
+ { name => 'skin', enum => [ '', keys %{$self->{skins}} ], required => 0, default => '' },
+ { name => 'customcss', required => 0, maxlength => 2000, default => '' },
);
- push @{$frm->{_err}}, 'passmatch' if ($frm->{usrpass} || $frm->{usrpass2}) && $frm->{usrpass} ne $frm->{usrpass2};
+ push @{$frm->{_err}}, 'passmatch'
+ if ($frm->{usrpass} || $frm->{usrpass2}) && (!$frm->{usrpass} || !$frm->{usrpass2} || $frm->{usrpass} ne $frm->{usrpass2});
if(!$frm->{_err}) {
my %o;
$o{username} = $frm->{usrname} if $frm->{usrname};
$o{rank} = $frm->{rank} if $frm->{rank};
$o{mail} = $frm->{mail};
$o{skin} = $frm->{skin};
+ $o{customcss} = $frm->{customcss};
$o{passwd} = md5_hex($frm->{usrpass}) if $frm->{usrpass};
$o{show_list} = $frm->{flags_list} ? 1 : 0;
$o{show_nsfw} = $frm->{flags_nsfw} ? 1 : 0;
@@ -321,9 +329,7 @@ sub edit {
# fill out default values
$frm->{usrname} ||= $u->{username};
- $frm->{rank} ||= $u->{rank};
- $frm->{mail} ||= $u->{mail};
- $frm->{skin} ||= $u->{skin};
+ $frm->{$_} ||= $u->{$_} for(qw|rank mail skin customcss|);
$frm->{flags_list} = $u->{show_list} if !defined $frm->{flags_list};
$frm->{flags_nsfw} = $u->{show_nsfw} if !defined $frm->{flags_nsfw};
@@ -356,12 +362,13 @@ sub edit {
[ passwd => short => 'usrpass2', name => 'Confirm pass.' ],
[ part => title => 'Options' ],
- [ select => short => 'skin', name => 'Prefered skin', options => [
- map [ $_ eq $self->{skin_default} ? '' : $_, $self->{skins}{$_} ], sort { $self->{skins}{$a} cmp $self->{skins}{$b} } keys %{$self->{skins}} ] ],
[ check => short => 'flags_list', name =>
qq|Allow other people to see my visual novel list (<a href="/u$uid/list">/u$uid/list</a>) |.
qq|and wishlist (<a href="/u$uid/wish">/u$uid/wish</a>)| ],
[ check => short => 'flags_nsfw', name => 'Disable warnings for images that are not safe for work.' ],
+ [ select => short => 'skin', name => 'Prefered skin', width => 300, options => [
+ map [ $_ eq $self->{skin_default} ? '' : $_, $self->{skins}{$_} ], sort { $self->{skins}{$a} cmp $self->{skins}{$b} } keys %{$self->{skins}} ] ],
+ [ textarea => short => 'customcss', name => 'Additional CSS' ],
]);
$self->htmlFooter;
}
diff --git a/lib/VNDB/Handler/VNBrowse.pm b/lib/VNDB/Handler/VNBrowse.pm
index 8af5791e..d7cacaa0 100644
--- a/lib/VNDB/Handler/VNBrowse.pm
+++ b/lib/VNDB/Handler/VNBrowse.pm
@@ -16,7 +16,7 @@ sub list {
my($self, $char) = @_;
my $f = $self->formValidate(
- { name => 's', required => 0, default => 'title', enum => [ qw|title rel| ] },
+ { name => 's', required => 0, default => 'title', enum => [ qw|title rel pop| ] },
{ name => 'o', required => 0, default => 'a', enum => [ 'a','d' ] },
{ name => 'p', required => 0, default => 1, template => 'int' },
{ name => 'q', required => 0, default => '' },
@@ -61,7 +61,7 @@ sub list {
$q ? ( search => $q ) : (),
results => 50,
page => $f->{p},
- order => ($f->{s} eq 'rel' ? 'c_released' : 'title').($f->{o} eq 'a' ? ' ASC' : ' DESC'),
+ order => ($f->{s} eq 'rel' ? 'c_released' : $f->{s} eq 'pop' ? 'c_popularity' : 'title').($f->{o} eq 'a' ? ' ASC' : ' DESC'),
@cati ? ( cati => \@cati ) : (),
@cate ? ( cate => \@cate ) : (),
@lang ? ( lang => \@lang ) : (),
@@ -85,6 +85,7 @@ sub list {
[ '', 0 ],
[ '', 0 ],
[ 'Released', 'rel' ],
+ [ 'Popularity', 'pop' ],
],
row => sub {
my($s, $n, $l) = @_;
@@ -103,6 +104,7 @@ sub list {
td class => 'tc4';
lit monthstr $l->{c_released};
end;
+ td class => 'tc5', sprintf '%.2f', $l->{c_popularity}*100;
end;
},
);
diff --git a/lib/VNDB/Handler/VNPage.pm b/lib/VNDB/Handler/VNPage.pm
index b53b60ee..6c336160 100644
--- a/lib/VNDB/Handler/VNPage.pm
+++ b/lib/VNDB/Handler/VNPage.pm
@@ -37,7 +37,7 @@ sub page {
my $v = $self->dbVNGet(
id => $vid,
- what => 'extended categories anime relations screenshots'.($rev ? ' changes' : ''),
+ what => 'extended categories anime relations screenshots ranking'.($rev ? ' changes' : ''),
$rev ? (rev => $rev) : (),
)->[0];
return 404 if !$v->{id};
@@ -78,15 +78,15 @@ sub page {
# general info
table;
- Tr;
- td class => 'key', ' ';
- td ' ';
- end;
my $i = 0;
- if($v->{length}) {
+ Tr ++$i % 2 ? (class => 'odd') : ();
+ td class => 'key', 'Title';
+ td $v->{title};
+ end;
+ if($v->{original}) {
Tr ++$i % 2 ? (class => 'odd') : ();
- td 'Length';
- td "$self->{vn_lengths}[$v->{length}][0] ($self->{vn_lengths}[$v->{length}][1])";
+ td 'Original title';
+ td $v->{original};
end;
}
if($v->{alias}) {
@@ -95,6 +95,12 @@ sub page {
td $v->{alias};
end;
}
+ if($v->{length}) {
+ Tr ++$i % 2 ? (class => 'odd') : ();
+ td 'Length';
+ td "$self->{vn_lengths}[$v->{length}][0] ($self->{vn_lengths}[$v->{length}][1])";
+ end;
+ }
my @links = (
$v->{l_wp} ? [ 'Wikipedia', 'http://en.wikipedia.org/wiki/%s', $v->{l_wp} ] : (),
$v->{l_encubed} ? [ 'Encubed', 'http://novelnews.net/tag/%s/', $v->{l_encubed} ] : (),
@@ -117,34 +123,7 @@ sub page {
_categories($self, \$i, $v) if @{$v->{categories}};
_relations($self, \$i, $v) if @{$v->{relations}};
_anime($self, \$i, $v) if @{$v->{anime}};
-
- # User options
- if($self->authInfo->{id}) {
- my $vote = $self->dbVoteGet(uid => $self->authInfo->{id}, vid => $v->{id})->[0];
- my $wish = $self->dbWishListGet(uid => $self->authInfo->{id}, vid => $v->{id})->[0];
- Tr ++$i % 2 ? (class => 'odd') : ();
- td 'User options';
- td;
- Select id => 'votesel';
- option $vote ? "your vote: $vote->{vote}" : 'not voted yet';
- optgroup label => $vote ? 'Change vote' : 'Vote';
- option value => $_, "$_ ($self->{votes}[$_-1])" for (reverse 1..10);
- end;
- option value => -1, 'revoke' if $vote;
- end;
- if(!$vote || $wish) {
- br;
- Select id => 'wishsel';
- option $wish ? "wishlist: $self->{wishlist_status}[$wish->{wstat}]" : 'not on your wishlist';
- optgroup label => $wish ? 'Change status' : 'Add to wishlist';
- option value => $_, $self->{wishlist_status}[$_] for (0..$#{$self->{wishlist_status}});
- end;
- option value => -1, 'remove from wishlist';
- end;
- }
- end;
- end;
- }
+ _useroptions($self, \$i, $v) if $self->authInfo->{id};
end;
end;
@@ -350,6 +329,39 @@ sub _anime {
}
+sub _useroptions {
+ my($self, $i, $v) = @_;
+
+ my $vote = $self->dbVoteGet(uid => $self->authInfo->{id}, vid => $v->{id})->[0];
+ my $wish = $self->dbWishListGet(uid => $self->authInfo->{id}, vid => $v->{id})->[0];
+
+ Tr ++$$i % 2 ? (class => 'odd') : ();
+ td 'User options';
+ td;
+ if($vote || !$wish) {
+ Select id => 'votesel';
+ option $vote ? "your vote: $vote->{vote}" : 'not voted yet';
+ optgroup label => $vote ? 'Change vote' : 'Vote';
+ option value => $_, "$_ ($self->{votes}[$_-1])" for (reverse 1..10);
+ end;
+ option value => -1, 'revoke' if $vote;
+ end;
+ br;
+ }
+ if(!$vote || $wish) {
+ Select id => 'wishsel';
+ option $wish ? "wishlist: $self->{wishlist_status}[$wish->{wstat}]" : 'not on your wishlist';
+ optgroup label => $wish ? 'Change status' : 'Add to wishlist';
+ option value => $_, $self->{wishlist_status}[$_] for (0..$#{$self->{wishlist_status}});
+ end;
+ option value => -1, 'remove from wishlist';
+ end;
+ }
+ end;
+ end;
+}
+
+
sub _releases {
my($self, $v, $r) = @_;
@@ -395,6 +407,7 @@ sub _releases {
end;
td class => 'tc4';
a href => "/r$rel->{id}", title => $rel->{original}||$rel->{title}, $rel->{title};
+ b class => 'patch', ' (patch)' if $rel->{patch};
end;
td class => 'tc5';
if($self->authInfo->{id}) {
diff --git a/lib/VNDB/Util/CommonHTML.pm b/lib/VNDB/Util/CommonHTML.pm
index 70fdfde3..6b6725c6 100644
--- a/lib/VNDB/Util/CommonHTML.pm
+++ b/lib/VNDB/Util/CommonHTML.pm
@@ -402,7 +402,7 @@ sub htmlVoteStats {
td colspan => 2, 'Vote graph';
end; end;
tfoot; Tr;
- td colspan => 2, sprintf '%d votes total, average %.2f%s', $count, $total/$count,
+ td colspan => 2, sprintf '%d vote%s total, average %.2f%s', $count, $count != 1 ? 's' : '', $total/$count,
$type eq 'v' ? ' ('.$self->{votes}[sprintf '%.0f', $total/$count-1].')' : '';
end; end;
for (reverse 0..$#$stats) {
@@ -443,7 +443,14 @@ sub htmlVoteStats {
}
end;
}
+
clearfloat;
+ if($type eq 'v') {
+ div;
+ h3 'Popularity';
+ p sprintf 'Ranked #%d out of %d with a score of %.2f.', $obj->{ranking}, $self->{stats}{vn}, $obj->{c_popularity}*100;
+ end;
+ }
end;
}
diff --git a/lib/VNDB/Util/FormHTML.pm b/lib/VNDB/Util/FormHTML.pm
index ff23682d..75471830 100644
--- a/lib/VNDB/Util/FormHTML.pm
+++ b/lib/VNDB/Util/FormHTML.pm
@@ -49,7 +49,8 @@ my %formerr_exeptions = (
usrexists => 'Someone already has this username, please choose something else',
mailexists => 'Someone already registered with that email address',
noimage => 'Image must be in JPEG or PNG format',
- toolarge => 'Image is too large, only 50kB allowed',
+ toolarge => 'Image is too large, only 500kB allowed',
+ oneaday => 'You can only register one account from the same IP within 24 hours',
);
diff --git a/lib/VNDB/Util/LayoutHTML.pm b/lib/VNDB/Util/LayoutHTML.pm
index a8773894..ccf2a9c6 100644
--- a/lib/VNDB/Util/LayoutHTML.pm
+++ b/lib/VNDB/Util/LayoutHTML.pm
@@ -12,8 +12,8 @@ our @EXPORT = qw|htmlHeader htmlFooter|;
sub htmlHeader { # %options->{ title, js, noindex, search }
my($self, %o) = @_;
- my $skin = $self->authInfo->{skin} || $self->{skin_default};
- $skin = $self->{skin_default} if !-d "$VNDB::ROOT/static/s/$skin";
+ my $skin = $self->reqParam('skin') || $self->authInfo->{skin} || $self->{skin_default};
+ $skin = $self->{skin_default} if !$self->{skins}{$skin} || !-d "$VNDB::ROOT/static/s/$skin";
# heading
html;
@@ -27,12 +27,16 @@ sub htmlHeader { # %options->{ title, js, noindex, search }
script type => 'text/javascript', src => $self->{url_static}.'/f/script.js?'.$self->{version};
# most browsers don't like a self-closing <script> tag...
end;
+ if($self->authInfo->{customcss}) {
+ (my $css = $self->authInfo->{customcss}) =~ s/\n/ /g;
+ style type => 'text/css', $css;
+ }
meta name => 'robots', content => 'noindex, follow', undef if $o{noindex};
end;
body;
div id => 'bgright', ' ';
div id => 'header';
- h1 $self->debug ? (class => 'debug') : ();
+ h1;
a href => '/', lc $self->{site_title};
end;
end;
@@ -118,14 +122,13 @@ sub _menu {
[ threads => 'Threads' ],
[ posts => 'Posts' ],
);
- my $stats = $self->dbStats;
div class => 'menubox';
h2 'Database Statistics';
div;
dl;
for (@stats) {
dt $$_[1];
- dd $stats->{$$_[0]};
+ dd $self->{stats}{$$_[0]};
}
end;
clearfloat;
@@ -141,9 +144,19 @@ sub htmlFooter {
txt "vndb $self->{version} | ";
a href => '/d7', 'about us';
txt ' | ';
- a href => 'mailto:contact@vndb.org', 'contact@vndb.org';
+ a href => "mailto:$self->{admin_email}", $self->{admin_email};
+ txt ' | ';
+ a href => $self->{source_url}, 'source';
end;
end; # /div maincontent
+ if($self->debug) {
+ div id => 'debug';
+ h2 'This is not VNDB!';
+ txt 'The real VNDB is ';
+ a href => 'http://vndb.org/', 'here';
+ txt '.';
+ end;
+ }
end; # /body
end; # /html
diff --git a/lib/VNDB/Util/Misc.pm b/lib/VNDB/Util/Misc.pm
index 94cdcd1e..139eb571 100644
--- a/lib/VNDB/Util/Misc.pm
+++ b/lib/VNDB/Util/Misc.pm
@@ -6,7 +6,7 @@ use warnings;
use Exporter 'import';
use Tie::ShareLite ':lock';
-our @EXPORT = qw|multiCmd|;
+our @EXPORT = qw|multiCmd vnCacheUpdate|;
# Sends a command to Multi
@@ -26,3 +26,25 @@ sub multiCmd {
$s->unlock();
$self->{_multiCmd} = [];
}
+
+
+# Recalculates the vn.c_* columns and regenerates the related relation graphs on any change
+# Arguments: list of vids to be updated
+sub vnCacheUpdate {
+ my($self, @vns) = @_;
+
+ my $before = $self->dbVNGet(id => \@vns, order => 'v.id', what => 'relations');
+ $self->dbVNCache(@vns);
+ my $after = $self->dbVNGet(id => \@vns, order => 'v.id');
+
+ my @upd = map {
+ @{$before->[$_]{relations}} && (
+ $before->[$_]{c_released} != $after->[$_]{c_released}
+ || $before->[$_]{c_languages} ne $after->[$_]{c_languages}
+ ) ? $before->[$_]{id} : ();
+ } 0..$#$before;
+ $self->multiCmd('relgraph '.join(' ', @upd)) if @upd;
+}
+
+
+1;
diff --git a/static/f/forms.js b/static/f/forms.js
index cd65058d..e25a880c 100644
--- a/static/f/forms.js
+++ b/static/f/forms.js
@@ -126,7 +126,7 @@ function dsKeyDown(ev) {
if(obj.selectedId != 0)
obj.value = obj.serFunc(x('ds_box_'+obj.selectedId).itemData);
- else if(obj.returnFunc)
+ if(obj.returnFunc)
obj.returnFunc();
if(x('ds_box'))
x('ds_box').style.top = '-500px';
@@ -234,6 +234,8 @@ function dsResults(hr, obj) {
};
tr.onclick = function() {
obj.value = obj.serFunc(this.itemData);
+ if(obj.returnFunc)
+ obj.returnFunc();
if(x('ds_box'))
x('ds_box').style.top = '-500px';
obj.selectedId = 0;
diff --git a/static/s/angel/conf b/static/s/angel/conf
index 72df41b0..f554cec3 100644
--- a/static/s/angel/conf
+++ b/static/s/angel/conf
@@ -10,7 +10,7 @@ statnok #c00 // generoc 'not ok' text color (used for above, and as border
footer #135 // text color of the footer
// titles
-maintitle #135 // text color of the site title
+maintitle #135 // text color of the site title, set to '0' to hide the main title
boxtitle #258 // box titles
alttitle #fff // alternative title
diff --git a/util/dump.sql b/util/dump.sql
index 719f0f75..f23d6d62 100644
--- a/util/dump.sql
+++ b/util/dump.sql
@@ -103,7 +103,8 @@ CREATE TABLE releases_rev (
released integer NOT NULL,
notes text NOT NULL DEFAULT '',
minage smallint NOT NULL DEFAULT -1,
- gtin bigint NOT NULL DEFAULT 0
+ gtin bigint NOT NULL DEFAULT 0,
+ patch boolean NOT NULL DEFAULT FALSE
);
-- releases_vn
@@ -185,7 +186,9 @@ CREATE TABLE users (
show_list boolean NOT NULL DEFAULT TRUE,
c_votes integer NOT NULL DEFAULT 0,
c_changes integer NOT NULL DEFAULT 0,
- skin varchar(128) NOT NULL DEFAULT ''
+ skin varchar(128) NOT NULL DEFAULT '',
+ customcss text NOT NULL DEFAULT '',
+ ip inet NOT NULL DEFAULT '0.0.0.0'
);
-- vn
@@ -197,7 +200,8 @@ CREATE TABLE vn (
rgraph integer,
c_released integer NOT NULL DEFAULT 0,
c_languages varchar(32) NOT NULL DEFAULT '',
- c_platforms varchar(32) NOT NULL DEFAULT ''
+ c_platforms varchar(32) NOT NULL DEFAULT '',
+ c_popularity real NOT NULL DEFAULT 0
);
-- vn_anime
@@ -411,6 +415,18 @@ END;
$$ LANGUAGE plpgsql;
+-- recalculate vn.c_popularity
+CREATE OR REPLACE FUNCTION update_vnpopularity() RETURNS void AS $$
+BEGIN
+ CREATE OR REPLACE TEMP VIEW tmp_pop1 (uid, vid, rank) AS
+ SELECT v.uid, v.vid, sqrt(count(*))::real FROM votes v JOIN votes v2 ON v.uid = v2.uid AND v2.vote < v.vote GROUP BY v.vid, v.uid;
+ CREATE OR REPLACE TEMP VIEW tmp_pop2 (vid, win) AS
+ SELECT vid, sum(rank) FROM tmp_pop1 GROUP BY vid;
+ UPDATE vn SET c_popularity = COALESCE((SELECT win/(SELECT MAX(win) FROM tmp_pop2) FROM tmp_pop2 WHERE vid = id), 0);
+ RETURN;
+END;
+$$ LANGUAGE plpgsql;
+
diff --git a/util/skingen.pl b/util/skingen.pl
index 9c06b077..e27ea4a1 100755
--- a/util/skingen.pl
+++ b/util/skingen.pl
@@ -27,6 +27,7 @@ sub readskin { # skin name
open my $F, '<', $ROOT.'/static/s/'.$name.'/conf' or die $!;
while(<$F>) {
chomp;
+ s/\r//g;
s{[\t\s]*//.+$}{};
next if !/^([a-z0-9]+)[\t\s]+(.+)$/;
$o{$1} = $2;
@@ -60,6 +61,8 @@ sub writeskin { # $obj
$o->{_bodybg} = "background: $o->{bodybg} url($o->{imglefttop}) no-repeat";
}
+ # main title
+ $o->{_maintitle} = $o->{maintitle} ? "color: $o->{maintitle}" : 'display: none';
# create boxbg.png
my $img = Image::Magick->new(size => '1x1');
@@ -74,7 +77,7 @@ sub writeskin { # $obj
$o->{_blendbg} = '#'.join '', map sprintf('%02x', $_*255), $img->GetPixel(x=>1,y=>1);
# write the CSS
- open my $CSS, '<', "$ROOT/data/skingen/style.css" or die $!;
+ open my $CSS, '<', "$ROOT/data/style.css" or die $!;
open my $SKIN, '>', "$ROOT/static/s/$o->{_name}/style.css" or die $!;
while((my $d = <$CSS>)) {
if($O{debug}) {
diff --git a/util/updates/update_2.2.sql b/util/updates/update_2.2.sql
new file mode 100644
index 00000000..d16c4bf0
--- /dev/null
+++ b/util/updates/update_2.2.sql
@@ -0,0 +1,36 @@
+
+-- custom CSS
+ALTER TABLE users ADD COLUMN customcss text NOT NULL DEFAULT '';
+
+
+
+-- patch flag
+ALTER TABLE releases_rev ADD COLUMN patch BOOLEAN NOT NULL DEFAULT FALSE;
+UPDATE releases_rev SET patch = TRUE
+ WHERE EXISTS(SELECT 1 FROM releases_media rm WHERE rm.rid = id AND rm.medium = 'pa ');
+DELETE FROM releases_media WHERE medium = 'pa ';
+
+
+
+-- popularity calculation
+ALTER TABLE vn ADD COLUMN c_popularity real NOT NULL DEFAULT 0;
+
+CREATE OR REPLACE FUNCTION update_vnpopularity() RETURNS void AS $$
+BEGIN
+ CREATE OR REPLACE TEMP VIEW tmp_pop1 (uid, vid, rank) AS
+ SELECT v.uid, v.vid, sqrt(count(*))::real FROM votes v JOIN votes v2 ON v.uid = v2.uid AND v2.vote < v.vote GROUP BY v.vid, v.uid;
+ CREATE OR REPLACE TEMP VIEW tmp_pop2 (vid, win) AS
+ SELECT vid, sum(rank) FROM tmp_pop1 GROUP BY vid;
+ UPDATE vn SET c_popularity = COALESCE((SELECT win/(SELECT MAX(win) FROM tmp_pop2) FROM tmp_pop2 WHERE vid = id), 0);
+ RETURN;
+END;
+$$ LANGUAGE plpgsql;
+
+SELECT update_vnpopularity();
+
+
+
+-- store the IP address used to register
+ALTER TABLE users ADD COLUMN ip inet NOT NULL DEFAULT '0.0.0.0';
+
+
diff --git a/util/vndb.pl b/util/vndb.pl
index a9ac36b4..ca61836f 100755
--- a/util/vndb.pl
+++ b/util/vndb.pl
@@ -52,6 +52,9 @@ sub reqinit {
$ENV{HTTP_REFERER} = $ENV{REQUEST_URI};
$ENV{REQUEST_URI} = '/we-dont-like-ie6';
}
+
+ # load some stats (used for about all pageviews, anyway)
+ $self->{stats} = $self->dbStats;
}
@@ -80,26 +83,30 @@ sub handle404 {
sub readskins {
my %skins; # dirname => skin name
- my $regen = 0;
- my $lasttemplate = [stat "$ROOT/data/skingen/style.css"]->[9];
+ my @regen;
+ my $lasttemplate = [stat "$ROOT/data/style.css"]->[9];
for my $f (glob "$ROOT/static/s/*") {
+ next if !-e "$f/conf";
my $n = $1 if $f =~ m{([^/]+)$};
open my $F, '<', "$f/conf" or die $!;
while(<$F>) {
chomp;
+ s/\r//;
s{[\t\s]*//.*$}{};
next if !/^name[\t\s]+(.+)$/;
$skins{$n} = $1;
last;
}
close $F;
+ next if !$skins{$n};
- my $lastgen = [stat "$f/style.css"]->[9];
- $regen = 1 if (!-f "$f/style.css" && -x $f)
- || ([stat "$f/conf"]->[9] > $lastgen || $lasttemplate > $lastgen) && -w "$f/style.css";
+ my $css = -f "$f/style.css" && [stat "$f/style.css"]->[9] || 0;
+ my $boxbg = -f "$f/boxbg.png" && [stat "$f/boxbg.png"]->[9] || 0;
+ my $lastgen = $css < $boxbg ? $css : $boxbg;
+ push @regen, $n if (!$lastgen && -x $f && (!$css && !$boxbg || $css && -w "$f/style.css" || $boxbg && -w "$f/boxbg.png"))
+ || ([stat "$f/conf"]->[9] > $lastgen || $lasttemplate > $lastgen) && -w "$f/style.css" && -w "$f/boxbg.png";
}
- # note: this only works if the current process has write access to the skins
- `$ROOT/util/skingen.pl` if $regen;
+ system "$ROOT/util/skingen.pl", @regen if @regen;
return \%skins;
}