include_once "../../../../_setup.php"; include_once "../../../../classes/member.php"; include_once "../../../../classes/rank.php"; include_once "../../../../classes/consoleoption.php"; include_once "../../../../classes/downloadcategory.php"; $consoleObj = new ConsoleOption($mysqli); $member = new Member($mysqli); $member->select($_SESSION['btUsername']); $downloadCatObj = new DownloadCategory($mysqli); $cID = $consoleObj->findConsoleIDByName("Manage Download Categories"); $consoleObj->select($cID); $_GET['cID'] = $cID; if ($member->authorizeLogin($_SESSION['btPassword'])) { $memberInfo = $member->get_info_filtered(); if ($member->hasAccess($consoleObj) && $downloadCatObj->select($_POST['catID'])) { define('MEMBERRANK_ID', $memberInfo['rank_id']); $downloadCatInfo = $downloadCatObj->get_info_filtered(); $arrCats = $downloadCatObj->getAssociateIDs(); if (count($arrCats) > 0) { echo "<div id='newDeleteMessage' style='display: none'><p align='center'>There are currently downloads with the download category <b>" . $downloadCatInfo['name'] . "</b>. Please move all downloads out of this category before deleting it.</p></div>"; echo "\n\t\t\t\t<script type='text/javascript'>\n\t\t\t\t\t\$(document).ready(function() {\n\t\t\t\t\t\t\$('#deleteMessage').dialog('close');\n\t\t\t\t\t\t\$('#newDeleteMessage').dialog({\n\t\t\t\t\t\t\n\t\t\t\t\t\t\ttitle: 'Manage Download Categories - Delete',\n\t\t\t\t\t\t\tmodal: true,\n\t\t\t\t\t\t\tzIndex: 9999,\n\t\t\t\t\t\t\tresizable: false,\n\t\t\t\t\t\t\tshow: 'scale',\n\t\t\t\t\t\t\twidth: 400,\n\t\t\t\t\t\t\tbuttons: {\n\t\t\t\t\t\t\t\t'OK': function() {\n\t\t\t\t\t\t\t\t\t\$(this).dialog('close');\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t});\n\t\t\t\t\t\n\t\t\t\t\t});\n\t\t\t\t</script>\n\t\t\t"; } elseif ($_POST['confirm'] == "1") { $downloadCatObj->delete(); include "main.php"; } else { echo "<p align='center'>Are you sure you want to delete the download category <b>" . $downloadCatInfo['name'] . "</b>?</p>"; } } elseif (!$downloadCatObj->select($_POST['catID'])) { echo "<p align='center'>Unable find the selected download category. Please try again or contact the website administrator.</p>"; } }
$downloadObj = new Download($mysqli); $downloadCatObj = new DownloadCategory($mysqli); } echo "\n\t<table class='formTable' style='margin-top: 0px; border-spacing: 0px'>\n\t\t<tr><td class='dottedLine' colspan='4'></td></tr>\n"; $result = $mysqli->query("SELECT * FROM " . $dbprefix . "downloadcategory WHERE specialkey = '' ORDER BY ordernum DESC"); while ($row = $result->fetch_assoc()) { $arrDownloadCat[$row['downloadcategory_id']] = filterText($row['name']); } $dispOrderBY = isset($_POST['orderby']) && $_POST['orderby'] == "name" ? "ORDER BY name" : "ORDER BY dateuploaded "; $dispOrderBY .= isset($_POST['dir']) && $_POST['dir'] == "asc" ? "ASC" : "DESC"; $editCatCID = $consoleObj->findConsoleIDByName("Manage Download Categories"); $addDLCID = $consoleObj->findConsoleIDByName("Add Download"); $totalDownloads = 0; foreach ($arrDownloadCat as $catID => $catName) { $downloadCatObj->select($catID); $arrDownloads = $downloadCatObj->getAssociateIDs($dispOrderBY); if (count($arrDownloads) > 0) { echo "\n\t\t\t<tr>\n\t\t\t\t<td class='main manageList dottedLine' colspan='2' style='width: 76%'><b><u>" . $catName . "</u></b></td>\n\t\t\t\t<td class='main manageList dottedLine' align='center' style='width: 12%'><a href='" . $MAIN_ROOT . "members/console.php?cID=" . $addDLCID . "&catID=" . $catID . "'><img src='" . $MAIN_ROOT . "themes/" . $THEME . "/images/buttons/add.png' class='manageListActionButton' title='Add Download to " . $catName . "'></a></td>\n\t\t\t\t<td class='main manageList dottedLine' align='center' style='width: 12%'><a href='" . $MAIN_ROOT . "members/console.php?cID=" . $editCatCID . "&action=edit&catID=" . $catID . "'><img src='" . $MAIN_ROOT . "themes/" . $THEME . "/images/buttons/edit.png' class='manageListActionButton' title='Edit " . $catName . " Category'></a></td>\n\t\t\t</tr>\n\t\t"; $altBGCount = 0; foreach ($arrDownloads as $dlID) { $downloadObj->select($dlID); $dlInfo = $downloadObj->get_info_filtered(); if ($altBGCount == 0) { $addCSS = ""; $altBGCount = 1; } else { $addCSS = " alternateBGColor"; $altBGCount = 0; } $dispTime = getPreciseTime($dlInfo['dateuploaded']); echo "\n\t\t\t\t<tr>\n\t\t\t\t\t<td class='main manageList dottedLine" . $addCSS . "' style='width: 46%; padding-left: 10px; font-weight: bold'><a href='" . $MAIN_ROOT . "members/console.php?cID=" . $cID . "&action=edit&dlID=" . $dlID . "'>" . $dlInfo['name'] . "</a></td>\n\t\t\t\t\t<td class='main manageList dottedLine" . $addCSS . "' style='width: 30%; padding-left: 5px'>" . $dispTime . "</td>\n\t\t\t\t\t<td class='main manageList dottedLine" . $addCSS . "' align='center' style='width: 12%'><a href='" . $MAIN_ROOT . "members/console.php?cID=" . $cID . "&action=edit&dlID=" . $dlID . "'><img src='" . $MAIN_ROOT . "themes/" . $THEME . "/images/buttons/edit.png' class='manageListActionButton' title='Edit Download'></a></td>\n\t\t\t\t\t<td class='main manageList dottedLine" . $addCSS . "' align='center' style='width: 12%'><a href='javascript:void(0)' onclick=\"deleteDL('" . $dlID . "')\"><img src='" . $MAIN_ROOT . "themes/" . $THEME . "/images/buttons/delete.png' class='manageListActionButton'></a></td>\n\t\t\t\t</tr>\n\t\t\t";
die("<script type='text/javascript'>window.location = '" . $MAIN_ROOT . "banned.php';</script>"); } else { $ipbanObj->delete(); } } $downloadCatInfo = $downloadCatObj->get_info_filtered(); // Start Page $PAGE_NAME = $downloadCatInfo['name'] . " - Downloads - "; $dispBreadCrumb = ""; include $prevFolder . "themes/" . $THEME . "/_header.php"; $breadcrumbObj->setTitle($downloadCatInfo['name']); $breadcrumbObj->addCrumb("Home", $MAIN_ROOT); $breadcrumbObj->addCrumb("Downloads: " . $downloadCatInfo['name']); include $prevFolder . "include/breadcrumb.php"; $posterMemberObj = new Member($mysqli); $arrDownloads = $downloadCatObj->getAssociateIDs("ORDER BY dateuploaded DESC"); foreach ($arrDownloads as $dlID) { $downloadObj->select($dlID); $downloadInfo = $downloadObj->get_info_filtered(); $posterMemberObj->select($downloadInfo['member_id']); $posterInfo = $posterMemberObj->get_info_filtered(); if ($posterInfo['avatar'] == "") { $posterInfo['avatar'] = $MAIN_ROOT . "themes/" . $THEME . "/images/defaultavatar.png"; } else { $posterInfo['avatar'] = $MAIN_ROOT . $posterInfo['avatar']; } $dispFileSize = $downloadInfo['filesize'] / 1024; if ($dispFileSize < 1) { $dispFileSize = $downloadInfo['filesize'] . "B"; } elseif ($dispFileSize / 1024 < 1) { $dispFileSize = round($dispFileSize, 2) . "KB";