diff --git a/comments.php b/comments.php index 6b0d224..9d2b0f0 100644 --- a/comments.php +++ b/comments.php @@ -12,6 +12,7 @@ require 'functions/votes.php'; $apiroot = $config->apiUrl; $baseurl = $config->baseUrl; +$mainaction = true; //check if user is logged in. if not, redirect to login page if(!isset($_SESSION['userid'])) { @@ -39,27 +40,30 @@ } if(isset($_GET['upvotecomment'])){ + $mainaction = false; //upvote a comment voteComment( $_GET['upvotecomment'], "up"); } if(isset($_GET['downvotecomment'])){ + $mainaction = false; //Downvote a comment voteComment( $_GET['downvotecomment'], "down"); } if(isset($_GET['upvotejodel'])){ + $mainaction = false; //upvote post voteJodel( $_GET['upvotejodel'], "up"); } if(isset($_GET['downvotejodel'])){ + $mainaction = false; //downvote post voteJodel( $_GET['downvotejodel'], "down"); } - - +if($mainaction == true){ ?>
@@ -182,4 +186,5 @@ apiUrl; $baseurl = $config->baseUrl; - + $mainaction = true; if(!isset($_SESSION['userid'])) { header('Location: ' . $config->baseUrl . 'login.php'); @@ -44,15 +44,18 @@ //if joels.php?upvotejodel=$jodelID is called, upvote it if(isset($_GET['upvotejodel'])){ + $mainaction = false; voteJodel( $_GET['upvotejodel'], "up"); } //if jodels.php?downvotejodel=$jodelID ist called, downvote post if(isset($_GET['downvotejodel'])){ + $mainaction = false; voteJodel( $_GET['downvotejodel'], "down"); } + if($mainaction == true){ //If jodels.php?sort=$sort is called, post should be sorted if(isset($_GET['sort'])){ $parameter = $_GET['sort']; @@ -81,6 +84,7 @@ } } + ?> @@ -203,4 +207,5 @@ apiUrl; + $mainaction = true; //If user sent loginform, set values if(isset($_GET['login'])) { + $mainaction = false; $username = $_POST['username']; $password = $_POST['password']; //check if captcha is solved @@ -60,7 +62,7 @@ } - + if($mainaction == true){ ?> @@ -106,4 +108,5 @@ apiUrl; + $mainaction = true; + if(isset($_GET['register'])) { + $mainaction = false; //User wants to register //set local values for easy handling $error = false; @@ -74,6 +77,7 @@ } + if($mainaction == true){ ?> @@ -125,4 +129,5 @@ -apiUrl; if(isset($_GET['addcolor'])){ + $mainaction = false; //user wants to add a color //save colorname & hexcode in values $colorname = $_POST['colorname']; @@ -32,6 +34,7 @@ } if(isset($_GET['delcol'])){ + $mainaction = false; //user wants to delete a color //get ID of color to delete $colorid = $_GET['delcol']; @@ -42,6 +45,7 @@ //redirect header('Location: ' . $config->baseUrl . 'user/colormgmt.php'); } + if($mainaction == true){ ?> @@ -117,4 +121,5 @@ @@ -292,6 +294,9 @@ } } } + + include '../functions/footer.php'; +} ?> \ No newline at end of file diff --git a/user/postmgmt.php b/user/postmgmt.php index 4a67f3f..d61b13f 100644 --- a/user/postmgmt.php +++ b/user/postmgmt.php @@ -7,6 +7,7 @@ $title = "Postmanagement | SocialDomayn"; $stylesheet = "jodel.css"; include '../functions/header.php'; + $mainaction = true; //check if user is logged in & has required caps $mycaps = $_SESSION['my_caps']; @@ -59,6 +60,7 @@ } //delete a post if(isset($_GET['del'])){ + $mainaction = false; //get post to delete and setup delete URL for API, call it, redirect back $post2del = $_GET['del']; $callurl = $apiroot . "jodels/" . $post2del; @@ -68,6 +70,7 @@ //update a post if(isset($_GET['update'])){ + $mainaction = false; //get all values and do not allow injections $postid = $_POST['jodelID']; $author = htmlspecialchars($_POST['author'], ENT_QUOTES); @@ -87,7 +90,7 @@ } - + if($mainaction == false){ ?>