Skip to content

Commit

Permalink
Merge pull request #4 from piuswalter/development
Browse files Browse the repository at this point in the history
Development
  • Loading branch information
piuswalter committed Sep 4, 2021
2 parents 7e1da3e + 32457a2 commit f38881f
Show file tree
Hide file tree
Showing 10 changed files with 43 additions and 29 deletions.
6 changes: 4 additions & 2 deletions src/add.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
require_once('config.php');
?>
<!DOCTYPE html>
<html>
<html lang="en">
<head>
<title>LibreDoc</title>

Expand Down Expand Up @@ -31,7 +31,9 @@

// get last document id and generate next one
$sql = "SELECT MAX(id_document) AS id_document_max FROM documents;";
foreach ($pdo->query($sql) as $row) $idDocumentMax = $row['id_document_max'];
foreach ($pdo->query($sql) as $row) {
$idDocumentMax = $row['id_document_max'];
}
$idDocumentMax++;

// get actual date and time
Expand Down
6 changes: 4 additions & 2 deletions src/change.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
session_start();
?>
<!DOCTYPE html>
<html>
<html lang="en">
<head>
<title>LibreDoc</title>

Expand Down Expand Up @@ -35,7 +35,9 @@
// get document confidential status from database
$sql = $pdo->prepare("SELECT confidential FROM documents WHERE id = ?;");
$sql->execute([$id]);
while ($row = $sql->fetch()) $isConfidential = $row['confidential'];
while ($row = $sql->fetch()) {
$isConfidential = $row['confidential'];
}

// check if document is confidential and session is set
if ($isConfidential && !isset($_SESSION['loggedIn'])) {
Expand Down
4 changes: 2 additions & 2 deletions src/footer.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<small><a target="_blank" href="https://libredoc.eu/">LibreDoc</a> programmed by <a target="_blank" href="https://www.piuswalter.de/">Pius Walter</a> (<a target="_blank" href="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/piuswalter/LibreDoc/">GitHub repo</a>)</small>
<small><a target="_blank" href="https://libredoc.eu/" rel="noopener">LibreDoc</a> programmed by <a target="_blank" href="https://www.piuswalter.de/" rel="noopener">Pius Walter</a> (<a target="_blank" href="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/piuswalter/LibreDoc/" rel="noopener">GitHub repo</a>)</small>
<br />
<br />
<small>Version v1.0.0</small>
<small>Version v1.0.2</small>
2 changes: 1 addition & 1 deletion src/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
}
?>
<!DOCTYPE html>
<html>
<html lang="en">
<head>
<title>LibreDoc</title>

