Browse Source

Make impressum and privacy links able to open in a new tab

master
Givou 1 year ago
parent
commit
389f7343d3
  1. 19
      admin.php
  2. 10
      index.php
  3. 1
      install/index.php
  4. 22
      worker.php

19
admin.php

@ -505,10 +505,10 @@ if(isset($_GET["manageservice"])) {
echo '
<form action="admin.php?upautoreload" method="post">
<input type="text" class="username-field" value="'.$autoreload_setting.'" readonly>
<select name = "autoreload">
<option value = "enabled" selected>Enabled</option>
<option value = "disabled">Disabled</option>
</select>
<select name = "autoreload">
<option value = "enabled" selected>Enabled</option>
<option value = "disabled">Disabled</option>
</select>
<input style="display: none;" type="submit"><button class="button-green button-up">Submit</button></input>
</form>
@ -518,6 +518,8 @@ if(isset($_GET["manageservice"])) {
echo '<p class="upassword">Impressum link set to: '.$_GET['impressumset'].'!</p>';
} else if($_GET['privacyset']) {
echo '<p class="upassword">Privacy policity link set to: '.$_GET['privacyset'].'!</p>';
} else if(isset($_GET['newtabset'])) {
echo '<p class="upassword">Open new tab policy updated!</p>';
}
echo '
<form action="admin.php?upimpressum" method="post">
@ -531,6 +533,15 @@ if(isset($_GET["manageservice"])) {
<input type="text" class="username-field" placeholder="Privacy policity link" name="privacy">
<input style="display: none;" type="submit"><button class="button-green button-up">Submit</button></input>
</form>
<form action="admin.php?uptabpolicy" method="post">
<input type="text" class="username-field" value="'.$newtab.'" readonly>
<select name = "newtab">
<option value = "new tab" selected>new tab</option>
<option value = "same tab">same tab</option>
</select>
<input style="display: none;" type="submit"><button class="button-green button-up">Submit</button></input>
</form>
</div>
</div>';
}

10
index.php

@ -19,6 +19,7 @@
$modular_setting = mysqli_fetch_assoc(mysqli_query($con, "SELECT value FROM settings WHERE type='modularwindow'"))["value"];
$privacy = mysqli_fetch_assoc(mysqli_query($con, "SELECT value FROM settings WHERE type='privacy'"))["value"];
$impressum = mysqli_fetch_assoc(mysqli_query($con, "SELECT value FROM settings WHERE type='impressum'"))["value"];
$newtab = mysqli_fetch_assoc(mysqli_query($con, "SELECT value FROM settings WHERE type='newtab'"))["value"];
$groups = mysqli_query($con, "SELECT priority, name, id FROM groups ORDER BY priority DESC");
$services = mysqli_query($con, "SELECT priority, groupid, name, id, status FROM services ORDER BY priority DESC");
@ -259,7 +260,14 @@ echo '</div>';
<!-- FOOTER -->
<footer class="footer">
<p class="footer">Powered by <a class="underline" href="http://git.thiemoo.at/Givou/WebStatus.git" target="_blank">WebStatus</a></p>
<p class="footer-subtext"><a href="<?php echo $impressum; ?>">Impressum</a> | <a href="<?php echo $privacy; ?>">Privacy policity</a></p>
<?php
if($newtab === "new tab") {
echo '<p class="footer-subtext"><a target="_blank" href="'.$impressum.'">Impressum</a> | <a target="_blank" href="'.$privacy.'">Privacy policity</a></p>';
} else {
echo '<p class="footer-subtext"><a href="'.$impressum.'">Impressum</a> | <a href="'.$privacy.'">Privacy policity</a></p>';
}
?>
<p class="footer-subtext">Made with <span class="footer-heart"><i class="fa fa-heart"></i></span> by <a target"_blank" href="thiemoo.at">Givou</a></p>
</footer>

1
install/index.php

@ -89,6 +89,7 @@ if(isset($_POST['dbhost']) && isset($_POST['dbname']) && isset($_POST['dbpwd'])
mysqli_query($con, "INSERT INTO settings(type, value) VALUES ('autoreload', 'enabled')");
mysqli_query($con, "INSERT INTO settings(type, value) VALUES ('impressum', '#')");
mysqli_query($con, "INSERT INTO settings(type, value) VALUES ('privacy', '#')");
mysqli_query($con, "INSERT INTO settings(type, value) VALUES ('newtab', 'same tab')");
//Creating Administrative User
mysqli_query($con, "INSERT INTO accounts (username, password, role) VALUES ('".mysqli_real_escape_string($con,$admin_username)."',

22
worker.php

@ -25,6 +25,7 @@ $role = mysqli_fetch_assoc(mysqli_query($con, "SELECT role FROM accounts WHERE i
$instancename = mysqli_fetch_assoc(mysqli_query($con, "SELECT value FROM settings WHERE type='instancename'"))["value"];
$privacy = mysqli_fetch_assoc(mysqli_query($con, "SELECT value FROM settings WHERE type='privacy'"))["value"];
$impressum = mysqli_fetch_assoc(mysqli_query($con, "SELECT value FROM settings WHERE type='impressum'"))["value"];
$newtab = mysqli_fetch_assoc(mysqli_query($con, "SELECT value FROM settings WHERE type='newtab'"))["value"];
if($role == "administrator") {
$autoreload_setting = mysqli_fetch_assoc(mysqli_query($con, "SELECT value FROM settings WHERE type='autoreload'"))["value"];
@ -350,6 +351,27 @@ if($role == "administrator") {
}
?>
<?php
//Set new tab policy
if($role == "administrator") {
if(isset($_GET["uptabpolicy"]) && isset($_POST['newtab'])) {
include ('config.php');
$con = mysqli_connect($config['DBHOST'], $config['DBUSER'], $config['DBPWD'], $config['DBNAME']);
if ( mysqli_connect_errno() ) {
exit('MySQl Connection failed with error: ' . mysqli_connect_error());
}
$statement = mysqli_query($con,"UPDATE settings SET value='".mysqli_real_escape_string($con, $_POST['newtab'])."'
WHERE type='newtab'");
if($statement) {
header("Location: admin.php?newtabset#settings");
}
}
}
?>
<?php
//Create new service
if(isset($_GET["createservice"]) && isset($_POST['priority']) && isset($_POST['group']) && isset($_POST['name'])) {

Loading…
Cancel
Save