From 90603c2cf007a88ea408af8cb573868814522de9 Mon Sep 17 00:00:00 2001 From: ahollosi Date: Fri, 2 Jun 2000 15:46:24 +0000 Subject: [PATCH] This commit was generated by cvs2svn to compensate for changes in r2, which included commits to RCS files with non-trunk default branches. git-svn-id: svn://svn.code.sf.net/p/phpwiki/code/trunk@3 96ab9672-09ca-45d6-a79d-3d69d39ca109 --- HISTORY | 114 ++++++++++++ INSTALL | 69 +++++++ LICENSE | 367 ++++++++++++++++++++++++++++++++++++++ README | 36 ++++ index.php3 | 40 +++++ pgsrc/AddingPages | 11 ++ pgsrc/ConvertSpacesToTabs | 19 ++ pgsrc/EditText | 1 + pgsrc/FindPage | 19 ++ pgsrc/FrontPage | 5 + pgsrc/GoodStyle | 13 ++ pgsrc/HowToUseWiki | 38 ++++ pgsrc/MoreAboutMechanics | 17 ++ pgsrc/RecentChanges | 21 +++ pgsrc/RecentVisitors | 5 + pgsrc/ReleaseNotes | 13 ++ pgsrc/SteveWainstead | 9 + pgsrc/TextFormattingRules | 75 ++++++++ pgsrc/WabiSabi | 26 +++ pgsrc/WhatIsWikiWikiWeb | 12 ++ png.png | Bin 0 -> 229 bytes signature.png | Bin 0 -> 254 bytes wiki_config.php3 | 53 ++++++ wiki_dbmlib.php3 | 116 ++++++++++++ wiki_display.php3 | 217 ++++++++++++++++++++++ wiki_editlinks.php3 | 33 ++++ wiki_editpage.php3 | 73 ++++++++ wiki_fullsearch.php3 | 47 +++++ wiki_savepage.php3 | 70 ++++++++ wiki_search.php3 | 40 +++++ wiki_setupwiki.php3 | 28 +++ wiki_stdlib.php3 | 194 ++++++++++++++++++++ wikibase.png | Bin 0 -> 476 bytes 33 files changed, 1781 insertions(+) create mode 100644 HISTORY create mode 100644 INSTALL create mode 100644 LICENSE create mode 100644 README create mode 100644 index.php3 create mode 100644 pgsrc/AddingPages create mode 100644 pgsrc/ConvertSpacesToTabs create mode 100644 pgsrc/EditText create mode 100644 pgsrc/FindPage create mode 100644 pgsrc/FrontPage create mode 100644 pgsrc/GoodStyle create mode 100644 pgsrc/HowToUseWiki create mode 100644 pgsrc/MoreAboutMechanics create mode 100644 pgsrc/RecentChanges create mode 100644 pgsrc/RecentVisitors create mode 100644 pgsrc/ReleaseNotes create mode 100644 pgsrc/SteveWainstead create mode 100644 pgsrc/TextFormattingRules create mode 100644 pgsrc/WabiSabi create mode 100644 pgsrc/WhatIsWikiWikiWeb create mode 100644 png.png create mode 100644 signature.png create mode 100644 wiki_config.php3 create mode 100644 wiki_dbmlib.php3 create mode 100644 wiki_display.php3 create mode 100644 wiki_editlinks.php3 create mode 100644 wiki_editpage.php3 create mode 100644 wiki_fullsearch.php3 create mode 100644 wiki_savepage.php3 create mode 100644 wiki_search.php3 create mode 100644 wiki_setupwiki.php3 create mode 100644 wiki_stdlib.php3 create mode 100644 wikibase.png diff --git a/HISTORY b/HISTORY new file mode 100644 index 000000000..e0cdd02fb --- /dev/null +++ b/HISTORY @@ -0,0 +1,114 @@ +1.03 03/21/00: Refactored index.php3 and wiki_display.php3, which +had dbm function calls in them. Thanks to Christian Lindig + for pointing this out. This should make it +a little easier to port to a different database. + +1.02 02/02/00: Disabled embedded HTML, due to security holes +described in this CERT advisory: http://www.cert.org/advisories/CA-2000-02.html +You can re-enable it by removing the comment tags in wiki_display.php3. +Please be certain of what you are doing if you allow this! + +1.01 02/01/11: Fixed bug where header rules (
) were inserted +whenever four or more dashes occured; this only works if it starts the +line now. Thanks to Gerry Barksdale. + +1.00 01/25/00: Changed the names of all files except index.php3; I +prefaced them all with "wiki_" to avoid collisions with other files +that might be in the include path. Thanks to Grant Morgan for the +suggestion. A few corrections to the default pages; I think the +small rendering problems are due to Unix's lack of a carriage +return. + +0.99 01/20/00: Added a logic change suggested by Clifford Adams, +where a copy is saved to the archive if the previous author was +different. A different person that is. Fixed a rendering bug. This was +breaking: http://c2.com/cgi-bin/wiki followed by +http://c2.com/cgi-bin/wiki?PhpWiki on the same line. Because PHP only +can do *global* search and replace, the second URL was incompletely +swapped and linked. Using rsort() on the array of matches worked. +Added a patch from Grant Morgan for servers with magic_quotes_gpc set. + +0.98 01/18/00: Added code to build the $ServerAddress dyanamically. Now, +PhpWiki will work as soon as it's untarred. No configuration should be +necessary. + +0.97 01/16/00: Added a feature suggested by Clifford Adams. It stores +the author's remote address and disables the EditCopy the next time they +edit a page. Added
support and debugged it. A new Wiki will +load a set of new pages, so the Wiki is ready to go out of the box. + +0.96 01/15/00: Added EditCopy. This uses a second DBM file and could use +some more pounding. I also found a bug when two URL's appear on the same +line, like: +http://foo.com/ http://foo.com/WikiWikiWeb +In this case the second URL will not be linked correctly due to PHP's +replace-all-or-nothing regular expression functions. + +0.95 01/04/00: Severe reworking of the list code (UL amd OL tags). I +added a stack class and "implemented recursion," which seemed the +logical way to accomplish nested tags. There are a couple of minor bugs +to work out, and I have to get DL tags working. I changed some constants +to define()'s instead. There are magic numbers in stdlib.php3 that +probably should be defined. I also used while() loops while doing +push/pop operations which also gives me the willies, but I put in bounds +checking. + +0.94: 12/22/99 Mostly code cleanups; added code for waiting on the dbm +file if not available; added more comments. + +0.93: 12/21/99 Added full text search. Moved configuration code to a new +file, config.php3. Fixed another bug in RecentChanges. Page titles now +link to full search, which is a bit more useful. Added code to create a +new RecentChanges if none existed. + +0.92: 12/20/99 Added REMOTE_HOST to RecentChanges edits; fixed a bug +where I typed in PUT instead of POST in editpage.php3; patched +RecentChanges so hopefully the lines won't get screwed up anymore. + +0.91: 12/20/99 Fixed bug that occurred when creating new pages. + +0.90: 12/19/99 Added user-defined links (i.e. [1], [2] etc) and embedded +images. This is the first beta release. Only an issue with second-level +lists remains, and a couple of other minor things. + +0.81: 12/19/99 Fixed another wiki word linking issue. It arose from +having similar patterns in words in the same line. + +0.80: 12/18/99 I'm bumping up the version to .8 because it's that close. +I finally solved the crucial linking problem, by reinventing how +classic Wiki does it ;-) URL's are first replaced with tokens, then Wiki +words are linked, then linked URL's are put back. I improved the code a +great deal for the differnet "modes" of display text; I have a function +maintain the mode, and whether end tags are needed or not. + +0.07: 12/18/99 Fixed minor bug in preformatted/bulleted code output; fixed +reverse linking of page titles + +0.06: 12/15/99: Added ChangeSpacesToTabs + +0.05: 12/14/99: Added title searches, RecentChanges, fixed numerous bugs like +only trying to render valid page names, the last-edited-date, removed +the navigation toolbars, linked the new logo to FrontPage, and a half +dozen other odd things. It's almost ready. + +0.04: 12/12/99: Several additions to markup: + italics + bold + preformatted text + unordered lists (one level only, tow levels breaks) + +In addition, wiki links have been further debugged, but I still +haven't solved the problem with wiki-links inside URLs. + +0.03: 12/4/99: Pages are now serialized arrays instead of text blobs. Some +markup rules have been implemented. HTML is escaped; Wiki linking works +but +undefined pages do not have the question mark after them (they look like +a regular link to a Wiki page.) URL's hyperlink and should accept most +legal +URL's. + +0.02: 12/3/99: Basic page editing/saving/displaying is now working. + +Prior to 0.02, there were no numbered releases, and in fact there +was only one release, so I guess that would be 0.01 :-) diff --git a/INSTALL b/INSTALL new file mode 100644 index 000000000..c570e8c40 --- /dev/null +++ b/INSTALL @@ -0,0 +1,69 @@ +0. INSTALLATION + +Untar/gzip this file into the directory where you want it to live. +That's it. To improve efficiency, edit wiki_config.php3 and set the +$ServerAddress by hand; this will save a regexp call on every invocation. + +bash$ gzip -d phpwiki-X.XX.tar.gz +bash$ tar xvf phpwiki-X.XX.tar + +Let's say you own the web server http://www.foo.com/. You untar in the +server's root directory; then you should be able to just go to your new +Wiki: + +http://www.foo.com/wiki/index.php3 + +If you configure your server to recognize index.php3 as the index of a +directory, you can just do: + +http://www.foo.com/wiki/ + + +1. CONFIGURATION + +PhpWiki will create two DBM files in /tmp. One contains the pages of the +live site and the other has the archived pages. + +If you don't want the DBM files to live in /tmp you must make sure the web +server can read/write to it. It's probably a bad idea to leave it in +/tmp. (Again, edit wiki_config.php3). + +For example, you create a subdirectory called "pages" in the wiki +directory made when you untarred PhpWiki. Move the DBM files there, and do + +bash$ chmod 666 wikidb wikiarchive + +so your web server can read/write the DBM files. Then you must do + +bash$ chmod 777 pages + +on the "pages" directory to make sure the server can also create/set +the lock file (PHP has a built in locking mechanism for DBM file access). + +The first time you run this Wiki it will load a set of basic pages from +the pgsrc/ directory. These should be enough to get your Wiki started! + + +2. ALLOWING EMBEDDED HTML + +PhpWiki ships with this featured disabled by default. According to CERT +(http://www.cert.org/advisories/CA-2000-02.html) malicious users can embed +HTML in your pages that allow pure evil to happen. You can uncomment the +"elseif" in wiki_display.php3 to allow embedded HTML; but you should never +do this if your Wiki is publically accessible. + + +3. ETC + +Installing PHP is beyond the scope of this document :-) +You should visit http://www.php.net/ if you don't have PHP. +Note that I have the web server configured to allow index.php3 +as the root document of a directory. + +This web application was written under PHP version 3.0.12. I used +a very generic installation, so hopefully you will have no problems. +The development platform is a Redhat Linux 4.2 box. + +That should be all. Send patches, bugs etc. to swain@wcsb.org. + +FIN diff --git a/LICENSE b/LICENSE new file mode 100644 index 000000000..befaf3093 --- /dev/null +++ b/LICENSE @@ -0,0 +1,367 @@ + 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. + + + Copyright (C) 19yy + + 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) 19yy 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. + + , 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. + diff --git a/README b/README new file mode 100644 index 000000000..f50087f57 --- /dev/null +++ b/README @@ -0,0 +1,36 @@ +Thanks to: +John Jorgensen http://c2.com/cgi-bin/wiki?AnotherPhpWiki, +Tim Voght http://c2.com/cgi-bin/wiki?TimVoght, +Grant Morgan http://c2.com/cgi-bin/wiki?GrantMorgan, + +and especially Clifford A. Adams: +http://c2.com/cgi-bin/wiki?CliffordAdams + +who gave invaluable feedback and patches to my little project! + +This web application is licensed under the Gnu Public License, which +should be included in the same directory as this README. A copy +can be found at http://www.gnu.org/copyleft/gpl.txt. + +See INSTALL for installation notes. +My test version uses a dbm file in the /tmp directory; you may wish +a more permanent place for yours, but make sure it's read/writable by +your web server! + +wiki_config.php3: configuration options, constants, global variables +wiki_dbmlib.php3: database access functions +wiki_display.php3: render a page +wiki_editlinks.php3: edit the embedded links of a page +wiki_editpage.php3: edit a page +wiki_fullsearch.php3: full page text search +index.php3: the "main page", really a set of branching instructions +wiki_savepage.php3: save a page to db, thank user +wiki_search.php3: page title search +wiki_setupwiki.php3: load a set of pages from ./pgsrc/ directory +wiki_stdlib.php3: standard library of functions (non-db related) + +Steve Wainstead +swain@wcsb.org +swain@nytimes.com +http://wcsb.org/~swain/ + diff --git a/index.php3 b/index.php3 new file mode 100644 index 000000000..b620dbda0 --- /dev/null +++ b/index.php3 @@ -0,0 +1,40 @@ + diff --git a/pgsrc/AddingPages b/pgsrc/AddingPages new file mode 100644 index 000000000..0c8c6ca2a --- /dev/null +++ b/pgsrc/AddingPages @@ -0,0 +1,11 @@ +To add a new page to Wiki, all you have to do is come up with a meaningful title, capatalize all the words and StringThemTogetherLikeThis. Wiki automagically recognizes it as a hyperlink. + +Then you can go ahead and ClickTheQuestionMark at the end of your new hyperlink, and the Wiki will give you a window for making the new page. + +If you wish to add documents with complex markup to the Wiki, you might be better off providing a URL to it than trying to add the text of the document here, like so: + + PhpWiki project homepage: http://wcsb.org:8080/~swain/php/wiki/ + +The Wiki does not support HTML tags (see TextFormattingRules). They will just render like text. Wiki is meant to be as simple as possible to encourage use. + +Note that there is a feature that your system administrator can enable to allow embedded HTML, but there are security risks involved. diff --git a/pgsrc/ConvertSpacesToTabs b/pgsrc/ConvertSpacesToTabs new file mode 100644 index 000000000..a674e12b6 --- /dev/null +++ b/pgsrc/ConvertSpacesToTabs @@ -0,0 +1,19 @@ +VariousBrowsers have trouble with the tab character used in the TextFormattingRules. If you can't type a tab, or, if you are fixing up a page written by someone who didn't type tabs, then you should have us convert spans of spaces to tabs for you. You request space to tab conversion with the checkbox that appears near the bottom of EditText and EditCopy pages. It looks something like this... + + [ ] I can't type tabs. Please ConvertSpacesToTabs for me when I save. + +A span of spaces must be at least '''three''' spaces long to be recognized +as a tab. Use multiples of '''eight''' spaces to make multiple tabs. +Each span of eight spaces will convert to one tab. If the +last span comes up a little short, that's ok, as long as +there are at least three spaces in the last (only) span. + +'''Check your work.''' This sort of heuristic can lead to +unexpected results. +----- +[Maintenance note: This page is seen when the user clicks on the +"ConvertSpacesToTabs" link on any edit screen. It describes what happens +when you ask the system to do this, why you would want it to, and ways to +avoid the spaces-instead-of-tabs problem.] + + diff --git a/pgsrc/EditText b/pgsrc/EditText new file mode 100644 index 000000000..d5f68f0cf --- /dev/null +++ b/pgsrc/EditText @@ -0,0 +1 @@ +All pages (except search results) have an EditText link at the bottom. You can edit the page you are reading by clicking that link. diff --git a/pgsrc/FindPage b/pgsrc/FindPage new file mode 100644 index 000000000..59901626f --- /dev/null +++ b/pgsrc/FindPage @@ -0,0 +1,19 @@ +Here are some good starting points for browsing. + + * HowToUseWiki gives you the quick lowdown on Wiki markup. + * RecentChanges recorded automatically + * MoreAboutMechanics of browsing and editing on this server + + + +Here's a title search. Try something like ''wiki'' +or ''sandwich''. + +[Search] + +Use the following for a full text search. This takes a few seconds. The results will show all lines on a given page that contain a match. + +[Fullsearch] + + + diff --git a/pgsrc/FrontPage b/pgsrc/FrontPage new file mode 100644 index 000000000..6d8f90530 --- /dev/null +++ b/pgsrc/FrontPage @@ -0,0 +1,5 @@ + *WhatIsWikiWikiWeb? Click here to find out! + *Learn HowToUseWiki and learn about AddingPages + *Please sign your name in RecentVisitors. + *See RecentChanges for the latest page additions and changes. + diff --git a/pgsrc/GoodStyle b/pgsrc/GoodStyle new file mode 100644 index 000000000..7ea7894e0 --- /dev/null +++ b/pgsrc/GoodStyle @@ -0,0 +1,13 @@ +"Young writers often suppose that style is a garnish for the meat of +prose, a sauce by which a dull dish is made palatable. Style has no such +separate entity; it is nondetachable, unfilterable. The beginner should +approach style warily, realizing that it is himself he is approaching, no +other; and he should begin by turning resolutely away from all devices +that are popularly believed to indicate style--all mannerisms, tricks, +adornments. The approach to style is by way of plainness, simplicity, +orderliness, sincerity." + +--Strunk and White, "The Elements of Style" + +''And thus an American textbook, typical required reading for 10th-grade English students, unknowingly extols some virtues of WabiSabi'' +--scummings diff --git a/pgsrc/HowToUseWiki b/pgsrc/HowToUseWiki new file mode 100644 index 000000000..462cce875 --- /dev/null +++ b/pgsrc/HowToUseWiki @@ -0,0 +1,38 @@ +''"Wiki wiki"'' means "quick" in Hawai'ian. + +'''All you really need to know is:''' + + * To edit any page click on the Edit Text link at the bottom of +the page. You should do that right now, and read the source code of this +page. It will make more sense. + * You get italics by surrounding words with two single quotes on +either side ''like this''. + * You get '''bold text''' by using three quotes on either side. + * And, '''''bold italics''''' with five. + * You get bullets by using a tab and an asterick * + * If you use Windows, you can't use your tab key. It's Bill +Gates's fault. But you can check the little box that says Convert Spaces +To Tabs. You can type a bunch of spaces and the Wiki will recognize them +as a tab. + * To have plain monospaced font, indent with a space: + + this is a poem + about monospacing + nothing rhymes with poem + nothing rhymes with monospacing + + * You can seperate paragraphs with an extra blank line. Example: + +I am a paragraph. + +I am a paragraph too. We're just very small paragraphs. + + + * You can get horizontal rules with four or more dashes like this: +---- + * To create hyperlinks you just capitalize the words and string them together. Let's say you want to create a page about how Steve Wainstead eats worms. All you have to do is capitalize each word and string them together like this: SteveWainsteadEatsWorms. If the page does not exist yet a question mark appears after the link, inviting you to create the page: ThisPageShouldNotExist. (And please don't ruin the example by creating one.) + * To link to pages outside the Wiki, you can just type in the URL and Wiki will link it for you: http://www.nytimes.com/ + * Now you are ready to begin AddingPages. + +---- +A WikiWikiWeb is meant to be fast and easy to edit. It has very simple markup that you can read about in TextFormattingRules. diff --git a/pgsrc/MoreAboutMechanics b/pgsrc/MoreAboutMechanics new file mode 100644 index 000000000..edbe6f69b --- /dev/null +++ b/pgsrc/MoreAboutMechanics @@ -0,0 +1,17 @@ +PhpWiki is written in the server-side scripting language PHP, available from http://www.php.net/. PHP resembles C and Perl in its syntax, and functions much like ASP, EmbPerl or JSP. + +PhpWiki consists of a dozen or so files of mixed PHP and HTML. The web pages that make up a WikiWikiWeb based on PHP live in a DBM file with backup copies of previous versions of pages stored in a second DBM file. + +Every time a user hits the site the page requested is pulled from the DBM and rendered on the fly. The user only ever requests the file index.php3, which then decides which other php files to include. + +Links to pages in the wiki are automatically linked: PhpWiki. This might be the single most compelling aspect of a wiki, the ability to add pages simply by linking to them. The next most compelling thing is how easily external URL's link: + # http://www.wcsb.org/ + # ftp://ftp.redhat.com/ + # news://news.mozilla.org/ + +Combined with one namespace and a simple markup, a Wiki exhibits many of the characteristics of WabiSabi. + +PhpWiki is licensed under the Gnu General Public license, which you should be able to see here: http://www.gnu.org/copyleft/gpl.txt. + + + diff --git a/pgsrc/RecentChanges b/pgsrc/RecentChanges new file mode 100644 index 000000000..cdb585074 --- /dev/null +++ b/pgsrc/RecentChanges @@ -0,0 +1,21 @@ +The most recently changes pages are listed below. + + +Day one: + + *WhatIsWikiWikiWeb + *HowToUseWiki + *AddingPages + *GoodStyle + *RecentVisitors + *ConvertSpacesToTabs + *SteveWainstead + *EditText + *MoreAboutMechanics + *TextFormattingRules + *FindPage + *RecentChanges + *WabiSabi + *FrontPage + *ReleaseNotes + diff --git a/pgsrc/RecentVisitors b/pgsrc/RecentVisitors new file mode 100644 index 000000000..2e2d7637b --- /dev/null +++ b/pgsrc/RecentVisitors @@ -0,0 +1,5 @@ +Sign and date your name below! + +SteveWainstead, Php Wiki author + + diff --git a/pgsrc/ReleaseNotes b/pgsrc/ReleaseNotes new file mode 100644 index 000000000..280443a20 --- /dev/null +++ b/pgsrc/ReleaseNotes @@ -0,0 +1,13 @@ +PhpWiki was written because I am so interested in WikiWikiWebs, and I haven't used PHP since version 2.0. I wanted to see how it had advanced. + +Version 1.0 is a near-perfect clone of the Portland Pattern Repository, http://c2.com/cgi-bin/wiki?WikiWikiWeb. In truth, I was using the Wiki script you can download from there as a model; that Wiki lacks a number of features the PPR has, like EditCopy. So in truth PhpWiki is a kind of hybrid of the PPR and the generic Wiki you can get from there (which is written in Perl). + +The one caveat of PhpWiki is the allowance of HTML if the line is preceded by a bar (or pipe, which is how I usually say it). (That's a '|'). It was very simple to add, and the idea came from a posting somewhere on the PPR about how AT&T had an internal Wiki clone and used the same technique. The ability to embed HTML is disabled by default for security reasons. + +Version 1.01 includes a patch that fixes a small error with rendering
lines. Thanks to Gerry Barksdale. + +See the HISTORY file for a rundown on the whole development process if that sort of thing really interests you :-) + +--SteveWainstead + + diff --git a/pgsrc/SteveWainstead b/pgsrc/SteveWainstead new file mode 100644 index 000000000..f93a14a81 --- /dev/null +++ b/pgsrc/SteveWainstead @@ -0,0 +1,9 @@ +Hi. I built this WikiWikiWeb. + +I work in the day at the New York Times on the Web (http://www.nytimes.com/), now part of Times Company Digital. Please report bugs to one of the email addresses below: + + *mailto:swain@wcsb.org + *mailto:swain@nytimes.com + *http://wcsb.org/~swain/ + + diff --git a/pgsrc/TextFormattingRules b/pgsrc/TextFormattingRules new file mode 100644 index 000000000..2c130a02b --- /dev/null +++ b/pgsrc/TextFormattingRules @@ -0,0 +1,75 @@ +'''Paragraphs''' + + * Don't Indent paragraphs + + * Words wrap and fill as needed + + * Use blank lines as separators + + * Four or more minus signs make a horizontal rule + + + +'''Lists''' + + * tab-* for first level + + * tab-tab-* for second level, etc. + + * Use * for bullet lists, 1. for numbered lists (mix at will) + + * tab-Term:-tab Definition for definition lists + + * One line for each item + + * Other leading whitespace signals preformatted text, changes font. + +'''Fonts''' + * Indent with one or more spaces to use a monospace font: + + This is in monospace +This is not + + + +'''Indented Paragraphs''' +''(Quotes)'' + + * tab-space-:-tab -- often used (with emphasis) for quotations. (See SimulatingQuoteBlocks) + + + +'''Emphasis''' + + * Use doubled single-quotes ('') for emphasis (usually italics) + + * Use tripled single-quotes (''') for strong emphasis (usually bold) + + * Use five single-quotes ('''''), or triples within doubles, for some other kind of emphasis (BoldItalicInWiki), but be careful about the bugs in the Wiki emphasis logic... + + * Emphasis can be used multiple times within a line, but cannot cross line boundaries + + + +'''References''' + + * JoinCapitalizedWords to make local references + + * [1], [2], [3], [4] refer to remote references. Click EditLinks on the edit form to enter URLs + + * Or precede URLs with "http:", "ftp:" or "mailto:" to create links automatically as in: http://c2.com/ + + * URLs ending with .gif are inlined ''if inserted as a remote reference'' + + +'''Mark-Up Language''' + + * Don't bother + + * < and > are themselves + + * The & characters will not work + + * If you really must use HTML, start each line with a bar (|). Note that this featured must be enabled by the system administrator. + + diff --git a/pgsrc/WabiSabi b/pgsrc/WabiSabi new file mode 100644 index 000000000..97c44d939 --- /dev/null +++ b/pgsrc/WabiSabi @@ -0,0 +1,26 @@ +Since wabi-sabi represents a comprehensive Japanese world view or aesthetic system, it is difficult to explain precisely in western terms. According to Leonard Koren, wabi-sabi is the most conspicuous and characteristic feature of what we think of as traditional Japanese beauty and it "occupies roughly the same position in the Japanese pantheon of aesthetic values as do the Greek ideals of beauty and perfection in the West." + +Wabi-sabi is a beauty of things imperfect, impermanent, and incomplete. + +It is the beauty of things modest and humble. + +It is the beauty of things unconventional. + +The concepts of wabi-sabi correlate with the concepts of Zen Buddhism, as the first Japanese involved with wabi-sabi were tea masters, priests, and monks who practiced Zen. Zen Buddhism originated in India, traveled to China in the 6th century, and was first introduced in Japan around the 12th century. Zen emphasizes "direct, intuitive insight into transcendental truth beyond all intellectual conception." At the core of wabi- sabi is the importance of transcending ways of looking and thinking about things/existence. + + *All things are impermanent + *All things are imperfect + *All things are incomplete + +Material characteristics of wabi-sabi: + + *suggestion of natural process + *irregular + *intimate + *unpretentious + *earthy + *simple + +For more about wabi-sabi, see +http://www.art.unt.edu/ntieva/artcurr/japan/wabisabi.htm + diff --git a/pgsrc/WhatIsWikiWikiWeb b/pgsrc/WhatIsWikiWikiWeb new file mode 100644 index 000000000..223ab1af2 --- /dev/null +++ b/pgsrc/WhatIsWikiWikiWeb @@ -0,0 +1,12 @@ +A WikiWikiWeb is a site where everyone can collaborate on the content. The most well-known and widely used Wiki is the Portland Pattern Repository at http://c2.com/cgi-bin/wiki?WikiWikiWeb. + +I found these statements there particularly relevant: + +''The point is to make the EditText form simple and the FindPage search fast.'' + +''In addition to being quick, this site also aspires to Zen ideals generally labeled WabiSabi. Zen finds beauty in the imperfect and ephemeral. When it comes down to it, that's all you need.'' + +You can say hello on RecentVisitors, or read about HowToUseWiki and AddingPages. Currently this Wiki has no "theme" for discussion, so go ahead and play with it and have fun! + +--SteveWainstead + diff --git a/png.png b/png.png new file mode 100644 index 0000000000000000000000000000000000000000..841dae6b1749a60164b09bf9fa97fd2b73f6b47c GIT binary patch literal 229 zcmeAS@N?(olHy`uVBq!ia0vp^-astL$P6T%k2!_{DVB6cUq=Rp^(V|(yIunMYymzY zu0Q_#05T_SShyZYv6p!Iy0V|=5n;9FU~=vQDH1JljVKAuPb(=;EJ|gF2uRG#D^W1g zGtsjQ;M-dTR1oIr;uumfCplq(S^{&@J+?kJg`+G-ba;DsR`@)-xslghs{VVUi*2t= z=q#Jo13s$l>b~=Y1ePuKDpr^7xp{&!=)j$Cwh#Xu+-+n~JwrrdgMlP}z)@iauNA^& U=1(_I1=_&i>FVdQ&MBb@01QM(G5`Po literal 0 HcmV?d00001 diff --git a/signature.png b/signature.png new file mode 100644 index 0000000000000000000000000000000000000000..8a1bd28dd8e3dcb0668281b496b999a1a14e71f9 GIT binary patch literal 254 zcmeAS@N?(olHy`uVBq!ia0y~yVEh7Pi!d?+Nk{G2|3Hc*-O<;Pfnog#bJnhxKt5Z5 zPlzj!{_*FB=zV_+Ad9`k)7O>#JP!+#nRFWKhXkOIXo+h?NpOBzNqJ&XDnmp-VrE{6 zf{~tyo@D^v-YTGid`}n0kcv6U2@ diff --git a/wiki_dbmlib.php3 b/wiki_dbmlib.php3 new file mode 100644 index 000000000..58d3887c2 --- /dev/null +++ b/wiki_dbmlib.php3 @@ -0,0 +1,116 @@ + MAX_DBM_ATTEMPTS) { + echo "Cannot open database, giving up."; + exit(); + } + $numattempts++; + sleep(1); + } + return $dbi; + } + + + function CloseDataBase($dbi) { + return dbmclose($dbi); + } + + + // Return hash of page + attributes or default + function RetrievePage($dbi, $pagename) { + if ($data = dbmfetch($dbi, $pagename)) { + // unserialize $data into a hash + $pagehash = unserialize($data); + return $pagehash; + } else { + return -1; + } + } + + + // Either insert or replace a key/value (a page) + function InsertPage($dbi, $pagename, $pagehash) { + $pagedata = serialize($pagehash); + + if (dbminsert($dbi, $pagename, $pagedata)) { + if (dbmreplace($dbi, $pagename, $pagedata)) { + echo "error writing value"; + exit(); + } + } + } + + // The Recent Changes file is solely handled here + function UpdateRecentChanges($dbi, $pagename) { + global $remoteuser; + + $recentchanges = RetrievePage($dbi, "RecentChanges"); + + if ($recentchanges == -1) { + $recentchanges = array(); // First-time user, eh? :-) + } + + $recentchanges["text"] = preg_replace("/.*$pagename.*/", + "", + $recentchanges["text"]); + + $numlines = sizeof($recentchanges["text"]); + $currentdate = GetCurrentDate(); + + if ($recentchanges["date"] != $currentdate) { + $recentchanges["text"][$numlines++] = "$currentdate"; + $recentchanges["text"][$numlines++] = "\n"; + $recentchanges["date"] = "$currentdate"; + } + + + $recentchanges["text"][$numlines] = "\t*$pagename ..... $remoteuser"; + + // Clear out blank lines (they are size zero, not even \n) + $k = 0; + for ($i = 0; $i < ($numlines + 1); $i++) { + if (strlen($recentchanges["text"][$i]) != 0) { + $newpage[$k++] = $recentchanges["text"][$i]; + } + } + $recentchanges["text"] = $newpage; + + InsertPage($dbi, "RecentChanges", $recentchanges); + } + + + function IsWikiPage($dbi, $pagename) { + return dbmexists($dbi, $pagename); + } + + + // for archiving pages to a seperate dbm + function SaveCopyToArchive($pagename, $pagehash) { + global $ArchiveDataBase; + $adbi = OpenDataBase($ArchiveDataBase); + $newpagename = $pagename; + InsertPage($adbi, $newpagename, $pagehash); + dbmclose($adbi); + } + + +?> diff --git a/wiki_display.php3 b/wiki_display.php3 new file mode 100644 index 000000000..2f6c627a1 --- /dev/null +++ b/wiki_display.php3 @@ -0,0 +1,217 @@ +$LogoImage "; + echo "$pagename\n"; + + $pagehash = RetrievePage($dbi, $pagename); + if (is_array($pagehash)) { + // we render the page if it's a hash, else ask the user to write + // one. + + // Set up inline links and images + for ($i = 1; $i < (NUM_LINKS + 1); $i++) { + if (! empty($pagehash["r$i"])) { + if (preg_match("/png$/i", $pagehash["r$i"])) { + // embed PNG images + $embedded[$i] = ""; + } else { + // ordinary embedded link + $embedded[$i] = "[$i]"; + } + } + } + + $numlines = count($pagehash["text"]); + + // Loop over all lines of tha page and apply transformation rules + for ($index = 0; $index < $numlines; $index++) { + $tmpline = $pagehash["text"][$index]; + + // workaround for null array elements bug + // This was affecting RecentChanges but no more + if (strlen($tmpline) == 0) { + continue; + } + + if (strlen($tmpline) == 1) { + // this is a blank line, send

+ SetHTMLOutputMode("p", ZERO_DEPTH, 0); + continue; + + } +/* If your web server is not accessble to the general public, you may allow this code below, + which allows embedded HTML. If anyone can reach your web server it is highly advised that + you do not allow this. + + elseif (preg_match("/(^\|)(.*)/", $tmpline, $matches)) { + // HTML mode + SetHTMLOutputMode("", ZERO_DEPTH, 0); + echo $matches[2]; + continue; + } +*/ + // escape HTML metachars + $tmpline = ereg_replace("[&]", "&", $tmpline); + $tmpline = ereg_replace("[>]", ">", $tmpline); + $tmpline = ereg_replace("[<]", "<", $tmpline); + + // four or more dashes to


