moodle/mod/wiki/ewiki/fragments/homepage.src
moodler 39fcb981b8 Wiki module, copied from contrib/wiki.
I've left out stuff that didn't seem necessary ... including a lot
of the Wiki plugins which were quote large... I'm not sure if this
is currently working ... I'm about to try it out.
2004-06-02 12:45:55 +00:00

172 lines
No EOL
3.9 KiB
Text

<?php
#-- This is an example standalone lite-CMS Homepage based on ewiki.php
# - it requires PHP4.1+
# - you should install it as index.php into your dedicated webspace
# - copy the ewiki.php there, too
# - DON'T upload the tools/ directory, as this requires a lot more
# setup to be used securely
# - HTML Editors usually allow you to tweak the layout without
# garbaging the PHP code inside
# - authentication is done using JavaScript+Cookies
# - requires a MySQL database, just visit http://freesql.org/ and
# get happy (if your provider doesn't provide one)
# - there will be no pages initially, you must first create some
# - most config options are in the upper area of this file:
$HOMEPAGE_TITLE = 'MyHomepage';
$LOGIN_PASSWORD = 'ewiki';
$AUTHOR_NAME = 'your_nickname_here';
$MYSQL_HOST = 'localhost';
$MYSQL_USER = 'root';
$MYSQL_PASSWORD = '';
$MYSQL_DATABASE = 'test';
#-- open database
if (!@mysql_ping()) {
mysql_connect($MYSQL_HOST, $MYSQL_USER, $MYSQL_PASSWORD);
mysql_query("use $MYSQL_DATABASE");
}
#-- no errors shown from here
error_reporting(0);
#-- check for password
if ($LOGIN_PASSWORD == "password") die("poor");
if ($_COOKIE["password"]) {
if ($LOGIN_PASSWORD == $_COOKIE["password"]) {
$ewiki_author = $AUTHOR_NAME;
}
else {
$page_content == "<h3>password wrong</h3>";
}
}
#-- load ewiki
define("EWIKI_EDIT_AUTHENTICATE", 1);
define("EWIKI_SCRIPT", substr(__FILE__, strrpos(__FILE__, "/") + 1) . "?page=");
define("EWIKI_SCRIPT_BINARY", substr(__FILE__, strrpos(__FILE__, "/") + 1) . "?binary=");
define("EWIKI_PAGE_INDEX", $HOMEPAGE_TITLE);
define("EWIKI_CONTROL_LINE", 0);
define("EWIKI_T_CANNOTCHANGEPAGE", "You must first login to change a page.");
include("ewiki.php");
#-- get current page
if (empty($page_content)) {
$page_content = ewiki_page();
}
?><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title><?php echo($ewiki_title); ?></title>
<meta name="GENERATOR" content="ewiki" />
<meta name="ROBOTS" content="INDEX,FOLLOW" />
<style type="text/css">
<!--
body {
background-color:#6666ee;
color:#000011;
}
.menu {
background-color:#111166;
color:#ffffff;
border: 2px solid #000055;
padding: 8px;
text-align:center;
width:120px;
}
a,a:link { color: #ffff33; text-decoration: none; }
a:active { color: #FF6666; }
a:visited { color: #660000; }
a:hover { font-weight:900; background-color:#ffff00; color:#000000; }
.menu a { color:#ffffff; }
.menu a:hover { color:#000000; }
//-->
</style>
<script language="JavaScript" type="text/javascript">
<!--
function login()
{
var password = window.prompt("Please enter the administrator password:");
window.document.cookie = "password=" + password;
window.document.location.reload();
}
function logout()
{
window.document.cookie = "password=";
}
//-->
</script>
</HEAD>
<BODY>
<CENTER>
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="10" WIDTH="90%">
<TR>
<TD WIDTH="120" VALIGN="TOP">
<DIV CLASS="menu">
<h3>Welcome to my Homepage!</h3>
<A HREF=".">Startpage</A> <BR>
<A HREF="?page=EMailMe">EMailMe</A> <BR>
<A HREF="?page=MyLinks">MyLinks</A> <BR>
<BR>
<?php
if ($ewiki_author) {
echo "<A HREF=\"javascript:logout()\">Logout</A><BR>";
echo "<A HREF=\"?page=edit/$ewiki_title\">EditThisPage</A><BR>";
echo "<A HREF=\"?page=info/$ewiki_title\">PageInfo</A><BR>";
}
else {
echo "<A HREF=\"?page=links/$ewiki_title\">Links to here</A><BR><BR>";
echo "<SMALL><A HREF=\"javascript:login()\">EditorLogin</A><BR></SMALL>";
}
?>
</DIV>
</TD>
<TD VALIGN="TOP" WIDTH="90%">
<DIV CLASS="content">
<?php
echo($page_content);
?>
</TR>
</TABLE>
</CENTER>
</BODY>
</HTML>