autoformat, minor corrections
This commit is contained in:
parent
8b3023aca7
commit
0974466e37
19 changed files with 334 additions and 290 deletions
|
@ -3,22 +3,26 @@
|
||||||
// All credit goes to Chad Minick:
|
// All credit goes to Chad Minick:
|
||||||
// http://chadminick.com/articles/simple-php-template-engine.html
|
// http://chadminick.com/articles/simple-php-template-engine.html
|
||||||
|
|
||||||
class Template {
|
class Template
|
||||||
private $vars = array();
|
{
|
||||||
|
private $vars = array();
|
||||||
|
|
||||||
public function __get($name) {
|
public function __get($name)
|
||||||
|
{
|
||||||
return $this->vars[$name];
|
return $this->vars[$name];
|
||||||
}
|
}
|
||||||
|
|
||||||
public function __set($name, $value) {
|
public function __set($name, $value)
|
||||||
if($name == 'view_template_file') {
|
{
|
||||||
|
if ($name == 'view_template_file') {
|
||||||
throw new Exception("Cannot bind variable named 'view_template_file'");
|
throw new Exception("Cannot bind variable named 'view_template_file'");
|
||||||
}
|
}
|
||||||
$this->vars[$name] = $value;
|
$this->vars[$name] = $value;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function render($view_template_file) {
|
public function render($view_template_file)
|
||||||
if(array_key_exists('view_template_file', $this->vars)) {
|
{
|
||||||
|
if (array_key_exists('view_template_file', $this->vars)) {
|
||||||
throw new Exception("Cannot bind variable called 'view_template_file'");
|
throw new Exception("Cannot bind variable called 'view_template_file'");
|
||||||
}
|
}
|
||||||
extract($this->vars);
|
extract($this->vars);
|
||||||
|
|
|
@ -1,25 +1,27 @@
|
||||||
<div class="text document edit-form">
|
<div class="text document edit-form">
|
||||||
<form method="post" id="form" action="admin.php?action=edit_item<?= empty($doc) ? "" : "&item=" . $doc["ID"] ?>" enctype="multipart/form-data">
|
<form method="post" id="form" action="admin.php?action=edit_item<?= empty($doc) ? "" : "&item=" . $doc["ID"] ?>"
|
||||||
|
enctype="multipart/form-data">
|
||||||
<strong>Title:</strong> <input type="text" name="Title" value="<?= empty($doc) ? "" : $doc["Title"] ?>"><br>
|
<strong>Title:</strong> <input type="text" name="Title" value="<?= empty($doc) ? "" : $doc["Title"] ?>"><br>
|
||||||
<strong>Author:</strong> <input type="text" name="Author" value="<?= empty($doc) ? "" : $doc["Author"] ?>"><br>
|
<strong>Author:</strong> <input type="text" name="Author" value="<?= empty($doc) ? "" : $doc["Author"] ?>"><br>
|
||||||
<strong>Date published:</strong> <input type="text" name="Published" value="<?= empty($doc) ? "" : $doc["Published"] ?>"><br>
|
<strong>Date published:</strong> <input type="text" name="Published"
|
||||||
|
value="<?= empty($doc) ? "" : $doc["Published"] ?>"><br>
|
||||||
<strong>Description:</strong><br>
|
<strong>Description:</strong><br>
|
||||||
<textarea name="Description" cols="120" rows="20">
|
<textarea name="Description" cols="120" rows="20">
|
||||||
<?= empty($doc) ? "" : $doc["Description"] ?>
|
<?= empty($doc) ? "" : $doc["Description"] ?>
|
||||||
</textarea><br>
|
</textarea><br>
|
||||||
<strong>File:</strong> <input type="file" name="upfile"><br>
|
<strong>File:</strong> <input type="file" name="upfile"><br>
|
||||||
<strong>URL:</strong> <input type="text" name="URL" value="<?= empty($doc) ? "" : $doc["URL"] ?>"><br>
|
<strong>URL:</strong> <input type="text" name="URL" value="<?= empty($doc) ? "" : $doc["URL"] ?>"><br>
|
||||||
<strong>Tags:</strong> <input type="text" name="Tags" value="<?
|
<strong>Tags:</strong> <input type="text" name="Tags" value="<?
|
||||||
if ( !empty($doc) ){
|
if (!empty($doc)) {
|
||||||
$tags = [];
|
$tags = [];
|
||||||
foreach ($doc["tags"] as $tag){
|
foreach ($doc["tags"] as $tag) {
|
||||||
array_push($tags, $tag["Name"]);
|
array_push($tags, $tag["Name"]);
|
||||||
}
|
}
|
||||||
echo implode(", ", $tags);
|
echo implode(", ", $tags);
|
||||||
} else if ( !empty($_GET["tag"]) ) {
|
} else if (!empty($_GET["tag"])) {
|
||||||
echo $_GET["tag"];
|
echo $_GET["tag"];
|
||||||
}
|
}
|
||||||
?>"><br>
|
?>"><br>
|
||||||
<input type="submit">
|
<input type="submit">
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -1,30 +1,30 @@
|
||||||
<?php if (isset($tag)): ?>
|
<?php if (isset($tag)): ?>
|
||||||
<div class="text tag-text">
|
<div class="text tag-text">
|
||||||
<h1><?= $tag["Name"] ?></h1>
|
<h1><?= $tag["Name"] ?></h1>
|
||||||
<p class="tag-desc"><?= $tag["Description"] ?></p>
|
<p class="tag-desc"><?= $tag["Description"] ?></p>
|
||||||
<a class="tag-edit-link" href="?action=edit_tag&tag=<?= $tag["ID"] ?>">[edit tag]</a>
|
<a class="tag-edit-link" href="?action=edit_tag&tag=<?= $tag["ID"] ?>">[edit tag]</a>
|
||||||
</div>
|
</div>
|
||||||
<? endif; ?>
|
<? endif; ?>
|
||||||
|
|
||||||
<?php if ($_GET["tag"] != "*" &&
|
<?php if ($_GET["tag"] != "*" &&
|
||||||
$_GET["tag"] != "_"): ?>
|
$_GET["tag"] != "_"): ?>
|
||||||
<div class="text doc-item doc-new-item">
|
<div class="text doc-item doc-new-item">
|
||||||
<a href="?action=new_item&tag=<?= $tag["Name"] ?>">
|
<a href="?action=new_item&tag=<?= $tag["Name"] ?>">
|
||||||
<div class="doc-item-text">
|
<div class="doc-item-text">
|
||||||
<h2>Upload a new document</h2>
|
<h2>Upload a new document</h2>
|
||||||
</div>
|
</div>
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
<? endif; ?>
|
<? endif; ?>
|
||||||
|
|
||||||
<?php foreach($docs as $doc): ?>
|
<?php foreach ($docs as $doc): ?>
|
||||||
<div class="text doc-item">
|
<div class="text doc-item">
|
||||||
<a class="doc-item-link" href="?action=remove&item=<?= $doc["ID"] ?>">[X]</a>
|
<a class="doc-item-link" href="?action=remove&item=<?= $doc["ID"] ?>">[X]</a>
|
||||||
<a href="?action=edit_item&item=<?= $doc["ID"]?>">
|
<a href="?action=edit_item&item=<?= $doc["ID"] ?>">
|
||||||
<div class="doc-item-text">
|
<div class="doc-item-text">
|
||||||
<h2><?= $doc["Title"]?></h2>
|
<h2><?= $doc["Title"] ?></h2>
|
||||||
<h3><?= $doc["Author"] . " " . $doc['date']?></h3>
|
<h3><?= $doc["Author"] . " " . $doc['date'] ?></h3>
|
||||||
</div>
|
</div>
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
<?php endforeach; ?>
|
<?php endforeach; ?>
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
<div class="text">
|
<div class="text">
|
||||||
<p>Confirm deletion of <strong>"<?= $doc["Title"] ?>"</strong>:</p>
|
<p>Confirm deletion of <strong>"<?= $doc["Title"] ?>"</strong>:</p>
|
||||||
<a href="admin.php?action=remove&confirm=yes&item=<?= $doc["ID"] ?>&ret=<?= $_SERVER['HTTP_REFERER']; ?>" class="button">Remove from database</a>
|
<a href="admin.php?action=remove&confirm=yes&item=<?= $doc["ID"] ?>&ret=<?= $_SERVER['HTTP_REFERER']; ?>"
|
||||||
|
class="button">Remove from database</a>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -2,9 +2,9 @@
|
||||||
<form method="post" id="form" action="admin.php?action=edit_tag<?= empty($tag) ? "" : "&tag=" . $tag["ID"] ?>">
|
<form method="post" id="form" action="admin.php?action=edit_tag<?= empty($tag) ? "" : "&tag=" . $tag["ID"] ?>">
|
||||||
<strong>Name:</strong> <input type="text" name="Name" value="<?= empty($tag) ? "" : $tag["Name"] ?>"><br>
|
<strong>Name:</strong> <input type="text" name="Name" value="<?= empty($tag) ? "" : $tag["Name"] ?>"><br>
|
||||||
<strong>Description:</strong><br>
|
<strong>Description:</strong><br>
|
||||||
<textarea name="Description" cols="120" rows="20">
|
<textarea name="Description" cols="120" rows="20">
|
||||||
<?= empty($tag) ? "" : $tag["Description"] ?>
|
<?= empty($tag) ? "" : $tag["Description"] ?>
|
||||||
</textarea><br>
|
</textarea><br>
|
||||||
<input type="submit">
|
<input type="submit">
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -1,45 +1,45 @@
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html lang="en">
|
<html lang="en">
|
||||||
<head>
|
<head>
|
||||||
<meta charset="utf-8">
|
<meta charset="utf-8">
|
||||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||||
|
|
||||||
<title>pile ADMIN INTERFACE</title>
|
<title>pile ADMIN INTERFACE</title>
|
||||||
|
|
||||||
<link rel="stylesheet" type="text/css" href="assets/admin.css">
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
|
|
||||||
<div id="sidebar">
|
<link rel="stylesheet" type="text/css" href="assets/admin.css">
|
||||||
<div id="sidebar-head">
|
</head>
|
||||||
<h1><a href="admin.php">pile admin</a></h1>
|
<body>
|
||||||
</div>
|
|
||||||
<div id="sidebar-taglist">
|
|
||||||
<ul id="sidebar-taglist-overview">
|
|
||||||
<li id="sidebar-taglist-top"><a href="?tag=*">ALL (<?= $all_count ?>)</a></li>
|
|
||||||
<li id="sidebar-taglist-top"><a href="?tag=_">UNTAGGED (<?= $none_count ?>)</a></li>
|
|
||||||
<li id="sidebar-taglist-top"><a href="?action=new_tag">ADD TAG</a></li>
|
|
||||||
</ul>
|
|
||||||
<ul>
|
|
||||||
<?
|
|
||||||
foreach($tags as $tag){
|
|
||||||
echo '<li><a href="?tag=' . $tag['name'] . "\">" . $tag['name'] . " (" . $tag['count'] . ")</a></li>";
|
|
||||||
}
|
|
||||||
?>
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div id="content">
|
<div id="sidebar">
|
||||||
<?php echo $content ?>
|
<div id="sidebar-head">
|
||||||
</div>
|
<h1><a href="admin.php">pile admin</a></h1>
|
||||||
|
</div>
|
||||||
<div id="login">
|
<div id="sidebar-taglist">
|
||||||
<form method="get">
|
<ul id="sidebar-taglist-overview">
|
||||||
<input type="hidden" name="action" value="logout">
|
<li id="sidebar-taglist-top"><a href="?tag=*">ALL (<?= $all_count ?>)</a></li>
|
||||||
<button type="submit" id="login-button">log out</button>
|
<li id="sidebar-taglist-top"><a href="?tag=_">UNTAGGED (<?= $none_count ?>)</a></li>
|
||||||
</form>
|
<li id="sidebar-taglist-top"><a href="?action=new_tag">ADD TAG</a></li>
|
||||||
</div>
|
</ul>
|
||||||
|
<ul>
|
||||||
|
<?
|
||||||
|
foreach ($tags as $tag) {
|
||||||
|
echo '<li><a href="?tag=' . $tag['name'] . "\">" . $tag['name'] . " (" . $tag['count'] . ")</a></li>";
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div id="content">
|
||||||
|
<?php echo $content ?>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div id="login">
|
||||||
|
<form method="get">
|
||||||
|
<input type="hidden" name="action" value="logout">
|
||||||
|
<button type="submit" id="login-button">log out</button>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
|
@ -1,19 +1,19 @@
|
||||||
<?php if (isset($tag)): ?>
|
<?php if (isset($tag)): ?>
|
||||||
<div class="text tag-text">
|
<div class="text tag-text">
|
||||||
<h1><?= $tag["Name"] ?></h1>
|
<h1><?= $tag["Name"] ?></h1>
|
||||||
<p class="tag-desc"><?= $tag["Description"] ?></p>
|
<p class="tag-desc"><?= $tag["Description"] ?></p>
|
||||||
</div>
|
</div>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
|
|
||||||
<?php foreach($docs as $doc): ?>
|
<?php foreach ($docs as $doc): ?>
|
||||||
<div class="text doc-item">
|
<div class="text doc-item">
|
||||||
<?php if (!empty($doc["URL"])): ?>
|
<?php if (!empty($doc["URL"])): ?>
|
||||||
<a class="doc-item-link" href="<?= $doc["URL"] ?>">🔗</a>
|
<a class="doc-item-link" href="<?= $doc["URL"] ?>">🔗</a>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
<a href="?item=<?= $doc["ID"]?>">
|
<a href="?item=<?= $doc["ID"] ?>">
|
||||||
<div class="doc-item-text">
|
<div class="doc-item-text">
|
||||||
<h2><?= $doc["Title"]?></h2>
|
<h2><?= $doc["Title"] ?></h2>
|
||||||
<h3><?= $doc["Author"] . " " . $doc['date']?></h3>
|
<h3><?= $doc["Author"] . " " . $doc['date'] ?></h3>
|
||||||
</div>
|
</div>
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -1,29 +1,32 @@
|
||||||
<div class="text document">
|
<div class="text document">
|
||||||
<h1><?= $doc["Title"] ?></h1>
|
<h1><?= $doc["Title"] ?></h1>
|
||||||
|
|
||||||
<?php if (!empty($doc["Author"])): ?>
|
<?php if (!empty($doc["Author"])): ?>
|
||||||
<h2><?= $doc["Author"] ?></h2>
|
<h2><?= $doc["Author"] ?></h2>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
|
|
||||||
<?php if (!empty($doc["Published"])): ?>
|
<?php if (!empty($doc["Published"])): ?>
|
||||||
<h3>Published: <?= $doc["Published"] ?></h3>
|
<h3>Published: <?= $doc["Published"] ?></h3>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
|
|
||||||
<?php if (!empty($doc["tags"])): ?>
|
<?php if (!empty($doc["tags"])): ?>
|
||||||
<h3 class="doc-taglist">Tags:
|
<h3 class="doc-taglist">Tags:
|
||||||
<?
|
<?
|
||||||
foreach($doc["tags"] as $tag){
|
foreach ($doc["tags"] as $tag) {
|
||||||
echo '<li><a href="?tag=' . $tag["Name"] . "\">" . $tag["Name"] . "</a></li>";
|
echo '<li><a href="?tag=' . $tag["Name"] . "\">" . $tag["Name"] . "</a></li>";
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
</h3>
|
</h3>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
|
|
||||||
<?php if (!empty($doc["Description"])): ?>
|
<?php if (!empty($doc["Description"])): ?>
|
||||||
<p class="doc-description"><span class="doc-description-intro"><?= empty($doc["URL"]) ? "Content" : "Description" ?>: </span><?= $doc["Description"] ?></p>
|
<p class="doc-description"><span
|
||||||
|
class="doc-description-intro"><?= empty($doc["URL"]) ? "Content" : "Description" ?>
|
||||||
|
: </span><?= $doc["Description"] ?></p>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
|
|
||||||
<?php if (!empty($doc["URL"])): ?>
|
<?php if (!empty($doc["URL"])): ?>
|
||||||
<div class="doc-link"><span class="doc-link-intro">Access file at: </span><a href="<?= $doc["URL"] ?>"><?= urldecode($doc["URL"]) ?></a></div>
|
<div class="doc-link"><span class="doc-link-intro">Access file at: </span><a
|
||||||
|
href="<?= $doc["URL"] ?>"><?= urldecode($doc["URL"]) ?></a></div>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -1,5 +1,8 @@
|
||||||
<div class="text">
|
<div class="text">
|
||||||
<p class="intro"> This site is the sdbs pile, where we upload the stuff we consider important to the larger conceptual and thematic landscape of what we do: "confronting apathy", inter-subjectivity, the human right to self-determination, counter-culture and such...</p>
|
<p class="intro"> This site is the sdbs pile, where we upload the stuff we consider important to the larger
|
||||||
<p class="intro czech">Tohle je hromádka zajímavýho materiálu co něco znamená v kontextu sdbs - budeme sem postupně dávat ty nejdůležitější nebo nejzajímavější věci, zatim se o tom ale nikde moc nešiřte.</p>
|
conceptual and thematic landscape of what we do: "confronting apathy", inter-subjectivity, the human right to
|
||||||
|
self-determination, counter-culture and such...</p>
|
||||||
|
<p class="intro czech">Tohle je hromádka zajímavýho materiálu co něco znamená v kontextu sdbs - budeme sem postupně
|
||||||
|
dávat ty nejdůležitější nebo nejzajímavější věci, zatim se o tom ale nikde moc nešiřte.</p>
|
||||||
<p class="intro sign">/-\</p>
|
<p class="intro sign">/-\</p>
|
||||||
</div>
|
</div>
|
|
@ -1,67 +1,71 @@
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html lang="en">
|
<html lang="en">
|
||||||
<head>
|
<head>
|
||||||
<meta charset="utf-8">
|
<meta charset="utf-8">
|
||||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||||
|
|
||||||
<title>The /-\ pile</title>
|
<title>The /-\ pile</title>
|
||||||
|
|
||||||
<link rel="stylesheet" type="text/css" href="assets/main.css">
|
<link rel="stylesheet" type="text/css" href="assets/main.css">
|
||||||
|
|
||||||
<!-- Piwik -->
|
<!-- Piwik -->
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
var _paq = _paq || [];
|
var _paq = _paq || [];
|
||||||
_paq.push(['trackPageView']);
|
_paq.push(['trackPageView']);
|
||||||
_paq.push(['enableLinkTracking']);
|
_paq.push(['enableLinkTracking']);
|
||||||
(function() {
|
(function () {
|
||||||
var u="//www.sdbs.cz/piwik/";
|
var u = "//www.sdbs.cz/piwik/";
|
||||||
_paq.push(['setTrackerUrl', u+'piwik.php']);
|
_paq.push(['setTrackerUrl', u + 'piwik.php']);
|
||||||
_paq.push(['setSiteId', '2']);
|
_paq.push(['setSiteId', '2']);
|
||||||
var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0];
|
var d = document, g = d.createElement('script'), s = d.getElementsByTagName('script')[0];
|
||||||
g.type='text/javascript'; g.async=true; g.defer=true; g.src=u+'piwik.js'; s.parentNode.insertBefore(g,s);
|
g.type = 'text/javascript';
|
||||||
})();
|
g.async = true;
|
||||||
</script>
|
g.defer = true;
|
||||||
<noscript><p><img src="//www.sdbs.cz/piwik/piwik.php?idsite=2" style="border:0;" alt="" /></p></noscript>
|
g.src = u + 'piwik.js';
|
||||||
<!-- End Piwik Code -->
|
s.parentNode.insertBefore(g, s);
|
||||||
</head>
|
})();
|
||||||
<body>
|
</script>
|
||||||
|
<noscript><p><img src="//www.sdbs.cz/piwik/piwik.php?idsite=2" style="border:0;" alt=""/></p></noscript>
|
||||||
|
<!-- End Piwik Code -->
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
|
||||||
<div id="sidebar">
|
<div id="sidebar">
|
||||||
<div id="sidebar-head">
|
<div id="sidebar-head">
|
||||||
<h1><a href="..">The /-\ pile</a></h1>
|
<h1><a href="..">The /-\ pile</a></h1>
|
||||||
</div>
|
</div>
|
||||||
<div id="sidebar-taglist">
|
<div id="sidebar-taglist">
|
||||||
<ul>
|
<ul>
|
||||||
<li id="sidebar-taglist-top"><a href="?tag=*">ALL (<?= $doc_count ?>)</a></li>
|
<li id="sidebar-taglist-top"><a href="?tag=*">ALL (<?= $doc_count ?>)</a></li>
|
||||||
<? if ($none_count > 0): ?>
|
<? if ($none_count > 0): ?>
|
||||||
<li id="sidebar-taglist-top"><a href="?tag=_">UNTAGGED (<?= $none_count ?>)</a></li>
|
<li id="sidebar-taglist-top"><a href="?tag=_">UNTAGGED (<?= $none_count ?>)</a></li>
|
||||||
<? endif; ?>
|
|
||||||
<?
|
|
||||||
foreach($tags as $tag){
|
|
||||||
echo '<li><a href="?tag=' . $tag['name'] . "\">" . $tag['name'] . " (" . $tag['count'] . ")</a></li>";
|
|
||||||
}
|
|
||||||
?>
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div id="content">
|
|
||||||
<?php echo $content ?>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div id="login">
|
|
||||||
<?php if ($logged): ?>
|
|
||||||
<form method="get" action="admin.php">
|
|
||||||
<button type="submit" id="login-button">enter admin interface</button>
|
|
||||||
</form>
|
|
||||||
<? else: ?>
|
|
||||||
<form method="post" action="admin.php">
|
|
||||||
<input type="text" name="username" id="login-user"></input>
|
|
||||||
<input type="password" name="password" id="login-pass"></input>
|
|
||||||
<button type="submit" id="login-button">></button>
|
|
||||||
</form>
|
|
||||||
<? endif; ?>
|
<? endif; ?>
|
||||||
</div>
|
<?
|
||||||
|
foreach ($tags as $tag) {
|
||||||
|
echo '<li><a href="?tag=' . $tag['name'] . "\">" . $tag['name'] . " (" . $tag['count'] . ")</a></li>";
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div id="content">
|
||||||
|
<?php echo $content ?>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div id="login">
|
||||||
|
<?php if ($logged): ?>
|
||||||
|
<form method="get" action="admin.php">
|
||||||
|
<button type="submit" id="login-button">enter admin interface</button>
|
||||||
|
</form>
|
||||||
|
<? else: ?>
|
||||||
|
<form method="post" action="admin.php">
|
||||||
|
<input type="text" name="username" id="login-user"></input>
|
||||||
|
<input type="password" name="password" id="login-pass"></input>
|
||||||
|
<button type="submit" id="login-button">></button>
|
||||||
|
</form>
|
||||||
|
<? endif; ?>
|
||||||
|
</div>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
|
@ -1,40 +1,40 @@
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html lang="en">
|
<html lang="en">
|
||||||
<head>
|
<head>
|
||||||
<meta charset="utf-8">
|
<meta charset="utf-8">
|
||||||
<?php if (isset($redirect)): ?>
|
<?php if (isset($redirect)): ?>
|
||||||
<meta http-equiv="refresh" content="1;URL=<?= $redirect ?>" />
|
<meta http-equiv="refresh" content="1;URL=<?= $redirect ?>"/>
|
||||||
<?php endif;?>
|
<?php endif; ?>
|
||||||
|
|
||||||
<title>The /-\ pile</title>
|
|
||||||
|
|
||||||
<link rel="stylesheet" type="text/css" href="assets/main.css">
|
<title>The /-\ pile</title>
|
||||||
<style>
|
|
||||||
html, body {
|
|
||||||
margin: 0;
|
|
||||||
padding: 0;
|
|
||||||
width: 100%;
|
|
||||||
height: 100%;
|
|
||||||
display: table
|
|
||||||
}
|
|
||||||
|
|
||||||
body p {
|
<link rel="stylesheet" type="text/css" href="assets/main.css">
|
||||||
font-size: 3rem;
|
<style>
|
||||||
text-align: center;
|
html, body {
|
||||||
}
|
margin: 0;
|
||||||
|
padding: 0;
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
display: table
|
||||||
|
}
|
||||||
|
|
||||||
div {
|
body p {
|
||||||
display: table-cell;
|
font-size: 3rem;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
vertical-align: middle;
|
}
|
||||||
}
|
|
||||||
</style>
|
div {
|
||||||
</head>
|
display: table-cell;
|
||||||
<body>
|
text-align: center;
|
||||||
<div>
|
vertical-align: middle;
|
||||||
<p>
|
}
|
||||||
<?= $text ?>
|
</style>
|
||||||
</p>
|
</head>
|
||||||
</div>
|
<body>
|
||||||
</body>
|
<div>
|
||||||
|
<p>
|
||||||
|
<?= $text ?>
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
</html>
|
</html>
|
|
@ -1,5 +1,8 @@
|
||||||
<div class="text">
|
<div class="text">
|
||||||
<p class="intro"> This site is the sdbs pile, where we upload the stuff we consider important to the larger conceptual and thematic landscape of what we do: "confronting apathy", inter-subjectivity, the human right to self-determination, counter-culture and such...</p>
|
<p class="intro"> This site is the sdbs pile, where we upload the stuff we consider important to the larger
|
||||||
<p class="intro czech">Tohle je hromádka zajímavýho materiálu co něco znamená v kontextu sdbs - budeme sem postupně dávat ty nejdůležitější nebo nejzajímavější věci, zatim se o tom ale nikde moc nešiřte.</p>
|
conceptual and thematic landscape of what we do: "confronting apathy", inter-subjectivity, the human right to
|
||||||
|
self-determination, counter-culture and such...</p>
|
||||||
|
<p class="intro czech">Tohle je hromádka zajímavýho materiálu co něco znamená v kontextu sdbs - budeme sem postupně
|
||||||
|
dávat ty nejdůležitější nebo nejzajímavější věci, zatim se o tom ale nikde moc nešiřte.</p>
|
||||||
<p class="intro sign">/-\</p>
|
<p class="intro sign">/-\</p>
|
||||||
</div>
|
</div>
|
|
@ -1,25 +1,32 @@
|
||||||
<?php
|
<?php
|
||||||
class PileDB {
|
|
||||||
|
class PileDB
|
||||||
|
{
|
||||||
private $db;
|
private $db;
|
||||||
|
|
||||||
function __construct() {
|
function __construct()
|
||||||
|
{
|
||||||
$this->db = new SQLite3("pile.db");
|
$this->db = new SQLite3("pile.db");
|
||||||
}
|
}
|
||||||
|
|
||||||
function prepare($statement){
|
function prepare($statement)
|
||||||
|
{
|
||||||
return $this->db->prepare($statement);
|
return $this->db->prepare($statement);
|
||||||
}
|
}
|
||||||
|
|
||||||
function query($statement){
|
function query($statement)
|
||||||
|
{
|
||||||
return $this->db->query($statement);
|
return $this->db->query($statement);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getDocCount(){
|
public function getDocCount()
|
||||||
|
{
|
||||||
$ret_count = $this->db->query("SELECT count(ID) FROM Documents")->fetchArray(SQLITE3_NUM);
|
$ret_count = $this->db->query("SELECT count(ID) FROM Documents")->fetchArray(SQLITE3_NUM);
|
||||||
return $ret_count[0];
|
return $ret_count[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getUntaggedDocCount(){
|
public function getUntaggedDocCount()
|
||||||
|
{
|
||||||
$ret_count = $this->db->query("SELECT
|
$ret_count = $this->db->query("SELECT
|
||||||
count(ID)
|
count(ID)
|
||||||
FROM
|
FROM
|
||||||
|
@ -30,7 +37,8 @@ class PileDB {
|
||||||
return $ret_count[0];
|
return $ret_count[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getTags(){
|
public function getTags()
|
||||||
|
{
|
||||||
$tag_query = "SELECT
|
$tag_query = "SELECT
|
||||||
ID, Name, count(Document)
|
ID, Name, count(Document)
|
||||||
FROM
|
FROM
|
||||||
|
@ -51,7 +59,8 @@ class PileDB {
|
||||||
return $tags;
|
return $tags;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function fetchDoc($id){
|
public function fetchDoc($id)
|
||||||
|
{
|
||||||
$stmt_doc = $this->db->prepare("SELECT * FROM Documents WHERE ID = :id");
|
$stmt_doc = $this->db->prepare("SELECT * FROM Documents WHERE ID = :id");
|
||||||
$stmt_doc->bindValue(":id", $id, SQLITE3_INTEGER);
|
$stmt_doc->bindValue(":id", $id, SQLITE3_INTEGER);
|
||||||
$doc = $stmt_doc->execute()->fetchArray(SQLITE3_ASSOC);
|
$doc = $stmt_doc->execute()->fetchArray(SQLITE3_ASSOC);
|
||||||
|
@ -69,10 +78,11 @@ class PileDB {
|
||||||
return $doc;
|
return $doc;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function listDocs(){
|
public function listDocs()
|
||||||
if (func_num_args() > 0){
|
{
|
||||||
|
if (func_num_args() > 0) {
|
||||||
$tag = func_get_arg(0);
|
$tag = func_get_arg(0);
|
||||||
if ($tag > 0 ) {
|
if ($tag > 0) {
|
||||||
$stmt = $this->db->prepare("SELECT
|
$stmt = $this->db->prepare("SELECT
|
||||||
ID, Title, Author, Published, URL
|
ID, Title, Author, Published, URL
|
||||||
FROM
|
FROM
|
||||||
|
@ -103,8 +113,9 @@ class PileDB {
|
||||||
return $docs;
|
return $docs;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function updateDoc($id, $title, $author, $description, $published, $url, $tag_ids){
|
public function updateDoc($id, $title, $author, $description, $published, $url, $tag_ids)
|
||||||
if ( empty($id) ){
|
{
|
||||||
|
if (empty($id)) {
|
||||||
$stmt = $this->db->prepare("INSERT INTO Documents
|
$stmt = $this->db->prepare("INSERT INTO Documents
|
||||||
(ID, Title, Author, Description, Published, URL)
|
(ID, Title, Author, Description, Published, URL)
|
||||||
VALUES
|
VALUES
|
||||||
|
@ -125,18 +136,18 @@ class PileDB {
|
||||||
$stmt->bindValue(":published", $published, SQLITE3_TEXT);
|
$stmt->bindValue(":published", $published, SQLITE3_TEXT);
|
||||||
$stmt->bindValue(":url", $url, SQLITE3_TEXT);
|
$stmt->bindValue(":url", $url, SQLITE3_TEXT);
|
||||||
$stmt->execute();
|
$stmt->execute();
|
||||||
if ( empty($id) ){
|
if (empty($id)) {
|
||||||
$id = $this->db->lastInsertRowid();
|
$id = $this->db->lastInsertRowid();
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( ! empty($id) ){
|
if (!empty($id)) {
|
||||||
$delete_stmt = $this->db->prepare("DELETE FROM DocumentsToTags
|
$delete_stmt = $this->db->prepare("DELETE FROM DocumentsToTags
|
||||||
WHERE Document = :id");
|
WHERE Document = :id");
|
||||||
$delete_stmt->bindValue(":id", $id, SQLITE3_INTEGER);
|
$delete_stmt->bindValue(":id", $id, SQLITE3_INTEGER);
|
||||||
$delete_stmt->execute();
|
$delete_stmt->execute();
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach ($tag_ids as $tag){
|
foreach ($tag_ids as $tag) {
|
||||||
$tag_stmt = $this->db->prepare("INSERT INTO DocumentsToTags ('Document', 'Tag')
|
$tag_stmt = $this->db->prepare("INSERT INTO DocumentsToTags ('Document', 'Tag')
|
||||||
VALUES (:doc, :tag)");
|
VALUES (:doc, :tag)");
|
||||||
$tag_stmt->bindValue("doc", $id, SQLITE3_INTEGER);
|
$tag_stmt->bindValue("doc", $id, SQLITE3_INTEGER);
|
||||||
|
@ -145,32 +156,36 @@ class PileDB {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function removeDoc($id){
|
public function removeDoc($id)
|
||||||
|
{
|
||||||
$doc_stmt = $this->db->prepare("DELETE FROM Documents
|
$doc_stmt = $this->db->prepare("DELETE FROM Documents
|
||||||
WHERE ID = :id");
|
WHERE ID = :id");
|
||||||
$doc_stmt->bindValue("id", $id, SQLITE3_INTEGER);
|
$doc_stmt->bindValue("id", $id, SQLITE3_INTEGER);
|
||||||
$doc_stmt->execute();
|
$doc_stmt->execute();
|
||||||
|
|
||||||
$tag_stmt = $this->db->prepare("DELETE FROM DocumentsToTags
|
$tag_stmt = $this->db->prepare("DELETE FROM DocumentsToTags
|
||||||
WHERE Document = :id");
|
WHERE Document = :id");
|
||||||
$tag_stmt->bindValue("id", $id, SQLITE3_INTEGER);
|
$tag_stmt->bindValue("id", $id, SQLITE3_INTEGER);
|
||||||
$tag_stmt->execute();
|
$tag_stmt->execute();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function findTag($name){
|
public function findTag($name)
|
||||||
|
{
|
||||||
$stmt = $this->db->prepare("SELECT * FROM Tags WHERE Name == :name COLLATE NOCASE");
|
$stmt = $this->db->prepare("SELECT * FROM Tags WHERE Name == :name COLLATE NOCASE");
|
||||||
$stmt->bindValue(":name", $name, SQLITE3_TEXT);
|
$stmt->bindValue(":name", $name, SQLITE3_TEXT);
|
||||||
return $stmt->execute()->fetchArray(SQLITE3_ASSOC);
|
return $stmt->execute()->fetchArray(SQLITE3_ASSOC);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function fetchTag($tag){
|
public function fetchTag($tag)
|
||||||
|
{
|
||||||
$stmt = $this->db->prepare("SELECT * FROM Tags WHERE ID == :tag");
|
$stmt = $this->db->prepare("SELECT * FROM Tags WHERE ID == :tag");
|
||||||
$stmt->bindValue(":tag", $tag, SQLITE3_INTEGER);
|
$stmt->bindValue(":tag", $tag, SQLITE3_INTEGER);
|
||||||
return $stmt->execute()->fetchArray(SQLITE3_ASSOC);
|
return $stmt->execute()->fetchArray(SQLITE3_ASSOC);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function updateTag($id, $name, $description){
|
public function updateTag($id, $name, $description)
|
||||||
if (empty($id)){
|
{
|
||||||
|
if (empty($id)) {
|
||||||
$stmt = $this->db->prepare("INSERT INTO Tags
|
$stmt = $this->db->prepare("INSERT INTO Tags
|
||||||
(ID, Name, Description)
|
(ID, Name, Description)
|
||||||
VALUES
|
VALUES
|
||||||
|
@ -188,7 +203,8 @@ class PileDB {
|
||||||
return $stmt->execute();
|
return $stmt->execute();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function authenticate($username, $password){
|
public function authenticate($username, $password)
|
||||||
|
{
|
||||||
$stmt = $this->db->prepare("SELECT
|
$stmt = $this->db->prepare("SELECT
|
||||||
*
|
*
|
||||||
FROM
|
FROM
|
||||||
|
@ -199,11 +215,12 @@ class PileDB {
|
||||||
$auth_ret = $stmt->execute();
|
$auth_ret = $stmt->execute();
|
||||||
$auth = $auth_ret->fetchArray(SQLITE3_ASSOC);
|
$auth = $auth_ret->fetchArray(SQLITE3_ASSOC);
|
||||||
|
|
||||||
if (password_verify($password, $auth["Password"])){
|
if (password_verify($password, $auth["Password"])) {
|
||||||
return $auth["ID"];
|
return $auth["ID"];
|
||||||
} else {
|
} else {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|
|
@ -1,7 +1,10 @@
|
||||||
<?
|
<?
|
||||||
class Uploader {
|
|
||||||
public function handle($files, $dir){
|
class Uploader
|
||||||
if ( is_array($files['upfile']['error']) ) {
|
{
|
||||||
|
public function handle($files, $dir)
|
||||||
|
{
|
||||||
|
if (is_array($files['upfile']['error'])) {
|
||||||
throw new RuntimeException('Invalid parameters.');
|
throw new RuntimeException('Invalid parameters.');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -20,20 +23,20 @@ class Uploader {
|
||||||
|
|
||||||
$finfo = new finfo(FILEINFO_MIME_TYPE);
|
$finfo = new finfo(FILEINFO_MIME_TYPE);
|
||||||
if (false === $ext = array_search(
|
if (false === $ext = array_search(
|
||||||
$finfo->file($files['upfile']['tmp_name']),
|
$finfo->file($files['upfile']['tmp_name']),
|
||||||
array(
|
array(
|
||||||
'pdf' => 'application/pdf',
|
'pdf' => 'application/pdf',
|
||||||
'zip' => 'application/zip',
|
'zip' => 'application/zip',
|
||||||
'rar' => 'application/rar'
|
'rar' => 'application/rar'
|
||||||
),
|
),
|
||||||
true
|
true
|
||||||
)) {
|
)) {
|
||||||
throw new RuntimeException('Invalid file format.');
|
throw new RuntimeException('Invalid file format.');
|
||||||
}
|
}
|
||||||
|
|
||||||
$name = basename($files['upfile']['name']);
|
$name = basename($files['upfile']['name']);
|
||||||
$name = preg_replace('/[^\x20-\x7E]/','', $name);
|
$name = preg_replace('/[^\x20-\x7E]/', '', $name);
|
||||||
if ($name != ".htaccess"){
|
if ($name != ".htaccess") {
|
||||||
if (!move_uploaded_file(
|
if (!move_uploaded_file(
|
||||||
$files['upfile']['tmp_name'],
|
$files['upfile']['tmp_name'],
|
||||||
$dir . $name)) {
|
$dir . $name)) {
|
||||||
|
@ -46,4 +49,5 @@ class Uploader {
|
||||||
return $name;
|
return $name;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|
|
@ -8,23 +8,23 @@ $db = new PileDB();
|
||||||
$uploader = new Uploader();
|
$uploader = new Uploader();
|
||||||
session_start();
|
session_start();
|
||||||
|
|
||||||
if (isset($_SESSION['ID'])){
|
if (isset($_SESSION['ID'])) {
|
||||||
$page = new Template();
|
$page = new Template();
|
||||||
|
|
||||||
if (isset($_GET["action"])){
|
if (isset($_GET["action"])) {
|
||||||
switch ($_GET["action"]){
|
switch ($_GET["action"]) {
|
||||||
case "new_tag":
|
case "new_tag":
|
||||||
$content = $page->render("admin_tag_edit.php");
|
$content = $page->render("admin_tag_edit.php");
|
||||||
break;
|
break;
|
||||||
case "edit_tag":
|
case "edit_tag":
|
||||||
if (isset($_POST["Name"])){
|
if (isset($_POST["Name"])) {
|
||||||
$db->updateTag(
|
$db->updateTag(
|
||||||
$_GET["tag"],
|
$_GET["tag"],
|
||||||
$_POST["Name"],
|
$_POST["Name"],
|
||||||
$_POST["Description"]
|
$_POST["Description"]
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
if ( !empty($_GET["tag"]) ) {
|
if (!empty($_GET["tag"])) {
|
||||||
$page->tag = $db->fetchTag($_GET["tag"]);
|
$page->tag = $db->fetchTag($_GET["tag"]);
|
||||||
}
|
}
|
||||||
$content = $page->render("admin_tag_edit.php");
|
$content = $page->render("admin_tag_edit.php");
|
||||||
|
@ -33,18 +33,18 @@ if (isset($_SESSION['ID'])){
|
||||||
$content = $page->render("admin_doc_edit.php");
|
$content = $page->render("admin_doc_edit.php");
|
||||||
break;
|
break;
|
||||||
case "edit_item":
|
case "edit_item":
|
||||||
if (isset($_POST["Title"]) || !empty($_FILES['upfile']['name']) ){
|
if (isset($_POST["Title"]) || !empty($_FILES['upfile']['name'])) {
|
||||||
$title = $_POST["Title"];
|
$title = $_POST["Title"];
|
||||||
|
|
||||||
if ( !empty($_FILES['upfile']['name']) ){
|
if (!empty($_FILES['upfile']['name'])) {
|
||||||
try {
|
try {
|
||||||
if ( empty($title) ){
|
if (empty($title)) {
|
||||||
$title = pathinfo($_FILES['upfile']['name'], PATHINFO_FILENAME);
|
$title = pathinfo($_FILES['upfile']['name'], PATHINFO_FILENAME);
|
||||||
$title = str_replace("_", " ", $title);
|
$title = str_replace("_", " ", $title);
|
||||||
$title = trim($title);
|
$title = trim($title);
|
||||||
}
|
}
|
||||||
$url = "http://pile.sdbs.cz/docs/" . rawurlencode($uploader->handle($_FILES, "docs/"));
|
$url = "http://pile.sdbs.cz/docs/" . rawurlencode($uploader->handle($_FILES, "docs/"));
|
||||||
} catch (RuntimeException $ex){
|
} catch (RuntimeException $ex) {
|
||||||
$page->text = $ex->getMessage();
|
$page->text = $ex->getMessage();
|
||||||
echo $page->render('full_text.php');
|
echo $page->render('full_text.php');
|
||||||
return;
|
return;
|
||||||
|
@ -54,10 +54,10 @@ if (isset($_SESSION['ID'])){
|
||||||
}
|
}
|
||||||
|
|
||||||
$doc_tags = [];
|
$doc_tags = [];
|
||||||
foreach (explode(",", $_POST["Tags"]) as $tagName){
|
foreach (explode(",", $_POST["Tags"]) as $tagName) {
|
||||||
$tagName = trim($tagName);
|
$tagName = trim($tagName);
|
||||||
$tag = $db->findTag($tagName);
|
$tag = $db->findTag($tagName);
|
||||||
if (!in_array($tag["ID"], $doc_tags)){
|
if (!in_array($tag["ID"], $doc_tags)) {
|
||||||
array_push($doc_tags, $tag["ID"]);
|
array_push($doc_tags, $tag["ID"]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -73,14 +73,14 @@ if (isset($_SESSION['ID'])){
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( !empty($_GET["item"]) ) {
|
if (!empty($_GET["item"])) {
|
||||||
$page->doc = $db->fetchDoc($_GET["item"]);
|
$page->doc = $db->fetchDoc($_GET["item"]);
|
||||||
}
|
}
|
||||||
$content = $page->render("admin_doc_edit.php");
|
$content = $page->render("admin_doc_edit.php");
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case "remove":
|
case "remove":
|
||||||
if ( ! empty($_GET["confirm"]) && $_GET["confirm"] == "yes"){
|
if (!empty($_GET["confirm"]) && $_GET["confirm"] == "yes") {
|
||||||
$db->removeDoc($_GET["item"]);
|
$db->removeDoc($_GET["item"]);
|
||||||
$page->text = "Document deleted.";
|
$page->text = "Document deleted.";
|
||||||
$page->redirect = $_GET["ret"];
|
$page->redirect = $_GET["ret"];
|
||||||
|
@ -100,7 +100,7 @@ if (isset($_SESSION['ID'])){
|
||||||
}
|
}
|
||||||
} elseif (isset($_GET["tag"])) {
|
} elseif (isset($_GET["tag"])) {
|
||||||
$doc_list_template = new Template();
|
$doc_list_template = new Template();
|
||||||
if ($_GET["tag"] == "*"){
|
if ($_GET["tag"] == "*") {
|
||||||
$docs = $db->listDocs();
|
$docs = $db->listDocs();
|
||||||
} elseif ($_GET["tag"] == "_") {
|
} elseif ($_GET["tag"] == "_") {
|
||||||
$docs = $db->listDocs(-1);
|
$docs = $db->listDocs(-1);
|
||||||
|
@ -129,19 +129,19 @@ if (isset($_SESSION['ID'])){
|
||||||
} else {
|
} else {
|
||||||
$page = new Template();
|
$page = new Template();
|
||||||
|
|
||||||
if (isset($_POST['username']) && isset($_POST['password'])){
|
if (isset($_POST['username']) && isset($_POST['password'])) {
|
||||||
$ret_id = $db->authenticate($_POST["username"], $_POST["password"]);
|
$ret_id = $db->authenticate($_POST["username"], $_POST["password"]);
|
||||||
if ($ret_id > 0){
|
if ($ret_id > 0) {
|
||||||
$_SESSION['ID'] = $ret_id;
|
$_SESSION['ID'] = $ret_id;
|
||||||
$page->text = "You have logged in successfully.";
|
$page->text = "You have logged in successfully.";
|
||||||
$page->redirect = "admin.php";
|
$page->redirect = "admin.php";
|
||||||
} else {
|
} else {
|
||||||
$page->text = "Username and/or password incorrect.";
|
$page->text = "Username and/or password incorrect.";
|
||||||
$page->redirect = "/";
|
$page->redirect = "/";
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$page->text = "Please log in before accessing this page.";
|
$page->text = "Please log in before accessing this page.";
|
||||||
$page->redirect = "/";
|
$page->redirect = "/";
|
||||||
}
|
}
|
||||||
|
|
||||||
echo $page->render('full_text.php');
|
echo $page->render('full_text.php');
|
||||||
|
|
|
@ -4,11 +4,13 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
*, *:before, *:after {
|
*, *:before, *:after {
|
||||||
-moz-box-sizing: border-box; -webkit-box-sizing: border-box; box-sizing: border-box;
|
-moz-box-sizing: border-box;
|
||||||
|
-webkit-box-sizing: border-box;
|
||||||
|
box-sizing: border-box;
|
||||||
}
|
}
|
||||||
|
|
||||||
body {
|
body {
|
||||||
font-family: Prociono;
|
font-family: Prociono, serif;
|
||||||
margin: 0;
|
margin: 0;
|
||||||
padding: 0;
|
padding: 0;
|
||||||
position: relative;
|
position: relative;
|
||||||
|
@ -27,7 +29,7 @@ a {
|
||||||
|
|
||||||
#sidebar-head {
|
#sidebar-head {
|
||||||
background-color: #f2f2f2;
|
background-color: #f2f2f2;
|
||||||
color: 202020;
|
color: #202020;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -82,7 +84,7 @@ a {
|
||||||
margin-right: 3em;
|
margin-right: 3em;
|
||||||
}
|
}
|
||||||
|
|
||||||
.doc-item h2 {
|
.doc-item h2 {
|
||||||
font-size: 14pt;
|
font-size: 14pt;
|
||||||
font-weight: normal;
|
font-weight: normal;
|
||||||
margin: 0;
|
margin: 0;
|
||||||
|
@ -164,7 +166,7 @@ a {
|
||||||
}
|
}
|
||||||
|
|
||||||
input[type="text"] {
|
input[type="text"] {
|
||||||
width: 80%;
|
width: 80%;
|
||||||
}
|
}
|
||||||
|
|
||||||
@media screen and (min-width: 64em ) {
|
@media screen and (min-width: 64em ) {
|
||||||
|
@ -174,26 +176,26 @@ input[type="text"] {
|
||||||
left: 2rem;
|
left: 2rem;
|
||||||
width: 14rem;
|
width: 14rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
#content {
|
#content {
|
||||||
margin: 2rem 2rem 0 18rem;
|
margin: 2rem 2rem 0 18rem;
|
||||||
padding: 0 0 2rem 0;
|
padding: 0 0 2rem 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@media screen and (max-width: 64em ) {
|
@media screen and (max-width: 64em ) {
|
||||||
#sidebar-head {
|
#sidebar-head {
|
||||||
background-position: 14%;
|
background-position: 14%;
|
||||||
background-size: 4rem;
|
background-size: 4rem;
|
||||||
height: 7rem;
|
height: 7rem;
|
||||||
margin-bottom: 1rem;
|
margin-bottom: 1rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
#sidebar-head > h1 {
|
#sidebar-head > h1 {
|
||||||
padding-top: 1.5rem;
|
padding-top: 1.5rem;
|
||||||
font-size: 3rem;
|
font-size: 3rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
#sidebar-taglist {
|
#sidebar-taglist {
|
||||||
margin-bottom: 1rem;
|
margin-bottom: 1rem;
|
||||||
}
|
}
|
||||||
|
@ -214,7 +216,7 @@ input[type="text"] {
|
||||||
height: 14pt;
|
height: 14pt;
|
||||||
font-size: 8pt;
|
font-size: 8pt;
|
||||||
border: 1px solid lightgray;
|
border: 1px solid lightgray;
|
||||||
background: 202020;
|
background: #202020;
|
||||||
}
|
}
|
||||||
|
|
||||||
.czech {
|
.czech {
|
||||||
|
@ -227,7 +229,7 @@ input[type="text"] {
|
||||||
margin: 0;
|
margin: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
input[type="submit"], input[type="file"]{
|
input[type="submit"], input[type="file"] {
|
||||||
font-family: Prociono, serif;
|
font-family: Prociono, serif;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,9 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
*, *:before, *:after {
|
*, *:before, *:after {
|
||||||
-moz-box-sizing: border-box; -webkit-box-sizing: border-box; box-sizing: border-box;
|
-moz-box-sizing: border-box;
|
||||||
|
-webkit-box-sizing: border-box;
|
||||||
|
box-sizing: border-box;
|
||||||
}
|
}
|
||||||
|
|
||||||
body {
|
body {
|
||||||
|
@ -28,15 +30,15 @@ a {
|
||||||
#sidebar-head {
|
#sidebar-head {
|
||||||
background-color: #202020;
|
background-color: #202020;
|
||||||
color: white;
|
color: white;
|
||||||
|
|
||||||
background-image: url(/assets/pile_white.svg);
|
background-image: url(/assets/pile_white.svg);
|
||||||
background-repeat: no-repeat;
|
background-repeat: no-repeat;
|
||||||
background-position: center 1.5em;
|
background-position: center 1.5em;
|
||||||
background-size: 50%;
|
background-size: 50%;
|
||||||
|
|
||||||
text-align: center;
|
text-align: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
#sidebar-head > h1 {
|
#sidebar-head > h1 {
|
||||||
padding: 0.5em;
|
padding: 0.5em;
|
||||||
padding-top: 6em;
|
padding-top: 6em;
|
||||||
|
@ -109,7 +111,6 @@ a {
|
||||||
}
|
}
|
||||||
|
|
||||||
.tag-text
|
.tag-text
|
||||||
|
|
||||||
.document h1 {
|
.document h1 {
|
||||||
margin: 0;
|
margin: 0;
|
||||||
font-size: 24pt;
|
font-size: 24pt;
|
||||||
|
@ -164,26 +165,26 @@ a {
|
||||||
left: 2rem;
|
left: 2rem;
|
||||||
width: 14rem;
|
width: 14rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
#content {
|
#content {
|
||||||
margin: 2rem 2rem 0 18rem;
|
margin: 2rem 2rem 0 18rem;
|
||||||
padding: 0 0 2rem 0;
|
padding: 0 0 2rem 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@media screen and (max-width: 64em ) {
|
@media screen and (max-width: 64em ) {
|
||||||
#sidebar-head {
|
#sidebar-head {
|
||||||
background-position: 14%;
|
background-position: 14%;
|
||||||
background-size: 4rem;
|
background-size: 4rem;
|
||||||
height: 7rem;
|
height: 7rem;
|
||||||
margin-bottom: 1rem;
|
margin-bottom: 1rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
#sidebar-head > h1 {
|
#sidebar-head > h1 {
|
||||||
padding-top: 1.5rem;
|
padding-top: 1.5rem;
|
||||||
font-size: 3rem;
|
font-size: 3rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
#sidebar-taglist {
|
#sidebar-taglist {
|
||||||
margin-bottom: 1rem;
|
margin-bottom: 1rem;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
{
|
{
|
||||||
"config": {
|
"config": {
|
||||||
"vendor-dir": "_vendor"
|
"vendor-dir": "_vendor"
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
"erusev/parsedown": "^1.7"
|
"erusev/parsedown": "^1.7"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,7 +16,7 @@ if (isset($_GET["item"])) {
|
||||||
$content = $doc_template->render('front_doc_overview.php');
|
$content = $doc_template->render('front_doc_overview.php');
|
||||||
} elseif (isset($_GET["tag"])) {
|
} elseif (isset($_GET["tag"])) {
|
||||||
$doc_list_template = new Template();
|
$doc_list_template = new Template();
|
||||||
if ($_GET["tag"] == "*"){
|
if ($_GET["tag"] == "*") {
|
||||||
$docs = $db->listDocs();
|
$docs = $db->listDocs();
|
||||||
} elseif ($_GET["tag"] == "_") {
|
} elseif ($_GET["tag"] == "_") {
|
||||||
$docs = $db->listDocs(-1);
|
$docs = $db->listDocs(-1);
|
||||||
|
|
Loading…
Reference in a new issue