<?php require_once __DIR__ . '/../includes/helpers.php'; require_once __DIR__ . '/../loader.php'; if (empty($_GET['id']) and empty($_GET['slug'])) { redirect_to("index.php"); } if (isset($_GET['id'])) { $p = Pics::getPic($_GET['id']); } else { $p = Pics::getBySlug($_GET['slug']); } $c = Comment::findComments($p->id); if (!$p) { redirect_to("index.php"); } if (isset($_POST['submit'])) { if (CSRF::check($_POST['token'])) { $author = htmlspecialchars($_POST['author']); $body = htmlspecialchars($_POST['body']); $comment = Comment::make($p->id, $author, $body); if ($comment) { $comment->create(); $msg = opmsg("Comment posted successfully and awaiting moderation!", "success"); } else { $msg = opmsg("Failed", "danger"); } } else { $msg = opmsg("Failed", "danger"); } } else {
<th class="text-center">Picture</th> <th class="text-center">Author</th> <th class="text-center">Body</th> <th class="text-center">Added On</th> <th class="text-center">Last Edited</th> <th class="text-center">Status</th> <th class="text-center">Delete</th> </tr> </thead> <tbody> <?php foreach ($comments as $c) { ?> <tr> <td class="text-center" data-title="Picture"><img style="width:100px;height:100px;" class="img-thumbnail" src="../images/<?php echo Pics::getPic($c->pid)->filename; ?> "></td> <td class="text-center" data-title="Author"><?php echo $c->author; ?> </td> <td class="text-center" data-title="Body"><?php echo $c->body; ?> </td> <td class="text-center" data-title="Added On"><?php echo $c->created_at; ?> </td> <td class="text-center" data-title="Last Edited"><?php
<?php if ($picId == 'new') { $picInsert = new PicInsert(); $pic = new Pic(); } else { $picUpdate = new PicUpdate($picId); $pics = new Pics($picId); $pic = new Pic($pics->getPic()); } $picDelete = new PicDelete($pic); ?> <form enctype="multipart/form-data" class="box pics" method="post" action="<?php echo BASEPATH . DS . $page . DS . $tab . DS . $picId; ?> " name="picform"> <ul class="layout"> <li> <label for="pic_name">Name: </label> <input id="pic_name" class="pic_input" type="text" value="<?php echo $pic->getName(); ?> " name="name" autocomplete="off" placeholder="Bildbeschreibung eingeben" required /> </li> <li> <label for="pic_image">Image: </label><br> <img src="<?php echo $pic->getFilename(); ?> ">
<?php require_once __DIR__ . '/../../includes/helpers.php'; require_once __DIR__ . '/../../loader.php'; Session::checkSession(); $a = new Auth(); if (!$a->isLoggedIn()) { redirect_to('login.php'); exit; } $u = User::getUser(); //$l = Logger::start(); $msg = ""; if (isset($_POST['edit'])) { $pic = Pics::getPic($_POST['eid']); if ($pic) { $id = $pic->id; $caption = $pic->caption; $file = "../images/" . $pic->filename; } else { redirect_to('manageusers.php'); exit; } } if (isset($_POST['update'])) { $id = $_POST['id']; $data = array('username' => $_POST['username'], 'password' => password_hash($_POST['password'], PASSWORD_BCRYPT), 'fname' => $_POST['fname'], 'lname' => $_POST['lname']); $update = User::update($id, $data); if ($update) { $msg = opmsg("User Updated Successfully", "success"); redirect_to('manageusers.php');