Merge broken branch 'master' of https://lostcave.ddnss.de/git/root/web-deployment [tbd later]

master
BodgeMaster 2020-02-26 11:13:02 +01:00
commit 2e352e759e
6 changed files with 13 additions and 25 deletions

1
navbar.php Normal file
View File

@ -0,0 +1 @@
<?php if (isset($_SESSION['user_id'])){ $login = true; } else { $login = false; } ?> <ul class="topnav"> <li> <?php if ($login){ if ($navbar == "home"){ echo " <a class=\"active\" href=\"%CONTENT_DIR%/userhome/\"> <img src=\"/common/threadr/img/ThreadR_Home.svg\" alt=\"My Feed\"/> </a> "; } else { echo " <a href=\"%CONTENT_DIR%/userhome/\"> <img src=\"/common/threadr/img/ThreadR_Home.svg\" alt=\"My Feed\"/> </a> "; } } else { if ($navbar == "home"){ echo " <a class=\"active\" href=\"%CONTENT_DIR%/\"> <img src=\"/common/threadr/img/ThreadR_Home.svg\" alt=\"Home\"/> </a> "; } else { echo " <a href=\"%CONTENT_DIR%/\"> <img src=\"/common/threadr/img/ThreadR_Home.svg\" alt=\"Home\"/> </a> "; } } ?> </li> <li> <?php if ($navbar == "news"){ echo " <a class=\"active\" href=\"%CONTENT_DIR%/news/\">News</a> "; } else { echo " <a href=\"%CONTENT_DIR%/news/\">News</a> "; } } ?> </li> <div class="dropdown"> <button class="dropbtn">Boards</button> <div class="dropdown-content"> <a href="%CONTENT_DIR%/boards/">Board 1</a> <a href="#">Board 2</a> <a href="#">Board 3</a> </div> </div> <li> <?php if ($navbar == "about"){ echo " <a class=\"active\" href=\"%CONTENT_DIR%/about/\">About</a> "; } else { echo " <a href=\"%CONTENT_DIR%/about/\">About</a> "; } } ?> </li> <li class="right"> <?php if ($login) { if ($navbar == "profile") { echo " <a class=\"active\" href=\"%CONTENT_DIR%/profile/\">Profile</a> "; } else { echo " <a href=\"%CONTENT_DIR%/profile/\">Profile</a> "; } } ?> </li> <li class="right"> <?php if ($login) { echo " <a href=\"%CONTENT_DIR%/logout/\">Log out</a> "; } else { if ($navbar == "login") { echo " <a class=\"active\" href=\"%CONTENT_DIR%/login/\">Log in</a> "; } else { echo " <a href=\"%CONTENT_DIR%/login/\">Log in</a> "; } } ?> </li> </ul> <br />

View File

@ -1,7 +1,7 @@
<?php
//todo: fix automatic log out when opening "about"
session_start();
%NO_CHEAP_SESSION_STEALING%
$navbar="about";
?>
<!DOCTYPE html>
<html>
@ -14,23 +14,7 @@ session_start();
<meta name="viewport" content="width=device-width, initial-scale=1.0">
</head>
<body>
<ul class="topnav">
<li>%HOME_LINK%</li>
<li><a href="%CONTENT_DIR%/news/">News</a></li>
<!--<li><a href="%CONTENT_DIR%/boards/">Boards</a></li>-->
<div class="dropdown">
<button class="dropbtn">Boards
<i class="fa fa-caret-down"></i>
</button>
<div class="dropdown-content">
<a href="%CONTENT_DIR%/boards/">Board 1</a>
<a href="#">Board 2</a>
<a href="#">Board 3</a>
</div>
</div>
<li><a class="active" href="%CONTENT_DIR%/about/">About</a></li>
<li class="right">%LOGIN_LINK%</li>
</ul>
%NAVBAR%
<h1>
<center>About us and our website...</center>
</h1>

View File

