// Niels: every line that start with 'Niels' is edited by me (Niels Gorisse niels@bonneville.nl)
// petit.php - Yet another WikiWikiWeb clone.
//
// Copyright (C) 2001 by sng.
//
// http://factage.com/sng/petitwiki/
//
// Special thanks
// YukiWiki by Hiroshi Yuki
//
// http://www.hyuki.com/yukiwiki/
//
// 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.
//
//# $Id: petitwiki.php 0.93 2001/11/27 18:55:30 sng Exp sng $
/////////////////////////////////////////////////
define("S_VERSION","1.00");
/////////////////////////////////////////////////
// ディレクトリ指定 最後に / が必要 属性は 777
/////////////////////////////////////////////////
// データの格納ディレクトリ
define("DATA_DIR","support/"); // IVAN: Niels, you should edit this line to reffer your server, do not forget to CHMOD the "support" folder to 777
/////////////////////////////////////////////////
// トップページの名前 // Niels: default title, but no spaces allowed!!
$defaultpage = "UserPatches";
/////////////////////////////////////////////////
// テキストエリアのカラム数
$cols = 80;
/////////////////////////////////////////////////
// テキストエリアの行数
$rows = 20;
//** 初期処理 **
$WikiName = '([A-Z][a-z]+([A-Z][a-z]+)+)';
$script = basename($_SERVER[PHP_SELF]);
$post = $HTTP_POST_VARS;
$get = $HTTP_GET_VARS;
$vars = array_merge($post,$get);
$arg = $HTTP_SERVER_VARS["argv"][0];
if(get_magic_quotes_gpc())
{
if($post["msg"]) $post["msg"] = stripslashes($post["msg"]);
}
//if(!is_writable(DATA_DIR)) die_message("data dir is not writable");
if(!file_exists(pagename_to_filename($defaultpage)))
touch(pagename_to_filename($defaultpage));
// turned off the edit NIELS......
/*
if(preg_match("/($WikiName)/",$get["edit"]))
{
if(is_page($get["edit"]))
$postdata = join("",file(pagename_to_filename($get["edit"])));
$page = $get["edit"];
$body = "\n";
}
else if(preg_match("/($WikiName)/",$post["write"]))
{
$page = $post["write"];
if($post["msg"] === "")
{
@unlink(pagename_to_filename($post["write"]));
$body = "編集内容が空だったため、$post[msg] は削除されました。 ";
}
else
{
$fp = fopen(pagename_to_filename($post["write"]),"w");
while(!flock($fp,LOCK_EX));
fputs($fp,$post["msg"]);
flock($fp,LOCK_UN);
fclose($fp);
$body = $post["msg"]; // Niels: new line
// Niels: disabled this // $body = convert_html($post["msg"]);
// Niels: disabled this // $body = "" . $body . " \n";
}
}
else */
if($get["read"] == "Index")
{
$page = "Index";
$body = "\n";
$body.= get_list();
$body.= " \n";
}
else
{
if(!preg_match("/($WikiName)/",$get["read"]))
$get["read"] = $defaultpage;
$aryfilebody = array();
$aryfilebody = file(pagename_to_filename($get["read"]));
$filebody = join("",$aryfilebody);
$page = $get["read"];
$body = $filebody; // Niels: new line
// Niels: disabled this // $body = convert_html($filebody);
// Niels: disabled this // $body = "" . $body . " \n";
}
catbody($page,$body);
function catbody($page,$body)
{
global $script,$defaultpage;
?>
| |