Example #1
0
        fclose($handle);
        $commitMessage = addslashes("Changed {$wikiPage}");
        $author = addslashes(getAuthorForUser(getUser()));
        if (!git("init")) {
            return;
        }
        if (!git("add {$wikiPage}")) {
            return;
        }
        if (!git("commit --allow-empty --no-verify --message='{$commitMessage}' --author='{$author}'")) {
            return;
        }
        if (!git("gc")) {
            return;
        }
        header("Location: " . getViewURL($wikiPage));
        return;
    }
} else {
    // Pull git changes from remote repository
    if ($wikiSubPage == "pull") {
        if (!git("pull {$GIT_REMOTE} {$GIT_BRANCH}", $wikiContent)) {
            return;
        }
        $wikiContent = implode("<br>\n", $wikiContent);
        $wikiGitAction = "pull {$GIT_REMOTE} {$GIT_BRANCH}";
        include getThemeDir() . "/gitoutput.php";
    } else {
        if ($wikiSubPage == "push") {
            if (!git("push {$GIT_REMOTE} {$GIT_BRANCH}", $wikiContent)) {
                return;
Example #2
0
                # lazy evaluation
                return;
            }
        }
        header("Location: {$BASE_URL}");
        return;
    }
    // Save
    $handle = fopen($wikiFile, 'w');
    fputs($handle, stripslashes($_POST['data']));
    fclose($handle);
    $commitMessage = addslashes("Changed {$wikiPage}");
    $author = addslashes($wikiUser);
    if (!git('init') && !git("add {$wikiPage}") && !git("commit --allow-empty --no-verify --message='{$commitMessage}' --author='{$author}'") && !git('gc')) {
        # lazy evaluation
        header('Location: ' . getViewURL($wikiPage));
    }
    return;
}
// if here, Get operations
$include = "themes/{$THEME}/history.php";
// Global history
if ($wikiPage == 'history') {
    $wikiHistory = getGitHistory();
    $wikiPage = '';
    $wikiContent = <<<__DEFAULT_HISTORY__
Welcome!<br>
No history data found.
Create a new note below.
__DEFAULT_HISTORY__;
} else {
Example #3
0
\t<h1 id="title"> {$title} </h1>
</div>

__HEADER__;
if (isset($wikiHistory[0])) {
    echo <<<__TABLE__
<div id="gitlist">
\t<table>
\t\t{$tablehdr}

__TABLE__;
    foreach ($wikiHistory as $item) {
        $date = $item['date'];
        $mailto = $item['mailto'];
        $page = $item['page'];
        $link = getViewURL($page);
        echo <<<__ROW_ENTRY__
\t\t\t<tr>
\t\t\t\t<td>{$date}</td>
\t\t\t\t<td class="author">{$mailto}</td>
\t\t\t\t<td class="page"><a href="{$link}">{$page}</a></td>
\t\t\t</tr>
__ROW_ENTRY__;
    }
    # foreach
    echo "\t</table>\n</div>\n";
} else {
    echo "<div id='content'>{$wikiContent}</div>";
}
?>
Example #4
0
__HEADER__;
if (isset($wikiHistory[0])) {
    echo <<<__TABLE__
<div id="history">
\t<table>
\t\t{$tablehdr}

__TABLE__;
    foreach ($wikiHistory as $item) {
        $date = $item['date'];
        $mailto = $item['mailto'];
        $page = $item['page'];
        $link = getViewURL($page);
        $msg = $item['message'];
        $view = getViewURL($page, $item['commit']);
        echo <<<__ROW_ENTRY__
\t\t\t<tr>
\t\t\t\t<td>{$date}</td>
\t\t\t\t<td class="author">{$mailto}</td>
\t\t\t\t<td class="page"><a href="{$link}">{$page}</a></td>
\t\t\t\t<td>{$msg}</td>
\t\t\t\t<td><a href="{$view}">View</a></td>
\t\t\t</tr>
__ROW_ENTRY__;
    }
    # foreach
    echo "\t</table>\n</div>\n";
} else {
    echo "<div id='content'>{$wikiContent}</div>";
}
Example #5
0
if (getUser() != "") {
    ?>
| Logged in as <?php 
    print getUser();
}
?>
			</p>
		</div>

		<div id="header">
			<h1 id="title">Editing <?php 
print getPage();
?>
</h1>
			<p>[ <a href="<?php 
print getViewURL(getPage());
?>
">view</a> |
				<a href="<?php 
print getHistoryURL();
?>
">history</a> ]</p>
		</div>

		<div id="form">
			<form method="post" action="<?php 
print getPostURL();
?>
">
				<p><textarea name="data" cols="80" rows="20" style="width: 100%"><?php 
print getRawData();
Example #6
0
    print getUser();
}
?>
			</p>
		</div>

		<div id="header">
			<h1 id="title"><?php 
print $historyTitle;
?>
</h1>
		</div>

		<div id="history">
			<table>
				<tr><th>Date</th><th>Author</th><th>Page</th><th>Message</th></tr>
			<?php 
foreach ($wikiHistory as $item) {
    print "<tr>" . "<td>" . $item["date"] . "</td>" . "<td class='author'>" . $item["linked-author"] . "</td>" . "<td class='page'><a href=\"" . getViewURL($item["page"]) . "\">" . $item["page"] . "</a></td>" . "<td><a href=\"" . getViewURL($item["page"], $item["commit"]) . "\">" . $item["message"] . "</a></td>" . "</tr>\n";
}
?>
			</table>
		</div>
		<div id="footer">
			<p>
				Powered by <a href="http://el-tramo.be/software/wigit">WiGit</a>.
			</p>
		</div>
	</body>
</html>