@ -33,6 +33,7 @@ $username = $dbentry['name'];
</div>
</div>
<li><a href="%CONTENT_DIR%/about/">About</a></li>
<li><a class="active" href="%CONTENT_DIR%/profile/">Profile</a></li>
<li class="right">%LOGIN_LINK%</li>
</ul>
<br />
@ -40,11 +41,11 @@ $username = $dbentry['name'];
<div class="item-1">
<center><h1>ThreadR</h1></center>
</div>
<div class="item-2">
<ul class="list">
<li><center><h1><?php echo " $username "; ?> </h1></center></li>
</ul>
<div class="item-2 form">
<center><h1><?php echo " $username "; ?> </h1></center>
<form action="%CONTENT_DIR%/profile/redirect.php" method="post">
<input type="text" name="biography" maxlength="2000" placeholder="Describe yourself"/>
</form>
</div>
<input type="submit" value="Log in">
</div>
</html>

2
threadr/test.php Normal file
View File

@ -0,0 +1,2 @@
<?php $navbar="home" ?>
%NAVBAR%

View File

@ -33,6 +33,7 @@ $username = $dbentry['name'];
</div>
</div>
<li><a href="%CONTENT_DIR%/about/">About</a></li>
<li><a href="%CONTENT_DIR%/profile/">Profile</a></li>
<li class="right">%LOGIN_LINK%</li>
</ul>
<br />

View File

