WikiSetupWizard\n";
$o .= "You don't have any pages in your Wiki yet, so we should try to read-in the default ones from init-pages/ now.
";
$o .= '"now")).'">[InitializeWikiDatabase]';
$o .= " ";
$o .= '"this")).'">[NoThanks]';
$o .= "
";
#-- analyze and print settings and misconfigurations
$pf_db = $ewiki_plugins["database"][0];
$db = substr($pf_db, strrpos($pf_db, "_") + 1);
$o .= '
';
$o .= 'DatabaseBackend | ';
$o .= "" . $db . " ";
if ($db == "files") {
$o .= "_DBFILES_DIR='" . EWIKI_DBFILES_DIRECTORY . "'";
if (strpos(EWIKI_DBFILES_DIRECTORY, "tmp")) {
$o .= " Warning: Storing your pages into a temporary directory is not what you want (there they would get deleted randomly), except for testing purposes of course. See the README.";
}
}
else {
$o .= "(looks ok)";
}
$o .= " |
";
$o .= 'WikiSoftware | ewiki '.EWIKI_VERSION." |
";
$o .= "
";
#-- more diagnosis
if (ini_get("magic_quotes")) {
$o.= "Warning: Your PHP interpreter has enabled the ugly and outdated 'magic_quotes'. This will lead to problems, so please ask your provider to correct it; or fix it yourself with .htaccess settings as documented in the README. Otherwise don't forget to include() the fragments/strip_wonderful_slashes.php (it's ok to proceed for the moment).
";
}
if (ini_get("register_globals")) {
$o.= "Security warning: The horrible 'register_globals' setting is enabled. Without always using fragments/strike_register_globals.php or letting your provider fix that, you could get into trouble some day.
";
}
return('' . $o . '
');
}
#-- actually initialize the database
else {
ewiki_database("INIT", array());
if ($dh = @opendir($path=EWIKI_INIT_PAGES)) {
while (false !== ($filename = readdir($dh))) {
if (preg_match('/^(['.EWIKI_CHARS_U.']+['.EWIKI_CHARS_L.']+\w*)+/', $filename)) {
$found = ewiki_database("FIND", array($filename));
if (! $found[$filename]) {
$content = implode("", file("$path/$filename"));
ewiki_scan_wikiwords($content, $ewiki_links, "_STRIP_EMAIL=1");
$refs = "\n\n" . implode("\n", array_keys($ewiki_links)) . "\n\n";
$save = array(
"id" => "$filename",
"version" => "1",
"flags" => "1",
"content" => $content,
"author" => ewiki_author("ewiki_initialize"),
"refs" => $refs,
"lastmodified" => filemtime("$path/$filename"),
"created" => filectime("$path/$filename") // (not exact)
);
ewiki_database("WRITE", $save);
}
}
}
closedir($dh);
}
else {
return("ewiki error: could not read from directory ". realpath($path) ."
\n");
}
#-- try to view/ that newly inserted page
if ($data = ewiki_database("GET", array("id"=>$id))) {
$action = "view";
}
#-- let ewiki_page() proceed as usual
return("");
}
}
}
?>