Пример #1
0
        $selectCat = $downloadCatInfo['ordernum'] + 1;
        $afterSelected = "selected";
    } else {
        $selectCat = $downloadCatInfo['ordernum'] - 1;
    }
    $result = $mysqli->query("SELECT * FROM " . $dbprefix . "downloadcategory WHERE downloadcategory_id != '" . $downloadCatInfo['downloadcategory_id'] . "' ORDER BY ordernum DESC");
    while ($row = $result->fetch_assoc()) {
        $strSelected = "";
        if ($selectCat == $row['ordernum']) {
            $strSelected = "selected";
        }
        $catOrderOptions .= "<option value='" . $row['downloadcategory_id'] . "' " . $strSelected . ">" . filterText($row['name']) . "</option>";
        $countCategories++;
    }
    if ($countCategories == 0) {
        $catOrderOptions = "<option value='first'>(no other categories)</option>";
    }
    $arrDownloadExts = $downloadCatObj->getExtensions();
    $arrDispDLExts = array();
    foreach ($arrDownloadExts as $extID) {
        $downloadExtensionObj->select($extID);
        $arrDispDLExts[] = $downloadExtensionObj->get_info_filtered("extension");
    }
    $dispDownloadExts = implode(", ", $arrDispDLExts);
    echo "\n\t\n\t\t<form action='console.php?cID=" . $cID . "&catID=" . $_GET['catID'] . "&action=edit' method='post' enctype='multipart/form-data'>\n\t\t\t<div class='formDiv'>\n\t\t";
    if ($dispError != "") {
        echo "\n\t\t<div class='errorDiv'>\n\t\t<strong>Unable to edit download category because the following errors occurred:</strong><br><br>\n\t\t{$dispError}\n\t\t</div>\n\t\t";
    }
    $selectAccessType = $downloadCatInfo['accesstype'] == 1 ? " selected" : "";
    echo "\n\t\t\t\tUse the form below to edit the selected download category.<br><br>\n\t\t\t\t\n\t\t\t\t<table class='formTable'>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td class='formLabel'>Category Name:</td>\n\t\t\t\t\t\t<td class='main'><input type='text' name='catname' class='textBox' value = '" . $downloadCatInfo['name'] . "' style='width: 250px'></td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td class='formLabel'>Category Order:</td>\n\t\t\t\t\t\t<td class='main'>\n\t\t\t\t\t\t\t<select name='beforeafter' class='textBox'><option value='before'>Before</option><option value='after' " . $afterSelected . ">After</option></select><br>\n\t\t\t\t\t\t\t<select name='catorder' class='textBox'>" . $catOrderOptions . "</select>\n\t\t\t\t\t\t</td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td class='formLabel'>Extensions: <a href='javascript:void(0)' onmouseover=\"showToolTip('Enter the acceptable extensions for downloads in this category.  Separate multiple extensions with a comma (,).')\" onmouseout='hideToolTip()'>(?)</a></td>\n\t\t\t\t\t\t<td class='main'><input type='text' name='catexts' class='textBox' value='" . $dispDownloadExts . "' style='width: 250px'></td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td class='formLabel'>Access Type:</td>\n\t\t\t\t\t\t<td class='main'><select name='accesstype' class='textBox'><option value='0'>Everyone</option><option value='1'" . $selectAccessType . ">Members Only</option></select></td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td class='main' colspan='2' align='center'>\n\t\t\t\t\t\t\t<br><br>\n\t\t\t\t\t\t\t<input type='submit' name='submit' value='Edit Download Category' class='submitButton' style='width: 175px'><br><br>\n\t\t\t\t\t\t</td>\n\t\t\t\t\t</tr>\n\t\t\t\t</table>\n\t\t\t</div>\n\t\t</form>\n\t\n\t";
}
Пример #2
0
include_once $prevFolder . "classes/downloadcategory.php";
include_once $prevFolder . "classes/download.php";
$downloadObj = new Download($mysqli);
$downloadCatObj = new DownloadCategory($mysqli);
$downloadExtObj = new Basic($mysqli, "download_extensions", "extension_id");
$cID = $_GET['cID'];
$dispError = "";
$countErrors = 0;
$result = $mysqli->query("SELECT * FROM " . $dbprefix . "downloadcategory WHERE specialkey = '' ORDER BY ordernum DESC");
while ($row = $result->fetch_assoc()) {
    $arrDownloadCat[] = $row['downloadcategory_id'];
    $dispSelected = isset($_GET['catID']) && $_GET['catID'] == $row['downloadcategory_id'] ? " selected" : "";
    $downloadcatoptions .= "<option value='" . $row['downloadcategory_id'] . "'" . $dispSelected . ">" . $row['name'] . "</option>";
    $downloadCatObj->select($row['downloadcategory_id']);
    $arrExtensions = array();
    foreach ($downloadCatObj->getExtensions() as $downloadExtID) {
        $downloadExtObj->select($downloadExtID);
        $arrExtensions[] = $downloadExtObj->get_info_filtered("extension");
    }
    $dispExtensions = implode(", ", $arrExtensions);
    $downloadCatJS .= "arrCatExtension[" . $row['downloadcategory_id'] . "] = '" . $dispExtensions . "';\n\t";
}
if (count($arrDownloadCat) == 0) {
    echo "\n\t\t<div style='display: none' id='errorBox'>\n\t\t\t<p align='center'>\n\t\t\t\tA download category must be added before adding downloads!\n\t\t\t</p>\n\t\t</div>\n\t\t\n\t\t<script type='text/javascript'>\n\t\t\tpopupDialog('Add Download', '" . $MAIN_ROOT . "members', 'errorBox');\n\t\t</script>\n\t";
    exit;
}
if ($_POST['submit']) {
    // Check Name
    if (trim($_POST['title']) == "") {
        $countErrors++;
        $dispError .= "&nbsp;&nbsp;&nbsp;<b>&middot;</b> You must give your download a title.<br>";