2 // NeL - MMORPG Framework <http://dev.ryzom.com/projects/nel/>
3 // Copyright (C) 2010 Winch Gate Property Limited
5 // This program is free software: you can redistribute it and/or modify
6 // it under the terms of the GNU Affero General Public License as
7 // published by the Free Software Foundation, either version 3 of the
8 // License, or (at your option) any later version.
10 // This program is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 // GNU Affero General Public License for more details.
15 // You should have received a copy of the GNU Affero General Public License
16 // along with this program. If not, see <http://www.gnu.org/licenses/>.
18 include('html_headers.php');
19 include('sql_connection.php');
21 $file = getVar('file');
22 $topic = getVar('topic');
23 $edit = getVar('edit');
24 $help_body = getVar('help_body');
25 $update = getVar('update');
27 htmlProlog($_SERVER['PHP_SELF'], "Help for '$file/$topic'", false);
29 $result = defaultConnectToDatabase();
32 echo "Can't find help, database connection failed.<br>[$result]<br>\n";
39 echo "<p align=justify><b>Edit help</b> for <b>$file/$topic</b><br>\n";
40 echo "<i>Hints/Warning:</i> Text note is not processed, and will be display as is, meaning that all HTML tags <b>must</b> be valid.\n";
41 echo "References to other help pages are formatted like<br><a href='help.php?file=<i>file</i>&topic=<i>topic</i>'><i>blahblah</i></a><br>\n";
42 echo "where <i>file</i> referres to a valid php file (e.g. /index.php) and <i>topic</i> to a valid topic name. For common Help Notes, <i>file</i> should be set to 'common'.\n";
43 echo "You may also use curved brackets '{' and '}' to point to a link (e.g. 'info about {NeL}' will point to a common help note on 'NeL' topic.)<br>\n";
44 $result = mysql_query("SELECT help_body FROM help_topic WHERE file='$file' AND topic='$topic'");
45 $help_body = "[Write your help note here]";
46 if ($result && ($arr=mysql_fetch_array($result)))
47 $help_body = $arr["help_body"];
50 echo "<form method=post action='".$_SERVER['PHP_SELF']."'>\n";
51 echo "<textarea name=help_body rows=10 cols=70>$help_body</textarea><br>\n";
52 echo "<input type=submit name='update' value='Update'>\n";
53 echo "<input type=submit value='Cancel'>\n";
54 echo "<input type=hidden name=file value='$file'>\n";
55 echo "<input type=hidden name=topic value='$topic'>\n";
62 mysql_query("DELETE FROM help_topic WHERE file='$file' AND topic='$topic'");
63 mysql_query("INSERT INTO help_topic SET file='$file', topic='$topic', help_body='$help_body'");
68 $result = mysql_query("SELECT help_body FROM help_topic WHERE file='$file' AND topic='$topic'");
69 if ($result && ($body=mysql_fetch_array($result)))
71 echo "<b>Help for '$file/$topic':</b><br>\n";
72 echo "<a href='".$_SERVER['PHP_SELF']."?edit=1&file=$file&topic=$topic'>Edit Help</a><br><hr>\n";
73 echo "<p align=justify>".ereg_replace("\x7b([^\x7d]+)\x7d", "<a href='".$_SERVER['PHP_SELF']."?file=common&topic=\\1'>\\1</a>", nl2br($body["help_body"]))."<br>\n";
77 echo "<b>No help found for '$file/$topic'.</b><br>\n";
78 echo "If you want to create an <b>Help note</b> for this topic, <a href='".$_SERVER['PHP_SELF']."?edit=1&file=$file&topic=$topic'>click here</a>.\n";