本文整理汇总了PHP中ewiki_db::INIT方法的典型用法代码示例。如果您正苦于以下问题:PHP ewiki_db::INIT方法的具体用法?PHP ewiki_db::INIT怎么用?PHP ewiki_db::INIT使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ewiki_db
的用法示例。
在下文中一共展示了ewiki_db::INIT方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: ewiki_initialization_wizard
function ewiki_initialization_wizard($id, &$data, &$action)
{
global $ewiki_plugins;
#-- proceed only if frontpage missing or explicetely requested
if (strtolower($id) == "wikisetupwizard" || $id == EWIKI_PAGE_INDEX && $action == "edit" && empty($data["version"]) && !$_REQUEST["abort"]) {
if ($_REQUEST["abort"]) {
} elseif (empty($_REQUEST["init"])) {
$o = "<h2>WikiSetupWizard</h2>\n";
$o .= "You don't have any pages in your Wiki yet, so we should try to read-in the default ones from <tt>init-pages/</tt> now.<br /><br />";
$o .= '<a href="' . ewiki_script("", $id, array("init" => "now")) . '">[InitializeWikiDatabase]</a>';
$o .= " ";
$o .= '<a href="' . ewiki_script("", $id, array("abort" => "this")) . '">[NoThanks]</a>';
$o .= "<br /><br />";
#-- analyze and print settings and misconfigurations
$pf_db = $ewiki_plugins["database"][0];
$db = substr("_{$pf_db}", strrpos($pf_db, "_") + 1);
$o .= '<table border="0" width="90%" class="diagnosis">';
$o .= '<tr><td>DatabaseBackend</td><td>';
$o .= "<b>" . $db . "</b><br />";
if ($db == "files" || strstr($db, "f2")) {
$o .= "<small>_DBFILES_DIR='</small><tt>" . EWIKI_DBFILES_DIRECTORY . "'</tt>";
if (strpos(EWIKI_DBFILES_DIRECTORY, "tmp")) {
$o .= "<br /><b>Warning</b>: 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 .= "</td></tr>";
$o .= '<tr><td>WikiSoftware</td><td>ewiki ' . EWIKI_VERSION . "</td></tr>";
$o .= "</table>";
#-- more diagnosis
if (ini_get("magic_quotes")) {
$o .= "<b>Warning</b>: Your PHP interpreter has enabled the ugly and outdated '<i>magic_quotes</i>'. 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 <tt>fragments/strip_wonderful_slashes.php</tt> (it's ok to proceed for the moment).<br /><br />";
}
if (ini_get("register_globals")) {
$o .= "<b>Security warning</b>: The horrible '<i>register_globals</i>' setting is enabled. Without always using <tt>fragments/strike_register_globals.php</tt> or letting your provider fix that, you could get into trouble some day.<br /><br />";
}
return '<div class="wiki view WikiSetupWizard">' . $o . '</div>';
} else {
ewiki_db::INIT();
if ($dh = @opendir($path = EWIKI_INIT_PAGES)) {
while ($filename = readdir($dh)) {
if (preg_match('/^([' . EWIKI_CHARS_U . ']+[' . EWIKI_CHARS_L . ']+\\w*)+/', $filename)) {
$found = ewiki_db::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}"));
ewiki_db::WRITE($save);
}
}
}
closedir($dh);
ewiki_log("initializing database", 0);
} else {
return "<b>ewiki error</b>: could not read from directory " . realpath($path) . "<br />\n";
}
#-- try to view/ that newly inserted page
if ($data = ewiki_db::GET($id)) {
$action = "view";
}
#-- let ewiki_page() proceed as usual
return "";
}
}
}