pingus-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Pingus-CVS] rev 2231 - in trunk/contrib: . level_comment_tool level_com


From: address@hidden
Subject: [Pingus-CVS] rev 2231 - in trunk/contrib: . level_comment_tool level_comment_tool/data level_comment_tool/gfx level_comment_tool/gfx/actions
Date: Fri, 09 Apr 2004 16:04:34 +0200

Author: torangan
Date: 2004-04-09 16:04:34 +0200 (Fri, 09 Apr 2004)
New Revision: 2231

Added:
   trunk/contrib/level_comment_tool/
   trunk/contrib/level_comment_tool/COPYING
   trunk/contrib/level_comment_tool/README
   trunk/contrib/level_comment_tool/data/
   trunk/contrib/level_comment_tool/data/levels/
   trunk/contrib/level_comment_tool/default.css
   trunk/contrib/level_comment_tool/file-assoc-help.html
   trunk/contrib/level_comment_tool/gfx/
   trunk/contrib/level_comment_tool/gfx/actions/
   trunk/contrib/level_comment_tool/gfx/actions/basher.png
   trunk/contrib/level_comment_tool/gfx/actions/blocker.png
   trunk/contrib/level_comment_tool/gfx/actions/boarder.png
   trunk/contrib/level_comment_tool/gfx/actions/bomber.png
   trunk/contrib/level_comment_tool/gfx/actions/bridger.png
   trunk/contrib/level_comment_tool/gfx/actions/climber.png
   trunk/contrib/level_comment_tool/gfx/actions/digger.png
   trunk/contrib/level_comment_tool/gfx/actions/floater.png
   trunk/contrib/level_comment_tool/gfx/actions/jumper.png
   trunk/contrib/level_comment_tool/gfx/actions/miner.png
   trunk/contrib/level_comment_tool/gfx/actions/rocketlauncher.png
   trunk/contrib/level_comment_tool/gfx/actions/slider.png
   trunk/contrib/level_comment_tool/gfx/actions/stopper.png
   trunk/contrib/level_comment_tool/gfx/actions/superman.png
   trunk/contrib/level_comment_tool/gfx/actions/waiter.png
   trunk/contrib/level_comment_tool/index.php
   trunk/contrib/level_comment_tool/level-cache.inc
   trunk/contrib/level_comment_tool/mail-settings.inc
   trunk/contrib/level_comment_tool/play_on-2.png
   trunk/contrib/level_comment_tool/xml-search.inc
Log:
added level comment tool


