Example #1
0
File: file.php Project: neolao/wiki
<?php

include dirname(__FILE__) . '/../inc/common.php';
// Get the raw content
$path = $_GET['path'];
$filePath = BASE_PATH . '/' . $path;
// Check invalid file
if (isOutsideWiki($filePath)) {
    header('HTTP/1.1 404 Not Found');
    exit;
}
$config = getConfig();
$filePath = realpath($filePath);
$directoryPath = dirname($filePath);
$content = file_get_contents($filePath);
$search = new Wiki_Search();
// Auto index the page
$search->index($filePath);
// Convert the raw content to wiki content
switch ($config['syntax']) {
    case 'markdown':
        include_once INC_PATH . '/markdown/markdown.php';
        $html = Markdown($content);
        break;
    default:
        include_once INC_PATH . '/textile/Textile.php';
        $textile = new Textile();
        $html = $textile->TextileThis($content);
}
// Find the main title
$title = 'Undefined';
Example #2
0
<?php

include dirname(__FILE__) . '/../inc/common.php';
// Get parameters
if (empty($_GET['term'])) {
    die('false');
}
$term = $_GET['term'];
if (get_magic_quotes_gpc()) {
    $term = stripslashes($term);
}
$search = new Wiki_Search();
$filePaths = $search->find($term);
$urls = array();
foreach ($filePaths as $filePath) {
    if (!isOutsideWiki($filePath)) {
        $urls[] = '"' . getFileUrl($filePath) . '"';
    }
}
// Print the file urls
echo '[';
echo implode(', ', $urls);
echo ']';
Example #3
0
<?php

include dirname(__FILE__) . '/../inc/common.php';
$search = new Wiki_Search();
?>
<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8" />
        <title>Textilewiki administration</title>
    </head>
    <body>
        <h1>Textilewiki administration</h1>
        
        <h2>Search engine</h2>
        <p>Document count : <?php 
echo $search->getDocumentCount();
?>
</p>
        <ul>
            <li><a href="search/indexAllPages.php">Index all pages</a></li>
        </ul>
    </body>
</html>