adminPage(); if (strtoupper($_SERVER['REQUEST_METHOD']) == 'POST') { $fileID = $_POST['fileID']; $key = $_POST['key']; $conn = getConnection(); $file = new Uploadedfile($conn); $file = $file->load($fileID); if ($key == hash('md5', KEY . $file->getPath())) { menubar(); $fileUpdate = new Uploadedfile(); $fileUpdate->setCampus(issetOrBlank($_POST['file-campus'])); $fileUpdate->setCategory(issetOrBlank($_POST['file-category'])); $fileUpdate->setFaculty(issetOrBlank($_POST['file-faculty'])); $fileUpdate->setExpiry(trim($_POST['file-expiry']) == "" ? "0000-00-00 00:00:00" : date('Y-m-d H:i:s', strtotime($_POST['file-expiry']))); ///0000-00-00 00:00:00 $fileUpdate->setDescription($_POST['file-description']); if (issetOrBlank($_POST['file-tags']) != $file->getTags()) { //sort the tags $tags = array_filter(array_map('trim', explode(',', issetOrBlank($_POST['file-tags'])))); asort($tags); $tags = implode(', ', $tags); $fileUpdate->setTags($tags); $query = "SELECT `option` FROM `options` WHERE `group_id` = 4 order by `sort`"; $Otags = $conn->query($query); $Otags->execute(); $Otags = $Otags->fetchAll(PDO::FETCH_COLUMN); //echo $tags; $newTags = explode(",", $fileUpdate->getTags()); $addTags = array_diff($newTags, $Otags); $pos = sizeof($Otags); foreach ($addTags as $tag) {