Added: trunk/contrib/level_comment_tool/COPYING
===================================================================
--- trunk/contrib/level_comment_tool/COPYING    2004-04-09 12:43:44 UTC (rev 
2230)
+++ trunk/contrib/level_comment_tool/COPYING    2004-04-09 14:04:34 UTC (rev 
2231)
@@ -0,0 +1,340 @@
+                   GNU GENERAL PUBLIC LICENSE
+                      Version 2, June 1991
+
+ Copyright (C) 1989, 1991 Free Software Foundation, Inc.
+     59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+                           Preamble
+
+  The licenses for most software are designed to take away your
+freedom to share and change it.  By contrast, the GNU General Public
+License is intended to guarantee your freedom to share and change free
+software--to make sure the software is free for all its users.  This
+General Public License applies to most of the Free Software
+Foundation's software and to any other program whose authors commit to
+using it.  (Some other Free Software Foundation software is covered by
+the GNU Library General Public License instead.)  You can apply it to
+your programs, too.
+
+  When we speak of free software, we are referring to freedom, not
+price.  Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+this service if you wish), that you receive source code or can get it
+if you want it, that you can change the software or use pieces of it
+in new free programs; and that you know you can do these things.
+
+  To protect your rights, we need to make restrictions that forbid
+anyone to deny you these rights or to ask you to surrender the rights.
+These restrictions translate to certain responsibilities for you if you
+distribute copies of the software, or if you modify it.
+
+  For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must give the recipients all the rights that
+you have.  You must make sure that they, too, receive or can get the
+source code.  And you must show them these terms so they know their
+rights.
+
+  We protect your rights with two steps: (1) copyright the software, and
+(2) offer you this license which gives you legal permission to copy,
+distribute and/or modify the software.
+
+  Also, for each author's protection and ours, we want to make certain
+that everyone understands that there is no warranty for this free
+software.  If the software is modified by someone else and passed on, we
+want its recipients to know that what they have is not the original, so
+that any problems introduced by others will not reflect on the original
+authors' reputations.
+
+  Finally, any free program is threatened constantly by software
+patents.  We wish to avoid the danger that redistributors of a free
+program will individually obtain patent licenses, in effect making the
+program proprietary.  To prevent this, we have made it clear that any
+patent must be licensed for everyone's free use or not licensed at all.
+
+  The precise terms and conditions for copying, distribution and
+modification follow.
+
+                   GNU GENERAL PUBLIC LICENSE
+   TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+  0. This License applies to any program or other work which contains
+a notice placed by the copyright holder saying it may be distributed
+under the terms of this General Public License.  The "Program", below,
+refers to any such program or work, and a "work based on the Program"
+means either the Program or any derivative work under copyright law:
+that is to say, a work containing the Program or a portion of it,
+either verbatim or with modifications and/or translated into another
+language.  (Hereinafter, translation is included without limitation in
+the term "modification".)  Each licensee is addressed as "you".
+
+Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope.  The act of
+running the Program is not restricted, and the output from the Program
+is covered only if its contents constitute a work based on the
+Program (independent of having been made by running the Program).
+Whether that is true depends on what the Program does.
+
+  1. You may copy and distribute 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 and disclaimer of warranty; keep intact all the
+notices that refer to this License and to the absence of any warranty;
+and give any other recipients of the Program a copy of this License
+along with the Program.
+
+You may charge a fee for the physical act of transferring a copy, and
+you may at your option offer warranty protection in exchange for a fee.
+
+  2. You may modify your copy or copies of the Program or any portion
+of it, thus forming a work based on the Program, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+    a) You must cause the modified files to carry prominent notices
+    stating that you changed the files and the date of any change.
+
+    b) You must cause any work that you distribute or publish, that in
+    whole or in part contains or is derived from the Program or any
+    part thereof, to be licensed as a whole at no charge to all third
+    parties under the terms of this License.
+
+    c) If the modified program normally reads commands interactively
+    when run, you must cause it, when started running for such
+    interactive use in the most ordinary way, to print or display an
+    announcement including an appropriate copyright notice and a
+    notice that there is no warranty (or else, saying that you provide
+    a warranty) and that users may redistribute the program under
+    these conditions, and telling the user how to view a copy of this
+    License.  (Exception: if the Program itself is interactive but
+    does not normally print such an announcement, your work based on
+    the Program is not required to print an announcement.)
+
+These requirements apply to the modified work as a whole.  If
+identifiable sections of that work are not derived from the Program,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works.  But when you
+distribute the same sections as part of a whole which is a work based
+on the Program, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Program.
+
+In addition, mere aggregation of another work not based on the Program
+with the Program (or with a work based on the Program) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+  3. You may copy and distribute the Program (or a work based on it,
+under Section 2) in object code or executable form under the terms of
+Sections 1 and 2 above provided that you also do one of the following:
+
+    a) Accompany it with the complete corresponding machine-readable
+    source code, which must be distributed under the terms of Sections
+    1 and 2 above on a medium customarily used for software interchange; or,
+
+    b) Accompany it with a written offer, valid for at least three
+    years, to give any third party, for a charge no more than your
+    cost of physically performing source distribution, a complete
+    machine-readable copy of the corresponding source code, to be
+    distributed under the terms of Sections 1 and 2 above on a medium
+    customarily used for software interchange; or,
+
+    c) Accompany it with the information you received as to the offer
+    to distribute corresponding source code.  (This alternative is
+    allowed only for noncommercial distribution and only if you
+    received the program in object code or executable form with such
+    an offer, in accord with Subsection b above.)
+
+The source code for a work means the preferred form of the work for
+making modifications to it.  For an executable work, complete source
+code means all the source code for all modules it contains, plus any
+associated interface definition files, plus the scripts used to
+control compilation and installation of the executable.  However, as a
+special exception, the source code distributed need not include
+anything that is normally distributed (in either source or binary
+form) with the major components (compiler, kernel, and so on) of the
+operating system on which the executable runs, unless that component
+itself accompanies the executable.
+
+If distribution of executable or object code is made by offering
+access to copy from a designated place, then offering equivalent
+access to copy the source code from the same place counts as
+distribution of the source code, even though third parties are not
+compelled to copy the source along with the object code.
+
+  4. You may not copy, modify, sublicense, or distribute the Program
+except as expressly provided under this License.  Any attempt
+otherwise to copy, modify, sublicense or distribute the Program is
+void, and will automatically terminate your rights under this License.
+However, parties who have received copies, or rights, from you under
+this License will not have their licenses terminated so long as such
+parties remain in full compliance.
+
+  5. You are not required to accept this License, since you have not
+signed it.  However, nothing else grants you permission to modify or
+distribute the Program or its derivative works.  These actions are
+prohibited by law if you do not accept this License.  Therefore, by
+modifying or distributing the Program (or any work based on the
+Program), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Program or works based on it.
+
+  6. Each time you redistribute the Program (or any work based on the
+Program), the recipient automatically receives a license from the
+original licensor to copy, distribute or modify the Program subject to
+these terms and conditions.  You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties to
+this License.
+
+  7. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+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
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Program at all.  For example, if a patent
+license would not permit royalty-free redistribution of the Program by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Program.
+
+If any portion of this section is held invalid or unenforceable under
+any particular circumstance, the balance of the section is intended to
+apply and the section as a whole is intended to apply in other
+circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system, which is
+implemented by public license practices.  Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+
+  8. If the distribution and/or use of the Program is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Program under this License
+may add an explicit geographical distribution limitation excluding
+those countries, so that distribution is permitted only in or among
+countries not thus excluded.  In such case, this License incorporates
+the limitation as if written in the body of this License.
+
+  9. The Free Software Foundation may publish revised and/or new versions
+of the 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 a version number of this License which applies to it and "any
+later version", you have the option of following the terms and conditions
+either of that version or of any later version published by the Free
+Software Foundation.  If the Program does not specify a version number of
+this License, you may choose any version ever published by the Free Software
+Foundation.
+
+  10. If you wish to incorporate parts of the Program into other free
+programs whose distribution conditions are different, write to the author
+to ask for permission.  For software which is copyrighted by the Free
+Software Foundation, write to the Free Software Foundation; we sometimes
+make exceptions for this.  Our decision will be guided by the two goals
+of preserving the free status of all derivatives of our free software and
+of promoting the sharing and reuse of software generally.
+
+                           NO WARRANTY
+
+  11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, 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.
+
+  12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
+REDISTRIBUTE 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.
+
+                    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
+convey 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 General Public License as published by
+    the Free Software Foundation; either version 2 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+
+
+Also add information on how to contact you by electronic and paper mail.
+
+If the program is interactive, make it output a short notice like this
+when it starts in an interactive mode:
+
+    Gnomovision version 69, Copyright (C) year  name of author
+    Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+    This is free software, and you are welcome to redistribute it
+    under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate
+parts of the General Public License.  Of course, the commands you use may
+be called something other than `show w' and `show c'; they could even be
+mouse-clicks or menu items--whatever suits your program.
+
+You should also get your employer (if you work as a programmer) or your
+school, if any, to sign a "copyright disclaimer" for the program, if
+necessary.  Here is a sample; alter the names:
+
+  Yoyodyne, Inc., hereby disclaims all copyright interest in the program
+  `Gnomovision' (which makes passes at compilers) written by James Hacker.
+
+  <signature of Ty Coon>, 1 April 1989
+  Ty Coon, President of Vice
+
+This General Public License does not permit incorporating your program into
+proprietary programs.  If your program is a subroutine library, you may
+consider it more useful to permit linking proprietary applications with the
+library.  If this is what you want to do, use the GNU Library General
+Public License instead of this License.

Added: trunk/contrib/level_comment_tool/README
===================================================================
--- trunk/contrib/level_comment_tool/README     2004-04-09 12:43:44 UTC (rev 
2230)
+++ trunk/contrib/level_comment_tool/README     2004-04-09 14:04:34 UTC (rev 
2231)
@@ -0,0 +1,38 @@
+Pingus Level Feedback System
+
+Installing:
+
+  1) Make sure you have installed
+     Apache and PHP 4.2+
+
+  2) Uncompress the tar into a directory where Apache
+     can see it.
+
+  3) Create directory 'comments' where the script will
+     write the xml comment files and MAKE IT WRITABLE
+     for Apache.
+
+  4) Create directory 'data' and copy Pingus source directories
+     'levels' into it.
+
+  5) Tweak your .htaccess - you might want to deny from all
+     comments/* and add "AddType application/pingus-level plf"
+
+Copyright
+
+Pingus Level Feedback System is (c) 2003 by Jarno Elonen
+
+  This program is free software; you can redistribute it and/or
+  modify it under the terms of the GNU General Public License
+  as published by the Free Software Foundation; either version 2
+  of the License, or (at your option) any later version.
+
+  This program is distributed in the hope that it will be useful,
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+  GNU General Public License for more details.
+
+  You should have received a copy of the GNU General Public License
+  along with this program; if not, write to the Free Software
+  Foundation, Inc., 59 Temple Place - Suite 330, Boston,
+  MA  02111-1307, USA.

Added: trunk/contrib/level_comment_tool/default.css
===================================================================
--- trunk/contrib/level_comment_tool/default.css        2004-04-09 12:43:44 UTC 
(rev 2230)
+++ trunk/contrib/level_comment_tool/default.css        2004-04-09 14:04:34 UTC 
(rev 2231)
@@ -0,0 +1,187 @@
+/* */
+
+h1,h2,h3,h4
+{
+  font-family: Sans-Serif;
+  margin-top: 0px;
+}
+
+h1
+{
+        background: #607f9b;
+        color: white;
+        border-style: solid;
+        border-color: black;
+       padding-left: 1em;
+        margin-top: 0px;
+        margin-bottom: .5em;
+}
+
+div.menu
+{
+        width: 205px;
+        margin-top: 10px;
+}
+
+div.menu a
+{
+       text-decoration: none;
+}
+
+a.menuitem:hover
+{
+        color: black;
+        background-color: #E0FfFF;
+}
+
+a.menuitem:visited
+{
+        color: black;
+}
+
+a.currentmenuitem:hover
+{
+        color:black;
+}
+
+
+a.currentmenuitem:visited
+{
+        color:black;
+}
+
+
+a.currentmenuitem
+{
+       font-size: 18px;
+       font-family: Sans-Serif;
+       text-align: center;
+        border-color: black;
+        border-style: solid;
+        border-width: thin;
+        background-color: #FFFFFF;
+        background-repeat: repeat-y;
+        color: black;        
+        padding: 5px 0px 5px 0px;
+        display: block;
+        margin: 10px 15px 10px 15px;
+}
+
+a.menuitem
+{
+       font-size: 18px;
+       font-family: Sans-Serif;
+       text-align: center;
+
+        border-color: black;
+        border-style: solid;
+        border-width: thin;
+        background-color: #607f9b;
+/*     background-image: url(images/menubackground.png);*/
+        background-repeat: repeat-y;
+        color: black;        
+        padding: 5px 0px 5px 0px;
+        display: block;
+        margin: 10px 15px 10px 15px;
+}
+
+div.mainbody
+{
+        background-color: silver;
+        color: black;
+        border-color: black;
+        border-style: solid;
+        padding: 1em;
+}
+
+p.warning {
+        font-size: 1.5em;
+        color: red;
+        background-color: black;
+       font-family: Sans-Serif;
+        border-style: solid;
+        border-color: red;
+        padding: .3em;
+}
+
+p.warning a {
+        color: red;
+}
+
+p.message {
+       background: gray;
+       border-style: dotted;
+       border-color: black;
+       border-width: 1px;
+       color: white;
+       padding-left: 1em;
+}
+
+table.question {
+       font-family: Sans-Serif;
+        background: #607f9b;
+        border-style: solid;
+        border-width: thin;
+        border-color: black;
+        color: white;
+        padding-left: 1em;
+}
+
+P.answer {
+        color: black;
+}
+
+TT.irc {
+        color: rgb(0,0,150);
+}
+
+TT.command {
+        color: rgb(200, 0, 0);
+}
+
+img
+{
+        border-style: none;
+}
+
+img.screenshot {
+        border-style: solid;
+        border-width: medium;
+}
+
+a img.screenshot {
+        border-color: red;
+}
+
+a:visited img.screenshot {
+        border-color: gray;
+}
+
+
+a:hover img.screenshot {
+        border-color: white;
+}
+
+
+a:visited {
+        color: rgb(0,0,100);
+}
+
+a:hover {
+        color: white;
+}
+
+a {
+        color: rgb(50,50,200);
+}
+
+
+body
+{
+       background-position: left top;
+       background-image: url(images/snow_background.jpg);
+       background-repeat: repeat-x;
+       background-color: #707f9b;
+        color: black;
+ /* desert #cdb09e; */
+}

Added: trunk/contrib/level_comment_tool/file-assoc-help.html
===================================================================
--- trunk/contrib/level_comment_tool/file-assoc-help.html       2004-04-09 
12:43:44 UTC (rev 2230)
+++ trunk/contrib/level_comment_tool/file-assoc-help.html       2004-04-09 
14:04:34 UTC (rev 2231)
@@ -0,0 +1,71 @@
+<html>
+  <head>
+    <title>Configuring browsers to test Pingus levels</title>
+  </head>
+  <body bgcolor="#ffffcc">
+    <p><big><strong>Configuring browsers to test Pingus 
levels</strong></big></p>
+
+    <p>When you click on the <em>play</em>-link, the Pingus level comment
+    system tells your web browser that the file it is about to download is
+    of MIME type <code>application/pingus-level</code>. To make it convenient
+    to test the levels, you should configure your browser to launch Pingus
+    automatically. Here's how:</p>
+
+    <p><strong><em>Mozilla / Netscape:</strong></em></p>
+
+    <ol>
+      <li>Click on a 'play' link</li>
+      <li>Pick "Open it with" and browse for Pingus executable</li>
+      <li>(OPTIONAL) Pingus levels don't contain any potentially dangerous
+      executable scripts so you might want to make sure "always show this
+      dialog before handling files of this type" is *not* checked</li>
+      <li>Click OK</li>
+    </ol>
+
+    <p>ALTERNATIVELY: choose from the menu Edit / Preferences /
+    Navigator / Helper Applications / New Type, add...</p>
+    <ul>
+      <li>MIME type "application/pingus-level"</li>
+      <li>Extension "plf" and</li>
+      <li>Open it with "&lt;path and name of pingus executable&gt;".</li>
+    </ul>
+    <p>...and click OK.</p>
+
+    <p><strong><em>Konqueror:</strong></em></p>
+
+    <ol>
+      <li>Open Settings / Configure Konqueror / File Associations</li>
+      <li>Click 'Add'</li>
+      <li>Select 'application' as Group and type "pingus-level" as Type 
name.</li>
+      <li>Click OK</li>
+      <li>Click Filename Patterns / Add</li>
+      <li>Type "*.plf" and click OK</li>
+      <li>Click Application Preference Order / Add</li>
+      <li>Browse for or type the path to Pingus executable</li>
+      <li>Click OK</li>
+      <li>(OPTIONAL) Write a "Pingus level" (or anything) as Description and 
choose a nice icon</li>
+      <li>Click Apply or OK</li>
+    </ol>
+
+    <p>You can now also click level files on local disk to try them out.</p>
+
+    <p><strong><em>Internet Explorer:</strong></em></p>
+
+    <p>(Written on a non-english XP workstation; your mileage may vary)</p>
+
+    <ol>
+      <li>Click on a 'play' link</li>
+      <li>Don't save the file, but rather Open/View it with an application</li>
+      <li>Opt to pick an application manually</li>
+      <li>(OPTIONAL) Pingus levels don't contain any potentially dangerous 
executable
+      scripts so you might want to clear the "warn before opening" 
checkbox</li>
+      <li>Click OK</li>
+      <li>Find Pingus with "browse" if it's not already listed</li>
+      <li>Make sure "always open this type of files in selected
+      application" (or something similar) is checked</li>
+      <li>Click OK</li>
+    </ol>
+
+
+  </body>
+</html>

Added: trunk/contrib/level_comment_tool/gfx/actions/basher.png
===================================================================
(Binary files differ)


Property changes on: trunk/contrib/level_comment_tool/gfx/actions/basher.png
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: trunk/contrib/level_comment_tool/gfx/actions/blocker.png
===================================================================
(Binary files differ)


Property changes on: trunk/contrib/level_comment_tool/gfx/actions/blocker.png
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: trunk/contrib/level_comment_tool/gfx/actions/boarder.png
===================================================================
(Binary files differ)


Property changes on: trunk/contrib/level_comment_tool/gfx/actions/boarder.png
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: trunk/contrib/level_comment_tool/gfx/actions/bomber.png
===================================================================
(Binary files differ)


Property changes on: trunk/contrib/level_comment_tool/gfx/actions/bomber.png
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: trunk/contrib/level_comment_tool/gfx/actions/bridger.png
===================================================================
(Binary files differ)


Property changes on: trunk/contrib/level_comment_tool/gfx/actions/bridger.png
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: trunk/contrib/level_comment_tool/gfx/actions/climber.png
===================================================================
(Binary files differ)


Property changes on: trunk/contrib/level_comment_tool/gfx/actions/climber.png
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: trunk/contrib/level_comment_tool/gfx/actions/digger.png
===================================================================
(Binary files differ)


Property changes on: trunk/contrib/level_comment_tool/gfx/actions/digger.png
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: trunk/contrib/level_comment_tool/gfx/actions/floater.png
===================================================================
(Binary files differ)


Property changes on: trunk/contrib/level_comment_tool/gfx/actions/floater.png
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: trunk/contrib/level_comment_tool/gfx/actions/jumper.png
===================================================================
(Binary files differ)


Property changes on: trunk/contrib/level_comment_tool/gfx/actions/jumper.png
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: trunk/contrib/level_comment_tool/gfx/actions/miner.png
===================================================================
(Binary files differ)


Property changes on: trunk/contrib/level_comment_tool/gfx/actions/miner.png
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: trunk/contrib/level_comment_tool/gfx/actions/rocketlauncher.png
===================================================================
(Binary files differ)


Property changes on: 
trunk/contrib/level_comment_tool/gfx/actions/rocketlauncher.png
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: trunk/contrib/level_comment_tool/gfx/actions/slider.png
===================================================================
(Binary files differ)


Property changes on: trunk/contrib/level_comment_tool/gfx/actions/slider.png
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: trunk/contrib/level_comment_tool/gfx/actions/stopper.png
===================================================================
(Binary files differ)


Property changes on: trunk/contrib/level_comment_tool/gfx/actions/stopper.png
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: trunk/contrib/level_comment_tool/gfx/actions/superman.png
===================================================================
(Binary files differ)


Property changes on: trunk/contrib/level_comment_tool/gfx/actions/superman.png
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: trunk/contrib/level_comment_tool/gfx/actions/waiter.png
===================================================================
(Binary files differ)


Property changes on: trunk/contrib/level_comment_tool/gfx/actions/waiter.png
___________________________________________________________________
Name: svn:executable
   + *
Name: svn:mime-type
   + application/octet-stream

Added: trunk/contrib/level_comment_tool/index.php
===================================================================
--- trunk/contrib/level_comment_tool/index.php  2004-04-09 12:43:44 UTC (rev 
2230)
+++ trunk/contrib/level_comment_tool/index.php  2004-04-09 14:04:34 UTC (rev 
2231)
@@ -0,0 +1,516 @@
+<?
+//  Pingus Level Feedback system
+//  Copyright (C) 2003 by Jarno Elonen <address@hidden>
+//
+//  This program is free software; you can redistribute it and/or
+//  modify it under the terms of the GNU General Public License
+//  as published by the Free Software Foundation; either version 2
+//  of the License, or (at your option) any later version.
+//
+//  This program is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+//  GNU General Public License for more details.
+//
+//  You should have received a copy of the GNU General Public License
+//  along with this program; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+
+require_once("xml-search.inc");
+require_once("level-cache.inc");
+require_once("mail-settings.inc");
+
+// ==================================================================
+// Admin login.
+// ==================================================================
+$admin_passwd = "testadmin";
+$is_admin = ($_SERVER['PHP_AUTH_PW'] === $admin_passwd);
+if ( isset($_GET["adminlogin"]))
+{
+  if (!isset($_SERVER['PHP_AUTH_USER']))
+  {
+    header('WWW-Authenticate: Basic realm="Pingus Feedback Admin"');
+    header('HTTP/1.0 401 Unauthorized');
+    echo 'Cancelled. Hit Back.';
+    exit;
+  }
+  else
+  {
+    if ( !isset($_SERVER['PHP_AUTH_PW']) ||
+      $_SERVER['PHP_AUTH_PW'] != $admin_passwd )
+    {
+      header('HTTP/1.0 401 Unauthorized');
+      echo 'Wrong password. Hit Back.';
+      exit;
+    }
+    else
+      $is_admin = True;
+  }
+}
+
+// ==================================================================
+// Thumbnail magick with cookies etc.
+// ==================================================================
+if (isset($_GET["showthumbs"]))
+{
+  $show_thumbs = $_GET["showthumbs"];
+  if (!isset($_COOKIE["showthumbs"]) || $_COOKIE["showthumbs"] != $show_thumbs 
)
+    setCookie( "showthumbs", $_GET["showthumbs"], time()+3600*24 );
+}
+else if ( isset($_COOKIE["showthumbs"]) )
+  $show_thumbs = $_COOKIE["showthumbs"];
+
+// ==================================================================
+
+?>
+<html>
+  <head>
+    <title>Pingus level feedback database</title>
+    <link rel="stylesheet" type="text/css" href="default.css">
+  </head>
+  <body>
+
+    <h1>Pingus level feedback database</h1>
+    <div class="mainbody">
+
+<?
+
+$preferred_order = Array( 'tutorial', 'playable', 'wip', 'test' );
+
+// ==================================================================
+// Read cathegory and level names from filesystem
+// ==================================================================
+$cathegories = Array();
+$dir = dir("data/levels");
+while ($file = $dir->read())
+{
+  if ($file != "." && $file != ".." && is_dir("data/levels/".$file))
+  {
+    $levels = Array();
+    $dir2 = dir("data/levels/".$file);
+    while ($file2 = $dir2->read())
+      if (strpos($file2, ".plf") !== FALSE)
+        $levels[] = str_replace( ".plf", "", $file2 );
+    $dir2->close();
+    natcasesort( $levels );
+
+    $cath = Array();
+    $cath["name"] = $file;
+    $cath["levels"] = $levels;
+    $key = array_search($cath["name"], $preferred_order);
+    if ( $key === False )
+      $key = max(count($preferred_order), count($cathegories)+1);
+    $cathegories[$key] = $cath;
+  }
+}
+$dir->close();
+ksort( $cathegories );
+
+// ==================================================================
+// Level listing
+// ==================================================================
+if  ( !isset($_GET["l"]) || !isset($_GET["c"]) )
+{
+  if ( $show_thumbs )
+    print "<a href='$PHP_SELF?showthumbs=0'>[hide thumbnails]</a></br>";
+  else
+    print "<a href='$PHP_SELF?showthumbs=1'>[show thumbnails]</a></br>";
+
+  if ( !isset($_GET["c"]))
+  {
+    print "<p><strong>Pick a cathegory</strong>\n<ul>\n";
+    while( list(,$c) = each( $cathegories ))
+      print "<li><a href='$PHP_SELF?c=" . urlencode($c["name"]) . "'>" .
+        htmlentities($c["name"]) . "</a></li>\n";
+    print "</ul>\n";
+  }
+  else
+  {
+    print "<a href='$PHP_SELF'>[Back to cathegory list]</a></br>\n";
+    print "<a href='file-assoc-help.html' target='helpwin'>(Help: how to make 
'play' link work)</a></br>\n";
+    while( list(,$c) = each( $cathegories ))
+    {
+      if ( $_GET["c"] == $c["name"] )
+      {
+        $cnt = count($c["levels"]);
+        print "<h2 align='center'>" . htmlentities( $c["name"] ) . " ($cnt)" . 
"</h2>\n";
+
+        print "<table style='margin-bottom: 1em;' width='100%' ".
+          "border='0' cellspacing='0' cellpadding='4'><tr>\n";
+        $i = $col_cnt = 0;
+        while( list(,$l) = each( $c["levels"] ))
+        {
+          unset( $ldata );
+          $ldata = level_cache_get( $c["name"], $l );
+          $cnt = $ldata["totalcomments"];
+
+          if ( ($i++) % 2 )
+            $celcolor = "bgcolor='#B0B0B0'";
+          else
+            $celcolor = "bgcolor='#A0A0A0'";
+
+          $jpg = htmlentities($c["name"]) . "/" . htmlentities($l) . ".jpg";
+          print "<td valign='top' $celcolor width='25%'><small>\n".
+            "<a href='$PHP_SELF?c=" .
+            urlencode($c["name"]) . "&l=" . urlencode($l) . "'>";
+          if ( $show_thumbs )
+            print "<img src='http://pingus.seul.org/levels/thumb/$jpg' 
align='left' border='0'>";
+          print "" . htmlentities( $l ) . "</a>";
+
+          if ( $cnt < 1 ) $cnt = "-";
+          print " (<strong>$cnt</strong>)<br>";
+          print "<em>&quot;" . htmlentities($ldata["name"]) . 
"&quot;</em><br>";
+          if ( strlen($ldata["difficulty"]))
+            print "Difficulty:" . htmlentities($ldata["difficulty"]) . "<br>";
+          print "Pingus:" . intval($ldata["pingusmin"]) . "/" . 
intval($ldata["pingusmax"]) . "<br>";
+          if ( intval($ldata["playable"]) == 0 )
+            print "<b>Not playable</b><br>";
+          if ( $cnt > 0 )
+            print "Rating:" . str_repeat( "*", intval($ldata["avgrating"])) . 
"<br>";
+          print " view <a href='http://pingus.seul.org/levels/50/$jpg' 
target='levelview'>half</a>" .
+            "/<a href='http://pingus.seul.org/levels/100/$jpg' 
target='levelview'>full</a> | " .
+            "play with <a href='data/levels/" . urlencode($c["name"]) . "/" . 
urlencode($l) . ".plf'>CVS</a>" .
+            " / <a href='data/levels/" . urlencode($c["name"]) . "/" . 
urlencode($l) . ".xml'>0.6</a> version" .
+            "<br>";
+          print "</small></td>\n";
+
+
+          if ($col_cnt++ == 1 )
+          {
+            print "</tr><tr>\n";
+            $col_cnt = 0;
+            $i++; // kludge to make coloring look like checkers.
+          }
+        }
+        print "</tr></table>\n";
+      }
+    }
+  }
+}
+// ==================================================================
+// Info on certain level
+// ==================================================================
+else
+{
+  $c = $_GET["c"];
+  $l = $_GET["l"];
+  $curlevelmd5 = FALSE;
+
+  $levelfile = sandbox_check( "data/levels/$c/$l.plf", "data/" );
+  if ( !is_file( $levelfile ))
+  {
+    print "<h2>Level '" . htmlentities($c) . " / " .
+      htmlentities($l) . "' not found.</h2>\n";
+    print "<p><a href='$PHP_SELF?c=" . urlencode($c) . "'>Back to level 
list</a></p>";
+  }
+  else
+  {
+    print "<h2>" . htmlentities($c) . " / " . htmlentities($l) . "</h2>\n";
+
+    $curlevelmd5 = md5(implode("", file($levelfile)));
+    $leveldata = level_cache_get( $c, $l );
+    if ( $leveldata["md5sum"] !== $curlevelmd5 )
+      $leveldata = parse_level( $levelfile );
+    $leveldata["totalcomments"] = 0;
+    $leveldata["avgrating"] = 0;
+    $leveldata["md5sum"] = $curlevelmd5;
+
+    // Level description
+    $tbl = Array(
+      "Name" => htmlentities($leveldata["name"]),
+      "Description" => htmlentities($leveldata["description"]),
+      "Comment" => htmlentities($leveldata["comment"]),
+      "Author" => str_replace("@", "<b><small>PingusNoSpam</small></b>@",
+        htmlentities($leveldata["author"])),
+      );
+    print( "<table border='1'>\n" );
+    while( list($key,$val) = each( $tbl ))
+      print("<tr><td><strong>" . htmlentities($key) . "</strong></td>\n" .
+            "<td colspan='2'>" . $val . "</td></tr>\n");
+
+    // Basic info about the level
+    $tbl = Array(
+      "Pingus #" => $leveldata["pingusmin"] ." / " . $leveldata["pingusmax"],
+      "Time" => $leveldata["time"],
+      "Difficulty" => $leveldata["difficulty"],
+      "Playable" => $leveldata["playable"],
+      );
+    $i = 0;
+    while( list($key,$val) = each( $tbl ))
+    {
+      print("<tr><td><strong>" . $key . "</strong></td>");
+      print ("<td width='100%'>\n" . htmlentities($val) . "</td>");
+      // Thumbnail
+      if ( $i++ == 0)
+      {
+        $jpg = htmlentities($c) . "/" . htmlentities($l) . ".jpg";
+        print ("<td rowspan='5' valign='top' align='center'>\n".
+          "  <img src='http://pingus.seul.org/levels/thumb/$jpg' 
border='1'><br/>\n".
+          "  see <a href='http://pingus.seul.org/levels/50/$jpg' 
target='levelview'>half</a> / \n".
+          "  <a href='http://pingus.seul.org/levels/100/$jpg' 
target='levelview'>full</a> size\n<br>".
+          "<a href='data/levels/" . htmlentities($c) . "/" . htmlentities($l) 
. ".plf'>play</a>\n" .
+          "</td>\n" );
+      }
+    }
+
+    print "</tr><tr><td><strong>Actions</strong></td><td>\n";
+
+    // Number of actions
+    reset( $leveldata );
+    while( list($k,$v) = each($leveldata))
+    {
+      if ( substr($k,0,1)=="#" )
+      {
+        $a = substr($k,1);
+        $ac = trim($v);
+        if ( strlen($ac) == 0 )
+          $ac = "<strong>?</strong>";
+        else
+          $ac = htmlentities($ac);
+        print ("<img alt='$a' title='$a' src='gfx/actions/$a.png'> x ".
+          $ac . " ");
+      }
+    }
+
+    print( "</td></tr></table>\n" );
+?>
+    </p>
+    <hr/>
+<?
+    // ==================================================================
+    // Save added comment
+    // ==================================================================
+    if ( isset($_POST["addcomment"]))
+    {
+      if ( strpos($c, "..") !== False || strpos($c, "/") !== False ||
+        strpos($l, "..") !== False || strpos($l, "/") !== False )
+      {
+        print "<strong>ERROR: Illegal level name.</strong>";
+        exit;
+      }
+
+      if ( !is_dir("comments/$c/$l") &&
+           (@mkdir("comments/$c", 0775) || True) &&
+           !(@mkdir("comments/$c/$l", 0775)))
+      {
+        print ("<strong>ERROR: 'comments/$c/$l/' does not exist and ".
+               "could not be created.</strong>\n");
+        exit;
+      }
+      sandbox_check("comments/$c/$l", "comments/" );
+      $str =
+        '<' . '?xml version="1.0"  encoding="ISO-8859-1"?' . ">\n" .
+        "<pingus-level-comment>\n".
+        "  <author>" . 
xmlentities(decode_html(stripslashes($_POST["author"]))) . "</author>\n" .
+        "  <email>" . xmlentities(decode_html(stripslashes($_POST["email"]))) 
. "</email>\n" .
+        "  <level>" . xmlentities("$c/$l") . "</level>\n" .
+        "  <levelmd5>" . xmlentities(stripslashes($_POST["levelmd5"])) . 
"</levelmd5>\n" .
+        "  <date>" . xmlentities(date("Y-m-d")) . "</date>\n" .
+        "  <difficulty>" . xmlentities(stripslashes($_POST["difficulty"])) . 
"</difficulty>\n" .
+        "  <rating>" . xmlentities(stripslashes($_POST["rating"])) . 
"</rating>\n" .
+        "  <comment>" . 
xmlentities(decode_html(stripslashes($_POST["comment"]))) . "</comment>\n" .
+        "</pingus-level-comment>\n";
+
+      $filename = "comments/$c/$l/" . substr(md5($str),0,8) . ".plf";
+      if ( !file_exists($filename) || is_writable($filename))
+      {
+        if (!$fp = fopen($filename, 'w'))
+        {
+          print "<strong>ERROR: Cannot open file ($filename)</strong>\n";
+          exit;
+        }
+        if (!fwrite($fp, $str))
+        {
+          print "<strong>ERROR: Cannot write to file ($filename)</strong>\n";
+          exit;
+        }
+        fclose($fp);
+        chmod($filename, 0775);
+
+        // Send email-notification
+        if ( $mail_notify_enabled )
+        {
+          $mailto = trim($leveldata["author"]);
+          if ( isset($mail_forwards[$mailto]))
+            $mailto = trim($mail_forwards[$mailto]);
+          if ( $mailto !== null && strlen($mailto) > 0 && strpos($mailto,"@") 
> 0 )
+          {
+            $repl = Array(
+              "@SENDER" => decode_html(stripslashes($_POST["author"])) .
+                " <" . decode_html(stripslashes($_POST["email"])) . ">",
+              "@CATHEGORY" => $c,
+              "@LEVEL" => $l,
+              "@TO" => $mailto,
+              "@RATING" => str_repeat( "*", 
intval(stripslashes($_POST["rating"]))),
+              "@DIFFICULTY" => stripslashes($_POST["difficulty"]),
+              "@COMMENTS" => stripslashes(decode_html($_POST["comment"]))
+            );
+
+            mail(
+              $mailto,
+              str_replace(array_keys($repl), array_values($repl), 
$mail_subject),
+              str_replace(array_keys($repl), array_values($repl), 
$mail_message),
+              "From: $mail_from\r\n"
+                ."Reply-To: $mail_replyto\r\n"
+                ."X-Mailer: PHP/" . phpversion());
+          }
+        }
+      }
+      else
+        print "<strong>ERROR: File $filename is not writable</strong>\n";
+    }
+    // ==================================================================
+    // Delete comment
+    // ==================================================================
+    if ( $is_admin && isset($_GET["delcomment"]))
+    {
+      sandbox_check($_GET["delcomment"], "comments/" );
+      unlink($_GET["delcomment"]);
+      // Also try to remove the directories but don't mind if it fails:
+      @rmdir("comments/$c/$l");
+      @rmdir("comments/$c");
+      print "<p><strong>Deleted '" . htmlentities($_GET["delcomment"]) . 
"'</strong></p>";
+    }
+
+    // ==================================================================
+    // List user comments
+    // ==================================================================
+    $comments = parse_level_comments($c, $l);
+    if ( count($comments) > 0 )
+    {
+      while( list(,$cmt) = each($comments))
+      {
+        $leveldata["totalcomments"]++;
+
+        $rating = intval($cmt["rating"]);
+        $leveldata["avgrating"] += $rating;
+
+        if ( $is_admin )
+          $del_link = " <a href='$PHP_SELF?c=" . htmlentities($c) .
+            "&l=" . htmlentities($l) . "&delcomment=" . 
htmlentities($cmt["filename"]) . "'>[del]</a>\n";
+        $str =
+          "<p class='message'><strong>From:</strong> " . 
htmlentities($cmt["author"]) .
+          " &lt;" . str_replace("@", "<b><small>PingusNoSpam</small></b>@",
+            htmlentities($cmt["email"])) .
+            "&gt;, <strong>Date: </strong> " . htmlentities($cmt["date"]) . 
"<br/>\n" .
+          "<b>Difficulty: </b>" . htmlentities($cmt["difficulty"]) . "\n" .
+          ", <b>Rating: </b>" . str_repeat( "*", intval($rating)) . $del_link 
. "<br/>\n" .
+          "<cite>\n" .
+            str_replace( "\n", "<br/>\n", htmlentities($cmt["comment"])) .
+          "</cite></p>\n";
+
+        if (strtolower($cmt["levelmd5"]) == strtolower($curlevelmd5))
+          $new_comments_text .= $str;
+        else
+          $old_comments_text .= $str;
+      }
+      print("<h2>Comments</h2>\n" . $new_comments_text );
+      print("<h3>Comments for older version(s)</h3>\n" . $old_comments_text);
+    }
+    else print "<em>No comments for this level yet!</em>";
+
+    // Calc avg rating
+    if ( $leveldata["totalcomments"] > 0 )
+      $leveldata["avgrating"] = round($leveldata["avgrating"] / 
$leveldata["totalcomments"]);
+
+    // Save cache entry
+    level_cache_save( $c, $l, $leveldata );
+
+    // Allow overriding level md5 sum in GET parameters
+    $levelmd5 = $curlevelmd5;
+    if ( isset( $_GET["levelmd5"] ))
+      $levelmd5 = $_GET["levelmd5"];
+?>
+    <hr/>
+    <p><em><strong>Add a comment:</strong></em></p>
+    <form action="<? echo $PHP_SELF . "?c=" . urlencode($c) . "&l=" . 
urlencode($l); ?>" method="POST">
+      <input type="hidden" name="addcomment" value="1">
+      <input type="hidden" name="c" value="<? echo urlencode("$c"); ?>">
+      <input type="hidden" name="l" value="<? echo urlencode("$l"); ?>">
+      <input type="hidden" name="levelmd5" value="<? echo 
urlencode($levelmd5); ?>">
+      <table>
+        <tr>
+          <td>Your name</td>
+          <td><input type="text" name="author"></td>
+        </tr>
+        <tr>
+          <td>Your email</td>
+          <td><input type="text" name="email"></td>
+        </tr>
+        <tr>
+          <td>Difficulty</td>
+          <td>
+            <select name="difficulty">
+              <option value="easy">easy</option>
+              <option value="normal">normal</option>
+              <option value="hard">hard</option>
+              <option value="very hard">very hard</option>
+              <option value="unplayable">unplayable</option>
+              <option value="unfinished" selected>unfinished</option>
+            </select>
+          </td>
+        </tr>
+        <tr>
+          <td>Rating</td>
+          <td>
+            <select name="rating">
+              <option value="1">1 bad</option>
+              <option value="2">2 well...</option>
+              <option value="3" selected>3 ok</option>
+              <option value="4">4 good</option>
+              <option value="5">5 very good</option>
+            </select>
+          </td>
+        </tr>
+        <tr>
+          <td>Comments</td>
+          <td><textarea rows="8" cols="40" name="comment"></textarea></td>
+        </tr>
+        <tr>
+          <td colspan="2"><input type="submit"/></td>
+        </tr>
+      </table>
+    </form>
+<?
+    print "<p><a href='$PHP_SELF?c=" . urlencode($c) . "'>Back to level 
list</a></p>";
+    if ( !$is_admin )
+      print "<div align='right'><a href='$PHP_SELF?adminlogin=1'><small>admin 
login</small></a></div>";
+  }
+}
+
+close_cache();
+
+?>
+    </div>
+    <div>
+      <small>Pingus level feedback system &copy; 2003 by Jarno Elonen,
+      Licensed under the GNU General Public License (GPL) 2.0 or newer
+      </small>
+    </div>
+  </body>
+</html>
+
+<?
+// ==================================================================
+// Some utilities
+// ==================================================================
+function xmlentities($text, $op=1)
+{
+  if ( $op == 1 )
+  {
+    $tbl = get_html_translation_table( HTML_ENTITIES, ENT_QUOTES );
+    $tbl = array_flip( $tbl );
+    $text = strtr( $text, $tbl );
+  }
+
+  $text = htmlspecialchars( $text, ENT_QUOTES );
+  return $text;
+}
+
+function decode_html($string)
+{
+  $string = strtr($string, array_flip(get_html_translation_table( 
HTML_ENTITIES, ENT_QUOTES )));
+  $string = preg_replace("/&#([0-9]+);/me", "chr('\\1')", $string);
+  return $string;
+}
+?>

Added: trunk/contrib/level_comment_tool/level-cache.inc
===================================================================
--- trunk/contrib/level_comment_tool/level-cache.inc    2004-04-09 12:43:44 UTC 
(rev 2230)
+++ trunk/contrib/level_comment_tool/level-cache.inc    2004-04-09 14:04:34 UTC 
(rev 2231)
@@ -0,0 +1,208 @@
+<?
+//  Pingus Level Feedback system
+//  Copyright (C) 2003 by Jarno Elonen <address@hidden>
+//
+//  This program is free software; you can redistribute it and/or
+//  modify it under the terms of the GNU General Public License
+//  as published by the Free Software Foundation; either version 2
+//  of the License, or (at your option) any later version.
+//
+//  This program is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+//  GNU General Public License for more details.
+//
+//  You should have received a copy of the GNU General Public License
+//  along with this program; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+
+require_once("xml-search.inc");
+
+global $db_handle;
+$db_handle = False;
+
+function open_cache()
+{
+  global $db_handle;
+  if ( !$db_handle )
+  {
+    $db_driver = "db3";
+    //$db_driver = "db4";
+
+    $dbfile = "/home/elonen/public_html/pingus/comments/cache.db";
+    //$dbfile = "/var/www/pingus/comments/cache.db";
+
+    $db_handle = @dba_open ($dbfile, "w", $db_driver);
+    if (!$db_handle)
+      $db_handle = dba_open ($dbfile, "c", $db_driver);
+    if (!$db_handle)
+    {
+      echo '<p><font color="red"><b>ERROR: Cannot open cache 
file!</b></font></p>';
+      exit;
+    }
+  }
+}
+
+function close_cache()
+{
+  global $db_handle;
+  if ( $db_handle !== False )
+  {
+    dba_close($db_handle);
+    $db_handle = False;
+  }
+}
+
+function make_db_key( $cathegory, $level )
+{
+  return $cathegory . "//" . $level;
+}
+
+function level_cache_get( $cathegory, $level )
+{
+  global $db_handle;
+  open_cache();
+  $data = dba_fetch( make_db_key( $cathegory, $level ), $db_handle );
+  if ( $data === False )
+  {
+    $levelfile = sandbox_check( "data/levels/$cathegory/$level.plf", "data/" );
+    $leveldata = parse_level( $levelfile );
+    $leveldata["md5sum"] = md5(implode("", file($levelfile)));
+
+    $comments = parse_level_comments($cathegory, $level);
+    $avgrating = 0;
+    if (count($comments) > 0 )
+    {
+      while( list(,$v) = each($comments))
+        $avgrating += intval($v["rating"]);
+      $avgrating /= count($comments);
+    }
+    $leveldata["avgrating"] = $avgrating;
+    $leveldata["totalcomments"] = count($comments);
+
+    level_cache_save( $cathegory, $level, $leveldata );
+    return $leveldata;
+  }
+  $ret = Array();
+  $arr = explode("\255", $data);
+  while (list(,$fld) = each($arr))
+  {
+    if ( strlen($fld))
+    {
+      list($k,$v) = explode("=", $fld, 2);
+      $ret[$k] = $v;
+    }
+  }
+  unset( $data );
+  return $ret;
+}
+
+function level_cache_del( $cathegory, $level )
+{
+  global $db_handle;
+  open_cache();
+  if ( !dba_delete(make_db_key( $cathegory, $level ), $db_handle))
+  {
+    echo '<p><font color="red"><b>ERROR: Cannot delete cache 
key!</b></font></p>';
+    return False;
+  }
+  else return True;
+}
+
+function level_cache_save( $cathegory, $level, $arr )
+{
+  global $db_handle;
+  open_cache();
+  $data = "";
+  reset( $arr );
+  while (list($k,$v) = each($arr))
+    $data .= $k . "=" . $v . "\255";
+  if (!dba_replace( make_db_key( $cathegory, $level ), $data, $db_handle ))
+  {
+    echo '<p><font color="red"><b>ERROR: Cannot save level cache 
entry!</b></font></p>';
+    return False;
+  }
+  else return True;
+}
+
+function parse_level( $filename )
+{
+  $searches = Array(
+    "name" => "pingus-level/global/address@hidden",
+    "description" => "pingus-level/global/address@hidden",
+    "comment" => "pingus-level/global/comment",
+    "author" => "pingus-level/global/author",
+    "pingusmin" => "pingus-level/global/number-to-save",
+    "pingusmax" => "pingus-level/global/number-of-pingus",
+    "time" => "pingus-level/global/time",
+    "difficulty" => "pingus-level/global/difficulty",
+    "playable" => "pingus-level/global/playable"
+    );
+  $actions = Array(
+    "basher", "blocker", "bomber", "bridger", "climber",
+    "digger", "floater", "jumper", "miner", "slider" );
+  foreach( $actions as $a )
+    $searches["#$a"] = "pingus-level/action-list/$a";
+
+  $arr = Array();
+  $res = xml_search( $filename, $searches );
+  while( list($k,$v) = each($res))
+  {
+    if ( substr($k,0,1) == "#" )
+      $arr[$k] = $v["a"]["COUNT"];
+    else
+      $arr[$k] = $v["v"];
+      //$arr[$k] = decode_html($v["v"]);
+  }
+  unset( $res );
+  return $arr;
+}
+
+function parse_level_comments( $cathegory, $level )
+{
+  $res = Array();
+  $comment_dir = "comments/$cathegory/$level";
+  if ( !is_dir( $comment_dir ))
+    return $res;
+  sandbox_check($comment_dir, "comments/");
+
+  $dir = dir($comment_dir);
+  $comments = Array();
+  while ($file = $dir->read())
+    if ($file != "." && $file != ".." && file_exists("$comment_dir/$file"))
+      $comments[] = "$comment_dir/$file";
+  $dir->close();
+
+  while( list($key, $filename) = each($comments))
+  {
+    $cmt = xml_search( $filename, Array(
+      "author" => "pingus-level-comment/author",
+      "email" => "pingus-level-comment/email",
+      "date" => "pingus-level-comment/date",
+      "difficulty" => "pingus-level-comment/difficulty",
+      "rating" => "pingus-level-comment/rating",
+      "comment" => "pingus-level-comment/comment",
+      "levelmd5" => "pingus-level-comment/levelmd5"
+    ));
+
+    // We don't need tag names and attributes, strip them off:
+    while( list($k,$v) = each($cmt))
+      $cmt[$k] = $v["v"];
+
+    $cmt["filename"] = $filename;
+    $res[] = $cmt;
+  }
+  return $res;
+}
+
+function sandbox_check($filename, $sandbox)
+{
+  $file = realpath( $filename );
+  $sandbox = realpath( $sandbox );
+  if ( strlen($file) < strlen($sandbox) || substr($file, 0, strlen($sandbox)) 
!== $sandbox )
+    die( "<b>TRIED TO ACCESS A FILE OUTSIDE SANDBOX: '" .
+      htmlentities($filename) . "'! ABORTING!</b>");
+  return $filename;
+}
+
+?>

Added: trunk/contrib/level_comment_tool/mail-settings.inc
===================================================================
--- trunk/contrib/level_comment_tool/mail-settings.inc  2004-04-09 12:43:44 UTC 
(rev 2230)
+++ trunk/contrib/level_comment_tool/mail-settings.inc  2004-04-09 14:04:34 UTC 
(rev 2231)
@@ -0,0 +1,33 @@
+<?
+
+$mail_notify_enabled = True;
+
+//$mail_from = "Pingus level comment tool <address@hidden>";
+//$mail_replyto = "Pingus developer list <address@hidden>";
+$mail_from = "Pingus level comment tool <address@hidden>";
+$mail_replyto = "Pingus developer list <address@hidden>";
+$mail_forwards = Array(
+  "address@hidden" => "address@hidden",
+  "address@hidden" => null
+);
+
+$mail_subject = "[Pingus levels] comments on @CATHEGORY/@LEVEL";
+$mail_message = <<<EOMSG
address@hidden
+has commented on your Pingus level at
+http://elonen.iki.fi/pingus/address@hidden&address@hidden
+
+Rating: @RATING
+Difficulty: @DIFFICULTY
+Comments:
+
+---------
address@hidden
+---------
+
+This is an automatically generated notification mail.
+If you wish not to receive comments anymore, write a
+short note to Pingus developer list address@hidden
+EOMSG;
+
+?>
\ No newline at end of file

Added: trunk/contrib/level_comment_tool/play_on-2.png
===================================================================
(Binary files differ)


Property changes on: trunk/contrib/level_comment_tool/play_on-2.png
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: trunk/contrib/level_comment_tool/xml-search.inc
===================================================================
--- trunk/contrib/level_comment_tool/xml-search.inc     2004-04-09 12:43:44 UTC 
(rev 2230)
+++ trunk/contrib/level_comment_tool/xml-search.inc     2004-04-09 14:04:34 UTC 
(rev 2231)
@@ -0,0 +1,124 @@
+<?
+  /*
+   *  XML_Search 1.0 - diet-XPath for PHP
+   *
+   *  Copyright (C) 2003 by Jarno Elonen <address@hidden>
+   *
+   *  This program is free software; you can redistribute it and/or
+   *  modify it under the terms of the GNU General Public License
+   *  as published by the Free Software Foundation; either version 2
+   *  of the License, or (at your option) any later version.
+   *
+   *  This program is distributed in the hope that it will be useful,
+   *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+   *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   *  GNU General Public License for more details.
+   *
+   *  You should have received a copy of the GNU General Public License
+   *  along with this program; if not, write to the Free Software
+   *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, 
USA.
+   */
+
+  function xml_search( $filename, $searches )
+  {
+    // Parses an XML file with SAX, applies given searches
+    // to it on the fly and returns the corresponding nodes,
+    // if found.
+    //
+    // $searches is an array that contains search
+    // paths indexed with keys under which the nodes
+    // will be mapped in the result.
+    //
+    // For example, if $searches contained...
+    //   "name" => "movie/info/address@hidden",
+    // ...the function would look for...
+    //   <movie><info><title lang="en">DATA</title></info></movie>
+    // ...and return it in the result array as:
+    //   "name" => Array( "n"=>"TITLE", "v"=>"data", "a"=>Array("LANG"=>"en"))
+    //
+    // There can be any number of attribute equality tests,  for example:
+    //    "address@hidden/info/address@hidden@director=James address@hidden"
+    //
+    // Limitations: NOT re-entrant, no wildcards,
+    // only equality test for attributes
+
+    global $xmls_searches, $xmls_results, $xmls_elemstack;
+    $xmls_searches = $searches;
+    $xmls_elemstack = Array();
+    $xmls_results = Array();
+
+    set_time_limit( 20 );
+    $xml_parser = xml_parser_create();
+    xml_set_element_handler($xml_parser, "xmls_start_element", 
"xmls_end_element");
+    xml_set_character_data_handler($xml_parser, "xmls_character_data");
+    if (!($fp = fopen($filename, "r")))
+        die("could not open XML input");
+    while ($data = fread($fp, 4096))
+        if (!xml_parse($xml_parser, $data, feof($fp)))
+            die(sprintf("XML error: %s at line %d",
+                        xml_error_string(xml_get_error_code($xml_parser)),
+                        xml_get_current_line_number($xml_parser)));
+    @fclose($fp);
+    xml_parser_free($xml_parser);
+    return $xmls_results;
+  }
+
+  $xmls_searches = Array();
+  $xmls_results = Array();
+  $xmls_elemstack = Array();
+
+  function xmls_start_element($parser, $name, $attrs)
+  {
+      global $xmls_elemstack;
+      array_push($xmls_elemstack, Array( "n"=>$name, "a"=>$attrs, "v"=>""));
+  }
+
+  function xmls_end_element($parser, $name)
+  {
+    global $xmls_elemstack, $xmls_searches, $xmls_results;
+    reset( $xmls_searches );
+    while( list($path_key, $path) = each($xmls_searches))
+    {
+      $cmp = explode("/", $path);
+      if ( count($cmp) !== count($xmls_elemstack))
+        break;
+
+      $found = True;
+      reset( $xmls_elemstack );
+      while( list(,$node) = each( $xmls_elemstack ))
+      {
+        $c = explode( "@", current($cmp));
+        next($cmp);
+        if ( strcasecmp($c[0], $node["n"]) != 0 )
+        {
+          $found = False;
+          break;
+        }
+        for ( $i=1; $i<count($c); ++$i )
+        {
+          list($attr_k, $attr_v) = explode("=", $c[$i], 2);
+          $attr_k = strtoupper($attr_k);
+          if ( !isset($node["a"][$attr_k]) || $node["a"][$attr_k] !== $attr_v )
+          {
+            $found = False;
+            break;
+          }
+        }
+      }
+      if ( $found && each( $xmls_elemstack ) === False )
+      {
+        $node =& end($xmls_elemstack);
+        $xmls_results[$path_key] = $node;
+        unset($xmls_searches[$path_key]);
+      }
+    }
+    array_pop($xmls_elemstack);
+  }
+
+  function xmls_character_data($parser, $data)
+  {
+    global $xmls_elemstack;
+    end($xmls_elemstack);
+    $xmls_elemstack[key($xmls_elemstack)]["v"] .= $data;
+  }
+?>
\ No newline at end of file





reply via email to

[Prev in Thread] Current Thread [Next in Thread]