function loadcomment($id, $number) { include '../page/protection.php'; include '../page/db.php'; $id = (int) base64url_decode($id); $sql = "SELECT * FROM Comments WHERE ID='{$id}'"; $data = mysqli_query($conn, $sql); $data = mysqli_fetch_assoc($data); $userid = $data['UserID']; $usersql = "SELECT UserName,ProfilePicture FROM UserAccounts WHERE RowID='{$userid}'"; $userdata = mysqli_query($conn, $usersql); $userdata = mysqli_fetch_assoc($userdata); $user = $userdata['UserName']; $comment = $data['Comment']; $space = " "; $postdate = date_create($data['CreateDate']); $postdate = date_format($postdate, 'm/d/Y g:ia'); $modifieddate = date_create($data['ModifiedDate']); $modifieddate = date_format($modifieddate, 'm/d/Y g:ia'); if ($userid === $_SESSION['id']) { $poster = "<span style=\"float:right;padding-right:10px;\" class=\"link2\"><a href=\"/admin/CommentDelete?a=" . base64url_encode($id) . "\">Delete</a></span>"; } if ($data['Edited']) { $time = "<span style=\"float:right;\">Edited: " . $modifieddate . "</span>"; } else { $time = "<span style=\"float:right;\">Posted: " . $postdate . "</span>"; } $text .= "\n\t\t\t<div class=\"commentshadow\" id=\"comment-{$id}\">\n\t\t\t<div class=\"commenttitle\">#{$number} " . $time . $poster . "</div>\n\t\t\t<div class=\"fullcomment\">\n\t\t\t<!--<hr class=\"commenthr\">-->\n\t\t\t<div class=\"commentimage\">\n\t\t"; $text .= "<div class=\"commentimageinner\"><span class=\"profilepichelper\"></span>"; if (strlen($userdata['ProfilePicture'])) { $text .= "<img src=\"/account/ProfilePictureShow?a=" . base64url_encode($userid) . "\" class=\"commentpic\">"; } else { $text .= "<img src=\"/theme/grey-question-mark.png\" class=\"commentpic hideLight\">"; $text .= "<img src=\"/theme/darkgrey-question-mark.png\" class=\"commentpic hideDark\">"; } $text .= "</div>"; $text .= "\n\t\t\t</div>\n\t\t\t\t<div class=\"commentusername\"><span class=\"link3\"><a href=\"/account/Profile?a=" . base64url_encode($userid) . "\">{$user}</a></span></div>\n\t\t"; include '../page/BBCode.php'; if (isset($comment)) { $comment = decrypt($comment); $comment = strip_tags($comment); $comment = preg_replace('/\\r\\n?/', "\n<br />", $comment); $comment = bb_parse($comment); } else { $comment = ''; } $text .= "<div class=\"comment\">" . $comment . "</div></div></div>"; mysqli_close($conn); return $text; }
function insert_news($title, $content, $username) { include_once "db.inc.php"; $db = new DB(); $db->open(); $message_date = date('m-j-Y'); $message_time = date('H:i A'); $data = $content; function bb_php($data) { $data = str_replace("]\n", "]", $data); $match = array('#\\[php\\](.*?)\\[\\/php\\]#se'); $replace = array("'<div>'.highlight_string(stripslashes('\$1'), true).'</div>'"); return preg_replace($match, $replace, $data); } function bb_parse($data) { $data = bb_php($data); return $data; } bb_parse($data); $query = "INSERT INTO Sitenews (title, content, newsdate, newstime, user) VALUES ('{$title}', '{$data}', '{$message_date}', '{$message_time}', '{$username}');"; $result = $db->query($query); }
$restorer = mysqli_query($conn, $sql); $restorer = mysqli_fetch_assoc($restorer); $restoredName = $restorer['UserName']; echo "\n\t\t\t\t\t\t\t<span style=\"text-align:Left;\">Restored by: <span class=\"link2\"><a href=\"/account/Profile?a=" . base64url_encode($restoredid) . "\">{$restoredName}</a></span></span><br />\n\t\t\t\t\t\t\t<span style=\"text-align:Left;\">Restored Time: {$restoredTime}</span><br /><br />\n\t\t\t\t\t\t"; } } //echo("<br />"); } else { echo "\n\t\t\t\t\t\t<span style=\"text-align:Left;\">Written by: <a href=\"/account/Profile?a=" . base64url_encode($userid) . "\">{$writer}</a></span><br />\n\t\t\t\t\t\t<span style=\"text-align:Left;\">Last edited by: <a href=\"/account/Profile?a=" . base64url_encode($lastid) . "\">{$editer}</a></span><br />\n\t\t\t\t\t\t<span style=\"text-align:Left;\">Last edited Time: {$lastTime}</span><br /><br />\n\t\t\t\t\t"; } $sql = "SELECT ID FROM Comments WHERE PageID='{$str}' AND Deleted='0'"; $comments = mysqli_query($conn, $sql); $numberofcomments = mysqli_num_rows($comments); $sql = "SELECT ID,Deleted FROM Comments WHERE PageID='{$str}'"; $comments = mysqli_query($conn, $sql); echo "\n\t\t\t\t\t<div class=\"DescriptionText\">" . bb_parse($desc) . "</div>\n\t\t\t\t"; if ($commentable) { echo "\t\t\n\t\t\t\t\t\t<br /><br />\n\t\t\t\t\t\t<div style=\"color:grey;font-size:12px;\">({$numberofcomments}) Number of Comments</div><br/>\n\t\t\t\t\t"; } else { echo "\t\t\n\t\t\t\t\t\t<br /><br />\n\t\t\t\t\t\t<div style=\"color:grey;font-size:12px;\">Comments are disabled on this page.</div><br/>\n\t\t\t\t\t"; } if ($_SESSION['valid'] && $commentable) { echo "\n\t\t\t\t\t\t<span class=\"link2\"><a href=\"/admin/PostComment?a=" . $_REQUEST['a'] . "\">Comment on this page</a></span><br />\n\t\t\t\t\t"; } if ($numberofcomments) { $number = 1; include '../admin/Comment.php'; while ($row = mysqli_fetch_assoc($comments)) { if (!$row['Deleted']) { echo "<br />"; echo loadcomment(base64url_encode($row['ID']), $number);
?> </h2> <div class="text"> <?php include '../page/BBCode.php'; $PostDate = date_format($PostDate, 'm/d/Y g:ia'); $LastUpdatedDate = date_format($LastUpdatedDate, 'm/d/Y g:ia'); $ResolveDate = date_format($ResolveDate, 'm/d/Y g:ia'); echo "\n\t\t\t\t\t<span style=\"text-align:Left;\">Ticket by: <span class=\"link2\"><a href=\"/account/Profile?a=" . base64url_encode($PostUserID) . "\">{$PostUserName}</a></span><br />\n\t\t\t\t\t<span style=\"text-align:Left;\">Ticket Created: {$PostDate}</span><br />\n\t\t\t\t\t<span style=\"text-align:Left;\">Last Updated: {$LastUpdatedDate}</span><br /><br />\n\t\t\t\t"; if ($Resolved) { echo "\n\t\t\t\t\t<span style=\"text-align:Left;\">Resolved by: <span class=\"link2\"><a href=\"/account/Profile?a=" . base64url_encode($ResolvedUserID) . "\">{$ResolvedUserName}</a></span><br />\n\t\t\t\t\t<span style=\"text-align:Left;\">Resolved on: {$ResolveDate}</span><br /><br />\n\t\t\t\t"; } $sql = "SELECT ID FROM SupportTicketComments WHERE TicketID='{$str}'"; $comments = mysqli_query($conn, $sql); $numberofcomments = mysqli_num_rows($comments); echo "\n\t\t\t\t\tTicket Information:<br /><br />\n\t\t\t\t\t<div class=\"DescriptionText\">" . bb_parse($desc) . "</div>\n\t\t\t\t"; if (true) { echo "\t\t\n\t\t\t\t\t\t<br /><br />\n\t\t\t\t\t\t<div style=\"color:grey;font-size:12px;\">({$numberofcomments}) Number of Comments</div><br/>\n\t\t\t\t\t"; } else { echo "\t\t\n\t\t\t\t\t\t<br /><br />\n\t\t\t\t\t\t<div style=\"color:grey;font-size:12px;\">Comments are disabled on this page.</div><br/>\n\t\t\t\t\t"; } if ($_SESSION['valid'] && true) { echo "\n\t\t\t\t\t\t<span class=\"link2\"><a href=\"/support/PostTicketComment?a=" . $_REQUEST['a'] . "\">Comment on this Ticket</a></span><br />\n\t\t\t\t\t"; } if ($numberofcomments) { $number = 1; include '../support/TicketComment.php'; while ($row = mysqli_fetch_assoc($comments)) { if (true) { echo "<br />"; echo loadticketcomment(base64url_encode($row['ID']), $number);
echo "\n\t\t\t\t\t\t\t" . $email . "<br /><br />\n\t\t\t\t\t\t"; } } if ($data['ShowAge']) { echo "\n\t\t\t\t\t\tAge: \n\t\t\t\t\t\t" . $age . "<br /><br />\n\t\t\t\t\t"; } if ($data['ShowGender']) { echo "\n\t\t\t\t\t\tGender: \n\t\t\t\t\t\t" . $gender . "<br /><br />\n\t\t\t\t\t"; } echo "\n\t\t\t\t\t\tUnique ID: " . $data['UniqueID'] . "<br /><br />\n\t\t\t\t\t\tMember since:<br />\n\t\t\t\t\t\t" . $createdate . "</div><br />\n\t\t\t\t"; include '../page/BBCode.php'; if (isset($desc)) { $desc = decrypt($desc); $desc = strip_tags($desc); $desc = preg_replace('/\\r\\n?/', "\n<br />", $desc); $desc = bb_parse($desc); } else { $desc = ''; } if ($_SESSION['id'] === $id) { $edit = '<span class="link3"><a href="/account/Biography">Edit</a></span>'; } else { $edit = ''; } echo "<div class=\"DescriptionText Bio\">Biography: " . $space . $space . $space . $edit . "<br />" . $desc . "</div>"; ?> </div> </div> </div> </div> <?php