// Copyright (C) 2010 Winch Gate Property Limited // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as // published by the Free Software Foundation, either version 3 of the // License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . include('html_headers.php'); include('sql_connection.php'); $file = getVar('file'); $topic = getVar('topic'); $edit = getVar('edit'); $help_body = getVar('help_body'); $update = getVar('update'); htmlProlog($_SERVER['PHP_SELF'], "Help for '$file/$topic'", false); $result = defaultConnectToDatabase(); if ($result) { echo "Can't find help, database connection failed.
[$result]
\n"; } else { $view = true; if ($edit) { echo "

Edit help for $file/$topic
\n"; echo "Hints/Warning: Text note is not processed, and will be display as is, meaning that all HTML tags must be valid.\n"; echo "References to other help pages are formatted like
<a href='help.php?file=file&topic=topic'>blahblah</a>
\n"; echo "where file referres to a valid php file (e.g. /index.php) and topic to a valid topic name. For common Help Notes, file should be set to 'common'.\n"; 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.)
\n"; $result = mysql_query("SELECT help_body FROM help_topic WHERE file='$file' AND topic='$topic'"); $help_body = "[Write your help note here]"; if ($result && ($arr=mysql_fetch_array($result))) $help_body = $arr["help_body"]; echo "

\n"; echo "
\n"; echo "
\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "
\n"; echo "
\n"; $view = false; } else if ($update) { mysql_query("DELETE FROM help_topic WHERE file='$file' AND topic='$topic'"); mysql_query("INSERT INTO help_topic SET file='$file', topic='$topic', help_body='$help_body'"); } if ($view) { $result = mysql_query("SELECT help_body FROM help_topic WHERE file='$file' AND topic='$topic'"); if ($result && ($body=mysql_fetch_array($result))) { echo "Help for '$file/$topic':
\n"; echo "Edit Help

\n"; echo "

".ereg_replace("\x7b([^\x7d]+)\x7d", "\\1", nl2br($body["help_body"]))."
\n"; } else { echo "No help found for '$file/$topic'.
\n"; echo "If you want to create an Help note for this topic, click here.\n"; } } } htmlEpilog(false); ?>