Compare commits
No commits in common. "8a717ca0e9cf5b7d22384c3a130328181f231805" and "04e942a3b2c43d097903e5bd9d2dd952c25653cd" have entirely different histories.
8a717ca0e9
...
04e942a3b2
8 changed files with 61 additions and 50 deletions
|
@ -1,6 +1,5 @@
|
||||||
# Custom error pages
|
# Custom error pages
|
||||||
ErrorDocument 403 /errors/403.php
|
ErrorDocument 403 /errors/403.php
|
||||||
ErrorDocument 404 /errors/404.php
|
ErrorDocument 404 /errors/404.php
|
||||||
ErrorDocument 405 /errors/405.php
|
|
||||||
ErrorDocument 500 /errors/500.php
|
ErrorDocument 500 /errors/500.php
|
||||||
ErrorDocument 504 /errors/504.php
|
ErrorDocument 504 /errors/504.php
|
||||||
|
|
|
@ -1,18 +0,0 @@
|
||||||
<?php
|
|
||||||
$COMMONS = "./../../docs/common";
|
|
||||||
|
|
||||||
include_once($COMMONS."/header.php");
|
|
||||||
|
|
||||||
display_header("405: Method not allowed");
|
|
||||||
?>
|
|
||||||
|
|
||||||
<article>
|
|
||||||
<h2>405: Method Not Allowed</h2>
|
|
||||||
<div class="centered-container">
|
|
||||||
<img src="https://assets.zdenekborovec.cz/upload/39486004aa605167cdda6623a4a3fa6d/7da36b469b34cc1008639612f0c17e21/d077e6ed1bd1a560a718590ae609422c.gif" alt="GIF of a cat shaking its head.">
|
|
||||||
</div>
|
|
||||||
</article>
|
|
||||||
|
|
||||||
<?php
|
|
||||||
include_once($COMMONS."/footer.php");
|
|
||||||
?>
|
|
|
@ -15,6 +15,5 @@ RewriteRule ^([^\.]+)/$ $1.php
|
||||||
# Custom error pages
|
# Custom error pages
|
||||||
ErrorDocument 403 /errors/403.php
|
ErrorDocument 403 /errors/403.php
|
||||||
ErrorDocument 404 /errors/404.php
|
ErrorDocument 404 /errors/404.php
|
||||||
ErrorDocument 405 /errors/405.php
|
|
||||||
ErrorDocument 500 /errors/500.php
|
ErrorDocument 500 /errors/500.php
|
||||||
ErrorDocument 503 /errors/503.php
|
ErrorDocument 503 /errors/503.php
|
||||||
|
|
|
@ -149,15 +149,6 @@ function load_blog($conn, $blogId){
|
||||||
$datePosted, $dateEdited, $tags, $comments);
|
$datePosted, $dateEdited, $tags, $comments);
|
||||||
}
|
}
|
||||||
|
|
||||||
// If request is not POST, throw method not allowed
|
|
||||||
if(strcmp($_SERVER["REQUEST_METHOD"], "POST") != 0)
|
|
||||||
{
|
|
||||||
header($_SERVER["SERVER_PROTOCOL"]." 405 Method Not Allowed", true, 405);
|
|
||||||
include_once($_SERVER["DOCUMENT_ROOT"]."/errors/405.php");
|
|
||||||
include_once($COMMONS."/footer.php");
|
|
||||||
die();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Check DB connection
|
// Check DB connection
|
||||||
if($conn == null){
|
if($conn == null){
|
||||||
header($_SERVER["SERVER_PROTOCOL"]." 503 Service Unavailable", true, 503);
|
header($_SERVER["SERVER_PROTOCOL"]." 503 Service Unavailable", true, 503);
|
||||||
|
@ -192,6 +183,8 @@ $blogPost = load_blog($conn, $blogId);
|
||||||
// If blogpost could not be retieved, display warning and die.
|
// If blogpost could not be retieved, display warning and die.
|
||||||
if(!$blogPost) {
|
if(!$blogPost) {
|
||||||
header($_SERVER["SERVER_PROTOCOL"]." 404 Not Foud", true, 404);
|
header($_SERVER["SERVER_PROTOCOL"]." 404 Not Foud", true, 404);
|
||||||
|
//include_once($_SERVER["DOCUMENT_ROOT"]."/errors/404.php");
|
||||||
|
//include_once($COMMONS."/footer.php");
|
||||||
die();
|
die();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -242,4 +235,60 @@ include_once(\"%s\");
|
||||||
$blogPost->address,
|
$blogPost->address,
|
||||||
addslashes($blogPost->display_comments()),
|
addslashes($blogPost->display_comments()),
|
||||||
$COMMONS."/footer.php");
|
$COMMONS."/footer.php");
|
||||||
|
|
||||||
|
/*
|
||||||
|
// Display the header with title being the blog name
|
||||||
|
display_header($blogPost->title);
|
||||||
|
|
||||||
|
// Display the blog
|
||||||
|
$blogPost->display_article();
|
||||||
|
printf("<hr style=\"border-style: solid;\">");
|
||||||
|
|
||||||
|
// Display post comment form.
|
||||||
|
if(is_null($blogPost->address))
|
||||||
|
{
|
||||||
|
printf("
|
||||||
|
<article>
|
||||||
|
<h2> Comments: </h2>
|
||||||
|
<form method=\"post\" action=\"%s\">
|
||||||
|
<input type=\"hidden\" name=\"blogpost_id\" value=\"%s\">
|
||||||
|
<label for=\"comment_entry\">Write a comment (%s):</label>
|
||||||
|
<div class=\"centered-container\">
|
||||||
|
<textarea name=\"comment_entry\" class=\"comment-box\"
|
||||||
|
tabindex=\"1\"></textarea>
|
||||||
|
</div>
|
||||||
|
<input name=\"submit\" type=\"submit\" tabindex=\"2\"
|
||||||
|
value=\"Send\">
|
||||||
|
</form>
|
||||||
|
</article>
|
||||||
|
",
|
||||||
|
htmlspecialchars($_SERVER["PHP_SELF"]), $blogId,
|
||||||
|
isset($_SESSION["current_user"]) ?
|
||||||
|
$_SESSION["current_user"]->user_name : "Guest");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
printf("
|
||||||
|
<article>
|
||||||
|
<h2> Comments: </h2>
|
||||||
|
<form method=\"post\" action=\"%s\">
|
||||||
|
<input type=\"hidden\" name=\"blogpost_id\" value=\"%s\">
|
||||||
|
<input type=\"hidden\" name=\"address\" value=\"%s\">
|
||||||
|
<label for=\"comment_entry\">Write a comment (%s):</label>
|
||||||
|
<div class=\"centered-container\">
|
||||||
|
<textarea name=\"comment_entry\" class=\"comment-box\"
|
||||||
|
tabindex=\"1\"></textarea>
|
||||||
|
</div>
|
||||||
|
<input name=\"submit\" type=\"submit\" tabindex=\"2\"
|
||||||
|
value=\"Send\">
|
||||||
|
</form>
|
||||||
|
</article>
|
||||||
|
",
|
||||||
|
htmlspecialchars($_SERVER["PHP_SELF"]), $blogId, $blogPost->address,
|
||||||
|
isset($_SESSION["current_user"]) ?
|
||||||
|
$_SESSION["current_user"]->user_name : "Guest");
|
||||||
|
}
|
||||||
|
// Display the blog comments
|
||||||
|
$blogPost->display_comments();
|
||||||
|
*/
|
||||||
?>
|
?>
|
||||||
|
|
|
@ -21,7 +21,7 @@ function display_blog_preview($blogpost_id, $blogpost_addr, $title, $abstract,
|
||||||
else {
|
else {
|
||||||
printf("
|
printf("
|
||||||
<div class=\"blog-preview\">
|
<div class=\"blog-preview\">
|
||||||
<a href=\"http://www.zdenekborovec-dev.cz/blog/article/%s\">
|
<a href=\"http://www.zdenekborovec-dev.cz/blog/article?address=%s\">
|
||||||
<h3>
|
<h3>
|
||||||
%s
|
%s
|
||||||
</h3>
|
</h3>
|
||||||
|
|
|
@ -1,18 +0,0 @@
|
||||||
<?php
|
|
||||||
$COMMONS = $_SERVER['DOCUMENT_ROOT'] . "/../common";
|
|
||||||
|
|
||||||
include_once($COMMONS."/header.php");
|
|
||||||
|
|
||||||
display_header("405: Method not allowed");
|
|
||||||
?>
|
|
||||||
|
|
||||||
<article>
|
|
||||||
<h2>405: Method Not Allowed</h2>
|
|
||||||
<div class="centered-container">
|
|
||||||
<img src="https://assets.zdenekborovec.cz/upload/39486004aa605167cdda6623a4a3fa6d/7da36b469b34cc1008639612f0c17e21/d077e6ed1bd1a560a718590ae609422c.gif" alt="GIF of a cat shaking its head.">
|
|
||||||
</div>
|
|
||||||
</article>
|
|
||||||
|
|
||||||
<?php
|
|
||||||
include_once($COMMONS."/footer.php");
|
|
||||||
?>
|
|
|
@ -3,7 +3,7 @@ $COMMONS = $_SERVER['DOCUMENT_ROOT'] . "/../common";
|
||||||
|
|
||||||
include_once($COMMONS."/header.php");
|
include_once($COMMONS."/header.php");
|
||||||
|
|
||||||
display_header("500: Internal Server Error");
|
display_header("403: Forbidden");
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<article>
|
<article>
|
||||||
|
|
|
@ -4,7 +4,7 @@ $COMMONS = $_SERVER['DOCUMENT_ROOT'] . "/../common";
|
||||||
|
|
||||||
include_once($COMMONS."/header.php");
|
include_once($COMMONS."/header.php");
|
||||||
|
|
||||||
display_header("503: Service Unavailable");
|
display_header("403: Forbidden");
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<article>
|
<article>
|
||||||
|
|
Loading…
Reference in a new issue