Expand Down
24 changes: 13 additions & 11 deletions src/install.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
<?php
if (!isset($_GET['install'])) {
?>
<html>
<!DOCTYPE html>
<html lang="en">
<head>
<title>LibreDoc</title>

Expand All @@ -26,9 +27,9 @@
<div id="sidebar">
<ul class="sidebar">
<li><strong>Quick links</strong></li>
<li><a target="_blank" href="https://libredoc.eu/">LibreDoc Website</a></li>
<li><a target="_blank" href="https://demo.libredoc.eu/">LibreDoc Demo</a></li>
<li><a target="_blank" href="https://code.libredoc.eu/">LibreDoc Code</a></li>
<li><a target="_blank" href="https://libredoc.eu/" rel="noopener">LibreDoc Website</a></li>
<li><a target="_blank" href="https://demo.libredoc.eu/" rel="noopener">LibreDoc Demo</a></li>
<li><a target="_blank" href="https://code.libredoc.eu/" rel="noopener">LibreDoc Code</a></li>
</ul>
</div>

Expand All @@ -37,9 +38,9 @@
<form action="install.php?install" method="post">
<h4>Database</h4>
<p>Enter the data for connecting the database here.</p>
<table>
<table role="none">
<tr>
<td width="100px"><label for="database-host">Host</label></td>
<td class="w-100p"><label for="database-host">Host</label></td>
<td><input id="database-host" name="database-host" type="text" value="localhost" /></td>
</tr>
<tr>
Expand All @@ -58,16 +59,16 @@
<p>All required tables will be force created. That meens if they exist before, they will be deleted.</p>
<h4>LibreDoc</h4>
<p>Enter the name of the standard author here. This will be displayed at the end of each created document.</p>
<table>
<table role="none">
<tr>
<td width="100px"><label for="author">Author</label></td>
<td class="w-100p"><label for="author">Author</label></td>
<td><input id="author" name="author" type="text" /></td>
</tr>
</table>
<p>Assign a secure password here to access and edit confidential documents.</p>
<table>
<table role="none">
<tr>
<td width="100px"><label for="password">Password</label></td>
<td class="w-100p"><label for="password">Password</label></td>
<td><input id="password" name="password" type="text" autocomplete="off" /></td>
</tr>
</table>
Expand Down Expand Up @@ -172,7 +173,8 @@
exit();
} else {
?>
<html>
<!DOCTYPE html>
<html lang="en">
<head>
<title>LibreDoc</title>

Expand Down
2 changes: 1 addition & 1 deletion src/revision.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
require_once('config.php');
?>
<!DOCTYPE html>
<html>
<html lang="en">
<head>
<title>LibreDoc</title>

Expand Down
6 changes: 4 additions & 2 deletions src/search.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
require_once('config.php');
?>
<!DOCTYPE html>
<html>
<html lang="en">
<head>
<title>LibreDoc</title>

Expand Down Expand Up @@ -69,7 +69,9 @@
// calculate amount of filtered documents
$sql = $pdo->prepare("SELECT COUNT(id) AS amount FROM documents WHERE id IN (SELECT MAX(id) AS id FROM documents GROUP BY id_document) AND description LIKE ? AND status_deprecated = 0 ORDER BY heading;");
$sql->execute([$search]);
while ($row = $sql->fetch()) $amount = $row['amount'];
while ($row = $sql->fetch()) {
$amount = $row['amount'];
}

// select the right sql statement for reading documents
if (!$emptySearch) {
Expand Down
10 changes: 6 additions & 4 deletions src/show.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
session_start();
?>
<!DOCTYPE html>
<html>
<html lang="en">
<head>
<title>LibreDoc</title>

Expand Down Expand Up @@ -104,7 +104,7 @@
$descriptionOutput = str_replace('&lt;/code&gt;', '</code>', $descriptionOutput);
$descriptionOutput = str_replace('&quot;', '"', $descriptionOutput);
$pattern = '/&lt;a href=["\'](.*?)["\']&gt;/im';
$replacement = '<a target="_blank" href="$1">';
$replacement = '<a target="_blank" href="$1" rel="noopener">';
$descriptionOutput = preg_replace($pattern, $replacement, $descriptionOutput);
$descriptionOutput = str_replace('&lt;/a&gt;', '</a>', $descriptionOutput);

Expand Down Expand Up @@ -169,10 +169,12 @@
<?php
} else {
echo '<pre>';
if ($statusDeprecated)
if ($statusDeprecated) {
echo '<div class="banner banner-deprecated">Deprecated document!</div><br />';
if ($statusNeedReview)
}
if ($statusNeedReview) {
echo '<div class="banner banner-need-review">Document needs review!</div><br />';
}
echo $descriptionOutput;
echo '<br />';
echo '<br />';
Expand Down
6 changes: 3 additions & 3 deletions src/sidebar.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<li><a href="search.php?s=nr">Need review</a></li>
<br />
<li><strong>Quick links</strong></li>
<li><a target="_blank" href="https://libredoc.eu/">LibreDoc Website</a></li>
<li><a target="_blank" href="https://demo.libredoc.eu/">LibreDoc Demo</a></li>
<li><a target="_blank" href="https://code.libredoc.eu/">LibreDoc Code</a></li>
<li><a target="_blank" href="https://libredoc.eu/" rel="noopener">LibreDoc Website</a></li>
<li><a target="_blank" href="https://demo.libredoc.eu/" rel="noopener">LibreDoc Demo</a></li>
<li><a target="_blank" href="https://code.libredoc.eu/" rel="noopener">LibreDoc Code</a></li>
</ul>
6 changes: 5 additions & 1 deletion src/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ html, body {

body {
width: 100%;
font-family: "Georgia";
font-family: "Georgia", serif;
}

a {
Expand Down Expand Up @@ -79,6 +79,10 @@ pre {
width: 100%;
}

.w-100p {
width: 100px;
}

.h-400p {
height:400px;
}
Expand Down

0 comments on commit f38881f

Please sign in to comment.