", $CONTENT);
$CONTENT = preg_replace('/{%\|/Um', '', $CONTENT);
$CONTENT = preg_replace('/{%%(.*)\|/Um', "| ", $CONTENT);
$CONTENT = preg_replace('/\|\|}/Um', ' | ', $CONTENT);
$CONTENT = preg_replace('/\n?\|\|\|/Um', ' | | ', $CONTENT);
$CONTENT = preg_replace('/\n?\|\|%(.*)\|/Um', " | | ", $CONTENT);
$CONTENT = preg_replace('/\|\|/U', ' | ', $CONTENT);
$CONTENT = preg_replace('/\|%(.*)\|/U', " | ", $CONTENT);
$CONTENT = preg_replace('/^----\n/m', ' ', $CONTENT);
$CONTENT = preg_replace('#(| | ||)\n#', "$1", $CONTENT);
$CONTENT = preg_replace('#\n(|)#', "$1", $CONTENT);
$CONTENT = preg_replace('/\n/', ' ', $CONTENT);
$CONTENT = preg_replace("/{{}}/U", '', $CONTENT);
$CONTENT = preg_replace("/{{(.+)}}/U", '$1 ', $CONTENT);
}
$html = preg_replace("/{CONTENT}/", "$CONTENT", $html);
$html = preg_replace('/{TIME}/', $TIME, $html);
echo $html;
?>
==== end ====
Save that (probably using "save as") as a file called index.php within your nbwiki directory.
Do not clear the editing window.
You have now created the script which will run when "joe public" looks at the Wiki by using
a command such as . He will be able to see all the
pages but not edit them.
----
Stage 4
In the editing window, replace the lines down to "// End of configuration area" by the
following:
====start====
';
$HOME_BUTTON = "NBWiki Home";
$EDIT_BUTTON = "Edit this page";
$DONE_BUTTON = "Save changes";
$PROTECTED_BUTTON = "Editing not permitted";
$SEARCH_BUTTON = "Search";
$SEARCH_RESULTS = "Search results for";
$NEW_PAGE = "New page";
$RECENT_CHANGES = "Recent changes";
$FORCE_REFRESH = '&r=' . rand(1,999);
//
// End of configuration area
==== end ====
Save the result (using "save as") in subdirectory "admin" (still named index.php).
Keep the editing window open.
You have now created the script which will the administrator (or "super editor") will run by
the command . He will be able to change anything.
----
Stage 5
In the editing window, replace the lines down to "// End of configuration area" by the
following:
====start====
';
$HOME_BUTTON = "NBWiki Home";
$EDIT_BUTTON = "Edit this page";
$DONE_BUTTON = "Save changes";
$PROTECTED_BUTTON = "Editing not permitted";
$SEARCH_BUTTON = "Search";
$SEARCH_RESULTS = "Search results for";
$NEW_PAGE = "New page";
$RECENT_CHANGES = "Recent changes";
$FORCE_REFRESH = '&r=' . rand(1,999);
//
// End of configuration area
==== end ====
Save it (save as) still as index.php but in subdirectory "editor1".
The result is is a script which gives editing rights to a "sub editor" when issuing the
command . He will be able to change only
certain pages - those commencing either "This page is managed by sub-editor 1" or "This
page is managed by a sub-editor."
Keep the editing window open but clear it.
----
Stage 6
Copy the section below and paste it into the editing window.
====start====
{WIKI_TITLE} - {PAGE_TITLE}
{WIKI_TITLE}
{PAGE_TITLE}
Last Change: {TIME} | {EDIT} | {HOME} | {RECENT_CHANGES} | {SEARCH}
{CONTENT}
Last Change: {TIME} | {EDIT} | {HOME} | {RECENT_CHANGES} | {SEARCH}
==== end ====
Save it (save as) in subdirectory "templates" as file nbtemplate.html then clear the editing
window.
The result is is a template file which will be used for all viewers and editors. Later,
you can create separate ones for each if you wish.
----
Stage 7
The following sections give the contents for a file followed by the intended directory and
file name. Copy one at a time into the editor window and save it as indicated - retaining
the case of each letter in the filenames. Note: Some filenames include spaces.
====start====
!!![[Configuring NBWiki]]
Three types of configuration are envisaged:
#Configuring the script, including creating separate scrips for different editors
#Changing the template, including making changes to fit in with your website style
#Altering or extending NBWiki, particularly the markup syntax
These are described below.
!!!1. Configuring the script
As you will see below, you may use multiple scripts for one Wiki in order to control editing rights. Change $EDIT_IF parameter, and possibly others.
!!The following are set near the top of the script
{||'''Name'''||'''Example'''||'''Notes'''
|||$WIKI_TITLE||"NBWiki information and source files"||Main title on Wiki page (unless template is altered)
|||$PAGES_DIR||"./pages/"||Set as a relative link ending in /
|||$DOC_DIR||"./docs/"||For locally stored Word documents etc. that may be referenced from the Wiki for viewing or download. Set as a relative link ending in /
|||$PIC_DIR||"./pics/"||For locally stored graphic files that may be shown embedded in the Wiki. Set as a relative link ending in /
|||$TEMPLATE_FILE||"./templates/__.html"||Define the template file, including the path. May be shared between Wikis.
|||$EDIT_IF||array('This page is managed by the Baptist Church','This page is managed by Churches Together')||The ability to edit Wiki documents can be controlled by making different versions of the script available to different groups of people. The example settings could be made in a version of the script only available to the secretary of the Baptist Church who could change any Baptist Church or Churches Together page. If he or she created a new page, it would be seeded with the first entry.
The administrator or "Super editor" uses a version with a null string, can edit any page (unless read-only), and can therefore create starter pages for other editors.
Set a value such as 'ViEw OnLy' to prevent editing altogether. Generally, public access would be from such a script, normally called '''index.php'''.
|||$START_PAGE||"NBWiki home page"||Home filenames normally have the form Home.txt (the script adds .txt to all page files) but a variation may be desirable if the Wiki forms part of a larger website.
|||$RECENT_COUNT||15||Set the number of recently changed pages to list if Recent Changes is selected
|||$TIME_FORMAT||"%d-%m-%G %R"||Set date and time displays to country standard. The example suits the UK
|||$TABLE_FORMAT||''||Table format for ruled tables - complete html string
|||$HOME_BUTTON||"NBWiki Home"||Text on Wiki home button
|||$EDIT_BUTTON||"Edit page"||Text on Edit button
|||$DONE_BUTTON||"Save changes"||Text on button for saving edits
|||$PROTECTED_BUTTON||"Editing not permitted"||Alternative text for "Edit" button
|||$SEARCH_BUTTON||"Search"||Text on search button
|||$SEARCH_RESULTS||"Search results for"||Header for search results
|||$NEW_PAGE||"New page"||Text to show a page is new
|||$RECENT_CHANGES||"Recent changes"||Header for recent changes list
|||$FORCE_REFRESH||'&r=' . rand(1,999)||For forcing bypass of caches in high latency links. May be set to "" (null string) if latency will not be a problem.
||}
!!!2. Changing the template, including making changes to fit in with your website style
This requires an understanding of HTML and (preferably) it's interaction with PHP. These you must gain elsewhere.
!!!3. Altering or extending NBWiki, particularly the markup syntax
Production versions of the script (typically index.php for general use, admin/index.php for super-editors and others for restricted editors) may have most comments stripped beyond the configuration section. You can download a version with comments included called [!dev.php.txt|http://www.nomaz.co.uk/dev.php.txt!] to help if you wish to try fixing any bugs you find (or make any other changes). When you have retrieved it, remove the '''.txt''' from the filename.
The complex section at the end of the script handles the convertion from marked up "plain text" to HTML for normal display. Changing it without breaking it may prove challenging, but you are welcome to try. Be aware that the order of these statements is often important.
The syntax for "code" - double opening brackets, content, double closing brackets - needs some work. Current thinking is that it may be best processed near the start of the conversion section and work by inserting a null character after every included character. But I don't yet know how to do this efficiently.
If you come up with changes you think generally useful, please send details to nbwiki[[at]]nomaz[[dot]]co[[dot]]uk with a statement saying that your ideas may be used freely. Thanks.
==== end ====
Save in pages directory as Configuring NBWiki.txt
Replace the editing window contents with the following:
====start====
!!![[Help]]
This page is provided as an example only and will normally be replaced by whoever is responsible for setting up or managing a particular implementation of NBWiki.
----
!!General
A Wiki is a tool which enables a group of people equipped only with Internet Browser programs such as Mozilla Firefox or Microsoft's "Internet Explorer" to work together on developing linked web pages. For the background see "The Wiki Way" by Bo Leuf and Ward Cunningham published by Addison Wesley, ISBN 0-201-71499-X and/or search for "Wiki" using an Internet search engine.
NBWiki is intended to retain most of the simplicity of use and ease of implementation of the roWiki system on which it is based, while adding extra functionality and providing more control over editing. The '''NB''' indicates the origin of NBWiki as a Village '''N'''otice '''B'''oard system. See [[History of NBWiki]].
!!Help for installers
Please visit the [!NBWiki website!http://www.nomaz.co.uk/nbwiki/!].
!!Help for editors
Please see [[Page markup in NBWiki]].
''If you only see "Locked Page", you do not have permission to edit a page. This will probably be because you are not set up to edit it, but could be due to a file or folder permission problem. Contact your Wiki Administrator''
!Help for viewers
If you have reached this page you probably know how to browse the Internet. Looking at NBWiki pages and navigating between them is essentially the same as browsing other web pages. '''Recent Changes''' and '''Search''' facilities are available above and below the contents area.
----
==== end ====
Save in pages directory as Help.txt
Replace the editing window contents with the following:
====start====
[[Licence terms for NBWiki]]
----
NBWiki is derived from and is made available of the same terms as roWiki. These are stated below.
----
!license
roWiki: Copyright 2003, 2004, Marc Rohlfing
NBWiki: Copyright 2005 Nomaz (Nomaz is a trading name of Richard J Bowers)
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
----
==== end ====
Save in pages directory as Licence terms for NBWiki.txt
Replace the editing window contents with the following:
====start====
{{{A totally blank line here would get thrown away.}}}
{%|!!!!Welcome...||
||| ||!!to '''NBWiki''' from '''[!Nomaz|http://www.nomaz.co.uk!]'''
||| ||'''NBWiki''' is based on the freeware '''[!roWiki|http://www.rowlff.de/rowiki/!]''' created by Marc Rohlfing.||}
NBWiki was developed from roWiki in order to provide an electronic Village Notice Board within which different organisations could maintain their own pages using just an Internet browser program.
These pages are for anyone wishing to implement NBWiki on their own PHP enabled website. A complete "startup" system can be downloaded. There is no charge for deploying or using NBWiki but deployment and use are subject to [!licence terms|http://www.nomaz.co.uk/nbwiki/index.php?page=Licence%20terms%20for%20NBWiki!].
!!Index to main sections
*[[Licence terms for NBWiki]]
*[[Page markup in NBWiki]]
*[[Help]] might help if you are stuck.
Here you can try a [|downloading a text file|Testdownload.txt|].
If you have uploaded a test image called image.jpg it should follow now:
[%A test image|image.jpg|]
{{{This does not show. It is to stop the blank lines at then end being stipped off}}}
==== end ====
Save in pages directory as NBWiki home page.txt
Replace the editing window contents with the following:
====start====
[[Page markup in NBWiki]].
''In NBWiki pages are edited as plain text. This text can be "marked up" in various ways to determine how it will be displayed after you click "Save changes". This page explains the mark-up "syntax" - in other words, how you can control the look of NBWiki pages.''
----
!!Basic text formatting rules
*Linebreaks (normally created by the Return or Enter key) are just that - linebreaks. Flowing text (where you don't press Enter) will be word-wrapped to fit the viewing window. Use two linebreaks between paragraphs.
*To make text appear in ''italics'', put two single quote marks both before and after it, like this: '{{}}'italics'{{}}'.
*To make text appear '''bold''', put three single quote marks both before and after it, like this: '{{}}'{{}}'bold'{{}}'{{}}'.
*Four dashes (----) alone on a line yield a horizontal "ruler" line
*Starting a line with exclamation marks (e.g. !!) shows it as a heading. The more the bigger - up to four.
*Bulleted lists (like this one) can be created by prefixing each line with an asterisk (*).
*Numbered lists are similar but start with a hash (#).
*Wiki links - links to pages within the Wiki - are created using double square brackets, thus: [{{}}[A page name]]. Page names may include letters, numerals, spaces and the special symbols commonly permitted in file names. Case may well be important - If the Web host is running (say) Linux then '''A''' will not equal '''a''' in page names.
*If the target of a clicked Wiki link does not exist a new page will be created.
*Generally, multiple spaces are retained.
!!Images to be displayed within the Wiki
*If the image is stored with the Wiki: [{{}}%Description|file name%]. The image file must be supplied to the administrator for uploading.
*If the image file is elsewhere on the Internet: [{{}}%Description|URL%]. The URL must commense with http:// .
The descriptions are used to provide alternative text, e.g. for use by text only browsers.
!!Links to non-Wiki documents etc.
Links can be included to websites, text documents, picture files, etc.
*To create a link to a non-Wiki file stored with the Wiki use [{{}}|Description|file name|]. The description is displayed as a link. The file must be supplied to the administrator for uploading.
*To create a link to another website or to a file stored elsewhere on the Internet, use [{{}}!Description|URL!]. The description is displayed as a link. The URL, which may contain spaces, must be complete (e.g. http://www.... not just www....).
*To do the same but forcing the referenced page to appear in a new window, use [{{}}!Description!URL!] - this has exclamation point rather than a vertical bar separating the description and URL.
!!Tables
Tables are defined using various combinations of curly brackets, vertical bars and percent signs.
!Simple tables
These use the following markup sequences
*To start the table: {|{{}}| if visible ruler lines are required, or {%{{}}| if not
*To separate cells: |{{}}|
*To separate rows: |{{}}|{{}}|
*To end the table: |{{}}|} '''Don't forget this'''
For convenience when editing the last three may be placed within an editing line '''or''' on a new line. The effect will be the same.
!Cell attributes
The final vertical bar in the first three commands may be replaced by the sequence %x| where the "x" represents any valid HTML cell attributes. For example
*use {%{{}}%valign=top| to ensure that the text in the first cell of a borderless table starts at the top of that cell.
*use |{{}}%align=center bgcolor=pink rowspan=2 colspan=4| to show the text in the following cell horizontally centred in a pink "oversize" cell two normal rows deep and four normal columns wide.
!More about tables
*Anything in cell attributes ("x") not recognised not recognised by a browser is normally ignored. Experiment!
*Note the spellings of '''color''' and '''center'''.
*Hard line breaks and other normal markup within cell contents will be applied.
*Headings and list items may occur within table cells. The introductory !, * or # may occur immediately following the markup sequence introducing a cell.
*Cells may contain images, links etc.
*Tables may be nested.
!!Other markups
*Avoid unusual two-character sequences in text (such as |{{}}!) as they may be mis-interpreted. If necessary split them as described by the next item.
*Two opening curly brackets followed immediately by two closing curley brackets are removed just before display. Useful for splitting up sequences that the Wiki would otherwise treat as markup commands.
*The sequence "two opening curley brackets, any character sequence, two closing curley brackets" is intended to preserve the exact layout of the character sequence, which is displayed in a monospace font. Only partially working and subject to change so best avoided.
*The sequence "three opening curley brackets, any character sequence, three closing curley brackets" form a comment for future editors and is not displayed
==== end ====
Save in pages directory as Page markup in NBWiki.txt
Replace the editing window contents with the following:
====start====
You are at a page called [[dot]].
----
Email addresses quoted in web pages are "harvested" by automated processes for use in sending unsolicited mail (spam). For this reason email addresses are sometimes shown as pictures or disguised in other ways to make them difficult to find automatically. When you see [[dot]] on this site it is such a disguise. Just replace it with a real dot, full stop, period or whatever you call it.
''Please use your Back button to return to the page you were reading.''
==== end ====
Save in pages directory as dot.txt
Replace the editing window contents with the following:
====start====
You are at a page called [[at]].
----
Email addresses quoted in web pages are "harvested" by automated processes for use in sending unsolicited mail (spam). For this reason email addresses are sometimes shown as pictures or disguised in other ways to make them difficult to find automatically. When you see [[at]] on this site it is such a disguise. To send an email, replace [[at]] with a real '''@''' .
''Please use your Back button to return to the page you were reading.''
==== end ====
Save in pages directory as at.txt
Replace the editing window contents with the following:
====start====
This document is provided as part of the NBWiki distribution for testing the downloading
of documents. As it is a text document it will probably be shown unadorned in the downloading
browser's window. Any NBWiki text markup here, like these quote marks for '''bold''', will not
be interpreted.
==== end ====
Save in docs (NOT pages) directory as Testdownload.txt
Close the editor window.
----
Stage 8
Copy any small "jpeg" graphic file into the pics sub-directory and rename it
as image.jpg (But don't worry if you can't find one just now - you just won't be able to see
a picture straight away in your NBWiki.)
----
Stage 9
Copy the whole structure created to your website host.
----
Stage 10
Keep access restrictions on files and directories as tight as possible commensurate with
the NBWiki working. You will probably need to set the "write by anyone" permission on the
files in the pages directory as without it all content editing will be banned - not much
use for a Wiki. Some host systems need the directory permissions on "pages" changed so that
the Wiki can create new pages.
It is desirable to use your ISP's facilities to password protect all the sub-folders created,
including pages, making the relevant passwords available to chosen editors only.
----
Step 11
Try it! And remember to backup important pages regularly.
(End)
|