+ $tmpline = ereg_replace("^-{4,}", "
", $tmpline); + + + // replace all URL's with tokens, so we don't confuse them + // with Wiki words later. Wiki words in URL's break things. + + $hasURLs = preg_match_all("/\b((http)|(ftp)|(mailto)|(news)|(file)|(gopher)):[^\s\<\>\[\]\"'\(\)]*[^\s\<\>\[\]\"'\(\)\,\.\?]/", $tmpline, $urls); + + // workaround: php can only do global search and replace which + // renders wrong when the domain appears in two consecutive URL's + // on the same line, but the second is longer i.e. + // http://c2.com followed by http://c2.com/wiki + rsort($urls[0]); + reset($urls[0]); + + for ($i = 0; $i < $hasURLs; $i++) { + $inplaceURL = preg_quote($urls[0][$i]); + $URLtoken = "${FieldSeparator}${i}${FieldSeparator}"; + $tmpline = preg_replace("|$inplaceURL|", + $URLtoken, + $tmpline); + } + + // bold italics + $tmpline = eregi_replace("(''''')(.*)(''''')", + "\\2", + $tmpline); + + // bold + $tmpline = eregi_replace("(''')(.*)(''')", + "\\2", + $tmpline); + + // italics + $tmpline = eregi_replace("('')(.*)('')", + "\\2", + $tmpline); + + // Link Wiki words + if (preg_match_all("#\b(([A-Z][a-z]+){2,})\b#", + $tmpline, + $link)) { + + // uniq the list of matches + $hash = ""; + for ($i = 0; $link[0][$i]; $i++) { + // $realfile = $link[0][$i]; + $hash[$link[0][$i]]++; + } + + reset($hash); + while (list($realfile, $val) = each($hash)) { + if (IsWikiPage($dbi, $realfile)) { + $tmpline = preg_replace("|\b$realfile\b|", + LinkExistingWikiWord($realfile), + $tmpline); + } else { + $tmpline = preg_replace("|\b$realfile\b|", + LinkUnknownWikiWord($realfile), + $tmpline); + } + } + + } + + // put URLs back, linked + for ($i = 0; $i < $hasURLs; $i++) { + $inplaceURL = ""; + $inplaceURL .= $urls[0][$i] . ""; + $URLtoken = "${FieldSeparator}${i}${FieldSeparator}"; + $tmpline = preg_replace("|$URLtoken|", + $inplaceURL, + $tmpline); + } + + + // Insert search boxes, if needed + $tmpline = ereg_replace("\[Search]", RenderQuickSearch(), $tmpline); + $tmpline = ereg_replace("\[Fullsearch]", RenderFullSearch(), $tmpline); + + // match and replace all user-defined links ([1], [2], [3]...) + preg_match_all("|\[(\d)\]|", $tmpline, $match); + if (count($match[0])) { + for ($k = 0; $k < count($match[0]); $k++) { + if (! empty($embedded[$match[1][$k]])) { + $linkpattern = preg_quote($match[0][$k]); + $tmpline = preg_replace("|$linkpattern|", + $embedded[$match[1][$k]], + $tmpline); + } + } + } + + // HTML modes: pre, unordered/ordered lists, term/def + if (preg_match("/(^\t)(.*?)(:\t)(.*$)/", $tmpline, $matches)) { + // this is a dictionary list item + SetHTMLOutputMode("dl", SINGLE_DEPTH, 1); + $tmpline = "
" . $matches[2] . "
" . $matches[4]; + + } elseif (preg_match("/(^\t+)(\*|\d|#)/", $tmpline, $matches)) { + // this is part of a list + $numtabs = strlen($matches[1]); + if ($matches[2] == "*") { + $listtag = "ul"; + } else { + $listtag = "ol"; // a rather tacit assumption. oh well. + } + $tmpline = preg_replace("/^(\t+)(\*|\d|#)/", "", $tmpline); + SetHTMLOutputMode($listtag, SINGLE_DEPTH, $numtabs); + echo "
  • "; + + } elseif (preg_match("/^\s+/", $tmpline)) { + // this is preformatted text, i.e.
    +            SetHTMLOutputMode("pre", ZERO_DEPTH, 0);
    +
    +         } else {
    +            // it's ordinary output if nothing else
    +            SetHTMLOutputMode("", ZERO_DEPTH, 0);
    +         }
    +
    +         echo "$tmpline"; // at last, emit the code
    +      }
    +
    +   } else {
    +      echo "Describe $pagename? here.\n";
    +   }
    +
    +   SetHTMLOutputMode("", ZERO_DEPTH, 0);
    +   WikiToolBar();
    +   WikiFooter();
    +?>
    +
    diff --git a/wiki_editlinks.php3 b/wiki_editlinks.php3
    new file mode 100644
    index 000000000..da0b78a6a
    --- /dev/null
    +++ b/wiki_editlinks.php3
    @@ -0,0 +1,33 @@
    +
    +
    +
    +<? echo $pagename; ?>Links
    +
    +
    +
    +
    +
    +

    Links + +

    +[1] +"> +
    +[2] +"> +
    +[3] +"> +
    +[4] +"> +

    +Type the full URL (http:// ...) for each reference cited in the text.

    + + +

    + + diff --git a/wiki_editpage.php3 b/wiki_editpage.php3 new file mode 100644 index 000000000..4fe71ff01 --- /dev/null +++ b/wiki_editpage.php3 @@ -0,0 +1,73 @@ +\n"; + exit(); + } + + WikiHeader($pagename); +?> + +
    "> +

    + +

    + + +
    + + +I can't type tabs. Please +?ConvertSpacesToTabs">ConvertSpacesToTabs +for me when I save. + +

    + +?GoodStyle">GoodStyle +tips for editing. + +
    + +?links=">EditLinks +to other web servers. + +
    + +EditCopy"; + echo " from previous author"; + } + +?> + + +

    + + diff --git a/wiki_fullsearch.php3 b/wiki_fullsearch.php3 new file mode 100644 index 000000000..766f54b33 --- /dev/null +++ b/wiki_fullsearch.php3 @@ -0,0 +1,47 @@ +$LogoImage Search Results\n"; + + $found = $count = 0; + + // from classic wiki: $pat =~ s/[+?.*()[\]{}|\\]/\\$&/g; + + $full = preg_replace("/[+?.*()[\]{}|\\\]/", "", $full); + + // looping through all keys + $key = dbmfirstkey($dbi); + + while ($key) { + $pagedata = dbmfetch($dbi, $key); + + // test the serialized data first, before going further + if (preg_match("/$full/i", $pagedata)) { + + echo "

    ", LinkExistingWikiWord($key), "

    \n"; + $pagehash = unserialize($pagedata); + + // print out all matching lines, highlighting the match + for ($j = 0; $j < (count($pagehash["text"])); $j++) { + if (preg_match("/$full/i", $pagehash["text"][$j], $pmatches)) { + $matched = preg_replace("/$full/i", "\\0", + $pagehash["text"][$j]); + $found += count($pmatches); + echo "
  • ", $matched, "
  • \n"; + } + } + echo "
    \n"; + } + $count++; + $key = dbmnextkey($dbi, $key); + } + + echo "$found matches found out of $count pages searched.\n"; + WikiFooter(); + + +?> diff --git a/wiki_savepage.php3 b/wiki_savepage.php3 new file mode 100644 index 000000000..e77a8ab9e --- /dev/null +++ b/wiki_savepage.php3 @@ -0,0 +1,70 @@ + for + // magic_quotes_gpc + if(get_magic_quotes_gpc()) { $text = stripslashes($text); } + + $pagehash["text"] = explode("\n", $text); + + // convert spaces to tabs at user request + if ($convert) { + $pagehash["text"] = CookSpaces($pagehash["text"]); + } + } + + // Ward Cunningham has deprecated these, but I already + // implented them. You are discouraged from using them. + if (! empty($r1)) { $pagehash["r1"] = $r1; } + if (! empty($r2)) { $pagehash["r2"] = $r2; } + if (! empty($r3)) { $pagehash["r3"] = $r3; } + if (! empty($r4)) { $pagehash["r4"] = $r4; } + + InsertPage($dbi, $pagename, $pagehash); + UpdateRecentChanges($dbi, $pagename); + WikiHeader("Thanks for $pagename Edits"); +?> +Thank you for editing +$pagename
    \n"; + +?> +Your careful attention to detail is much appreciated.
    +">
    +p.s. Be sure to Reload your old pages.
    + +Warning: the Wiki DBM file still lives in the "; + echo "/tmp directory. Please read the INSTALL file and move "; + echo "the DBM file to a permanent location or risk losing "; + echo "all the pages!\n"; + } + WikiFooter(); +?> diff --git a/wiki_search.php3 b/wiki_search.php3 new file mode 100644 index 000000000..ae75a244e --- /dev/null +++ b/wiki_search.php3 @@ -0,0 +1,40 @@ +$LogoImage Search Results\n"; + + $found = $count = 0; + + // from classic wiki: $pat =~ s/[+?.*()[\]{}|\\]/\\$&/g; + + $search = preg_replace("/[+?.*()[\]{}|\\\]/", "", $search); + + // looping through all keys + $key = dbmfirstkey($dbi); + while ($key) { + if (eregi("$search", $key)) { + $found++; + echo LinkExistingWikiWord($key), "
    \n"; + } + $count++; + $key = dbmnextkey($dbi, $key); + } + + echo "
    \n"; + echo "$found pages found out of $count titles searched.\n"; + WikiFooter(); + +?> diff --git a/wiki_setupwiki.php3 b/wiki_setupwiki.php3 new file mode 100644 index 000000000..b50ccad6d --- /dev/null +++ b/wiki_setupwiki.php3 @@ -0,0 +1,28 @@ + 1) { + $page["text"][$x] = chop($page["text"][$x]); + } + } + reset($page["text"]); +*/ + InsertPage($dbi, $file, $page); + } + closedir($handle); + +?> diff --git a/wiki_stdlib.php3 b/wiki_stdlib.php3 new file mode 100644 index 000000000..f3ce97650 --- /dev/null +++ b/wiki_stdlib.php3 @@ -0,0 +1,194 @@ +\n"; + echo "EditText\n"; + echo " of this page\n"; + if (is_array($pagehash)) { + echo " (last edited ", $pagehash["date"], ")\n"; + } + echo "
    \n"; + + echo "FindPage by browsing or searching\n"; + } + + // top of page + function WikiHeader($pagename) { + global $LogoImage, $ScriptUrl; + echo "\n"; + echo "\n"; + echo "$pagename\n"; + echo "\n"; + echo "\n"; + } + + function WikiFooter() { + echo "\n\n"; + } + + function GetCurrentDate() { + // format is like December 13, 1999 + return date("F j, Y"); + } + + function LinkExistingWikiWord($wikiword) { + global $ScriptUrl; + return "$wikiword"; + } + + function LinkUnknownWikiWord($wikiword) { + global $ScriptUrl; + return "$wikiword?"; + + } + + + function RenderQuickSearch() { + global $value, $ScriptUrl; + static $formtext = "
    \n\n
    \n"; + return $formtext; + } + + function RenderFullSearch() { + global $value, $ScriptUrl; + static $formtext = "
    \n\n
    \n"; + return $formtext; + } + + // converts spaces to tabs + function CookSpaces($pagearray) { + return preg_replace("/ {3,8}/", "\t", $pagearray); + } + + + class Stack { + var $items; + var $size = 0; + + function push($item) { + $this->items[$this->size] = $item; + $this->size++; + return true; + } + + function pop() { + if ($this->size == 0) { + return false; // stack is empty + } + $this->size--; + return $this->items[$this->size]; + } + + function cnt() { + return $this->size; + } + + function top() { + return $this->items[$this->size - 1]; + } + + } + // end class definition + + + /* + Wiki HTML output can, at any given time, be in only one mode. + It will be something like Unordered List, Preformatted Text, + plain text etc. When we change modes we have to issue close tags + for one mode and start tags for another. + */ + + // couldn't create a static version :-/ + // I couldn't move this to config.php3 because it + // wasn't declared yet. + $stack = new Stack; + + function SetHTMLOutputMode($tag, $tagdepth, $tabcount) { + global $stack; + + if ($tagdepth == SINGLE_DEPTH) { + + if ($tabcount < $stack->cnt()) { + + // there are fewer tabs than stack, reduce stack + // to one less than tab count; then push new tag + while ($stack->cnt() > ($tabcount - 1)) { + $closetag = $stack->pop(); + if ($closetag == false) { + //echo "bounds error in tag stack"; + //exit(); + break; + } + echo "\n"; + } + + echo "<$tag>\n"; + $stack->push($tag); + + } elseif ($tabcount > $stack->cnt()) { + // we add the diff to the stack + // stack might be zero + while ($stack->cnt() < $tabcount) { + echo "<$tag>\n"; + $stack->push($tag); + if ($stack->cnt() > 10) { + // arbitrarily limit tag nesting + echo "Stack bounds exceeded in SetHTMLOutputMode\n"; + exit(); + } + } + + } else { + if ($tag == $stack->top()) { + return; + } else { + $closetag = $stack->pop(); + echo "\n"; + echo "<$tag>\n"; + $stack->push($tag); + } + } + + } elseif ($tagdepth == ZERO_DEPTH) { + // empty the stack for $depth == 0; + // what if the stack is empty? + if ($tag == $stack->top()) { + return; + } + while ($stack->cnt() > 0) { + $closetag = $stack->pop(); + echo "\n"; + } + + if ($tag) { + echo "<$tag>\n"; + $stack->push($tag); + } + + } else { + // error + echo "Passed bad tag depth value in SetHTMLOutputMode\n"; + exit(); + } + } + // end SetHTMLOutputMode + + +?> diff --git a/wikibase.png b/wikibase.png new file mode 100644 index 0000000000000000000000000000000000000000..0efab77d4d89da1ca951a88ec93f694aa318b8c5 GIT binary patch literal 476 zcmV<20VDp2P)dbW?9; zba!ELWdK-EVQFr3ATlmAE;&#Ry?Ouu0ZmCnK~#90?b5w!!!Qs4U@3;&CcS|!kB~8g zv0o*Rkg-Ft{bqIELITeU8Sr}cdI@0%}x}51n@wO5t&Ii zSgI;pP?hD&MK+)aiax6zN(a!#K4GlG$$?E>1GnMg0Fw%CM-g{f4<-ZL$9kIYQ52>4 zChPDq>&l%0Or5Fr%F2KplIkuh%xXlCh3Z{YWLcSyD4$~Ff}GXeI^F;H_4oqW*R}B` Sq704z0000