@ -1,4 +1,3 @@
{
"LOGIN_LINK":"<?php if (isset($_SESSION['user_id'])){ echo \"<a href=\\\"%CONTENT_DIR%/logout/\\\">Log out</a>\";} else { echo \"<a href=\\\"%CONTENT_DIR%/login/\\\">Log in</a>\";} ?>",
"HOME_LINK":"<?php if (isset($_SESSION['user_id'])){ echo \"<a class=\\\"active\\\" href=\\\"/common/threadr/userhome/\\\"><img src=\\\"/common/threadr/img/ThreadR_Home.svg\\\" alt=\\\"My Feed\\\"/></a>\";} else { echo \"<a class=\\\"active\\\" href=\\\"/common/threadr/\\\"><img src=\\\"/common/threadr/img/ThreadR_Home.svg\\\" alt=\\\"Home\\\"/></a>\";} ?>"
"NAVBAR":"<?php \r\nif (isset($_SESSION['user_id'])){ \r\n\t$login = true;\r\n} else { \r\n\t$login = false;\r\n}\r\n?>\r\n\r\n<ul class=\"topnav\">\r\n\t<li>\r\n\t\t<?php \r\n\t\t\tif ($login){\r\n\t\t\t\tif ($navbar == \"home\"){\r\n\t\t\t\t\techo \"\r\n\t\t\t\t\t\t<a class=\\\"active\\\" href=\\\"%CONTENT_DIR%\/userhome\/\\\">\r\n\t\t\t\t\t\t\t<img src=\\\"\/common\/threadr\/img\/ThreadR_Home.svg\\\" alt=\\\"My Feed\\\"\/>\r\n\t\t\t\t\t\t<\/a>\r\n\t\t\t\t\t\";\r\n\t\t\t\t} else {\r\n\t\t\t\t\techo \"\r\n\t\t\t\t\t\t<a href=\\\"%CONTENT_DIR%\/userhome\/\\\">\r\n\t\t\t\t\t\t\t<img src=\\\"\/common\/threadr\/img\/ThreadR_Home.svg\\\" alt=\\\"My Feed\\\"\/>\r\n\t\t\t\t\t\t<\/a>\r\n\t\t\t\t\t\";\r\n\t\t\t\t}\r\n\t\t\t} else { \r\n\t\t\t\tif ($navbar == \"home\"){\r\n\t\t\t\t\techo \"\r\n\t\t\t\t\t\t<a class=\\\"active\\\" href=\\\"%CONTENT_DIR%\/\\\">\r\n\t\t\t\t\t\t\t<img src=\\\"\/common\/threadr\/img\/ThreadR_Home.svg\\\" alt=\\\"Home\\\"\/>\r\n\t\t\t\t\t\t<\/a>\r\n\t\t\t\t\t\";\r\n\t\t\t\t} else {\r\n\t\t\t\t\techo \"\r\n\t\t\t\t\t\t<a href=\\\"%CONTENT_DIR%\/\\\">\r\n\t\t\t\t\t\t\t<img src=\\\"\/common\/threadr\/img\/ThreadR_Home.svg\\\" alt=\\\"Home\\\"\/>\r\n\t\t\t\t\t\t<\/a>\r\n\t\t\t\t\t\";\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t?>\r\n\t<\/li>\r\n <li>\r\n\t\t<?php \r\n\t\t\tif ($navbar == \"news\"){\r\n\t\t\t\t\techo \"\r\n\t\t\t\t\t\t<a class=\\\"active\\\" href=\\\"%CONTENT_DIR%\/news\/\\\">News<\/a>\r\n\t\t\t\t\t\";\r\n\t\t\t\t} else {\r\n\t\t\t\t\techo \"\r\n\t\t\t\t\t\t<a href=\\\"%CONTENT_DIR%\/news\/\\\">News<\/a>\r\n\t\t\t\t\t\";\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t?>\r\n\t<\/li>\r\n <div class=\"dropdown\">\r\n\t\t<button class=\"dropbtn\">Boards<\/button>\r\n\t\t<div class=\"dropdown-content\">\r\n\t\t\t<a href=\"%CONTENT_DIR%\/boards\/\">Board 1<\/a>\r\n\t\t\t<a href=\"#\">Board 2<\/a>\r\n\t\t\t<a href=\"#\">Board 3<\/a>\r\n\t\t<\/div>\r\n\t<\/div>\r\n <li>\r\n\t\t<?php \r\n\t\t\tif ($navbar == \"about\"){\r\n\t\t\t\t\techo \"\r\n\t\t\t\t\t\t<a class=\\\"active\\\" href=\\\"%CONTENT_DIR%\/about\/\\\">About<\/a>\r\n\t\t\t\t\t\";\r\n\t\t\t\t} else {\r\n\t\t\t\t\techo \"\r\n\t\t\t\t\t\t<a href=\\\"%CONTENT_DIR%\/about\/\\\">About<\/a>\r\n\t\t\t\t\t\";\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t?>\r\n\t<\/li>\r\n\t<li class=\"right\">\r\n\t\t<?php \r\n\t\t\tif ($login) { \r\n\t\t\t\tif ($navbar == \"profile\") {\r\n\t\t\t\t\techo \"\r\n\t\t\t\t\t\t<a class=\\\"active\\\" href=\\\"%CONTENT_DIR%\/profile\/\\\">Profile<\/a>\r\n\t\t\t\t\t\";\r\n\t\t\t\t} else {\r\n\t\t\t\t\techo \"\r\n\t\t\t\t\t\t<a href=\\\"%CONTENT_DIR%\/profile\/\\\">Profile<\/a>\r\n\t\t\t\t\t\";\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t?>\r\n\t<\/li>\r\n\t<li class=\"right\">\r\n\t\t<?php \r\n\t\t\tif ($login) { \r\n\t\t\t\techo \"\r\n\t\t\t\t\t<a href=\\\"%CONTENT_DIR%\/logout\/\\\">Log out<\/a>\r\n\t\t\t\t\";\r\n\t\t\t} else { \r\n\t\t\t\tif ($navbar == \"login\") {\r\n\t\t\t\t\techo \"\r\n\t\t\t\t\t\t<a class=\\\"active\\\" href=\\\"%CONTENT_DIR%\/login\/\\\">Log in<\/a>\r\n\t\t\t\t\t\";\r\n\t\t\t\t} else {\r\n\t\t\t\t\techo \"\r\n\t\t\t\t\t\t<a href=\\\"%CONTENT_DIR%\/login\/\\\">Log in<\/a>\r\n\t\t\t\t\t\";\r\n\t\t\t\t}\r\n\t\t\t} \r\n\t\t?>\r\n\t<\/li>\r\n<\/ul>\r\n<br \/>\r\n\r\n"
}