if (!$member->hasAccess($consoleObj)) {
        exit;
    }
}
include $prevFolder . "classes/profilecategory.php";
$profileCatObj = new ProfileCategory($mysqli);
$cID = $_GET['cID'];
if ($_POST['submit']) {
    $countErrors = 0;
    // Check Category Name
    if (trim($_POST['catname']) == "") {
        $countErrors++;
        $dispError .= "&nbsp;&nbsp;&nbsp;<b>&middot;</b> You must enter a Category Name.<br>";
    }
    // Check Category Order
    $intNewOrderSpot = $profileCatObj->validateOrder($_POST['catorder'], $_POST['beforeafter']);
    if ($intNewOrderSpot === false) {
        $countErrors++;
        $dispError .= "&nbsp;&nbsp;&nbsp;<b>&middot;</b> You selected an invalid category order.<br>";
    }
    if ($countErrors == 0) {
        $arrColumns = array("name", "ordernum");
        $arrValues = array($_POST['catname'], $intNewOrderSpot);
        if ($profileCatObj->addNew($arrColumns, $arrValues)) {
            $profileCatInfo = $profileCatObj->get_info_filtered();
            echo "\n\t\t\t<div style='display: none' id='successBox'>\n\t\t\t\t<p align='center'>\n\t\t\t\t\tSuccessfully Added New Profile Category: <b>" . $profileCatInfo['name'] . "</b>!\n\t\t\t\t</p>\n\t\t\t</div>\n\t\t\t\n\t\t\t<script type='text/javascript'>\n\t\t\t\tpopupDialog('Add Profile Category', '" . $MAIN_ROOT . "members', 'successBox');\n\t\t\t</script>\n\t\t\t";
        } else {
            $countErrors++;
            $dispError .= "&nbsp;&nbsp;&nbsp;<b>&middot;</b> Unable to save category to the database.  Please contact the website administrator.<br>";
        }
    }
Beispiel #2
0
$profileCatObj = new ProfileCategory($mysqli);
if (!$profileCatObj->select($_GET['catID'])) {
    die("<script type='text/javascript'>window.location = '" . $MAIN_ROOT . "members';</script>");
}
$profileCatInfo = $profileCatObj->get_info_filtered();
echo "\n\n<script type='text/javascript'>\n\$(document).ready(function() {\n\$('#breadCrumb').html(\"<a href='" . $MAIN_ROOT . "'>Home</a> > <a href='" . $MAIN_ROOT . "members'>My Account</a> > <a href='" . $MAIN_ROOT . "members/console.php?cID=" . $cID . "'>Manage Profile Categories</a> > " . $profileCatInfo['name'] . "\");\n});\n</script>\n";
$dispError = "";
if ($_POST['submit']) {
    $countErrors = 0;
    // Check Cat Name
    if (trim($_POST['catname']) == "") {
        $countErrors++;
        $dispError .= "&nbsp;&nbsp;&nbsp;<b>&middot;</b> You must enter a Category Name.<br>";
    }
    // Check Category Order
    $intNewOrderSpot = $profileCatObj->validateOrder($_POST['catorder'], $_POST['beforeafter'], true, $profileCatInfo['ordernum']);
    if ($intNewOrderSpot === false) {
        $countErrors++;
        $dispError .= "&nbsp;&nbsp;&nbsp;<b>&middot;</b> You selected an invalid category order.<br>";
    }
    if ($countErrors == 0) {
        $arrUpdateColumn = array("name");
        $arrUpdateValues = array($_POST['catname']);
        $resortOrder = false;
        if ($intNewOrderSpot != $profileCatInfo['ordernum']) {
            $arrUpdateColumn[] = "ordernum";
            $arrUpdateValues[] = $intNewOrderSpot;
            $resortOrder = true;
        }
        $profileCatObj->select($profileCatInfo['profilecategory_id']);
        if ($profileCatObj->update($arrUpdateColumn, $arrUpdateValues)) {