Esempio n. 1
0
function undeleteLine()
{
    global $debug, $message, $success, $Dbc, $returnThis;
    $output = '';
    try {
        if (!isset($_SESSION['listRoleId']) || $_SESSION['listRoleId'] < 2) {
            throw new Adrlist_CustomException("Your role doesn't allow you to edit this list.", '');
        } elseif (empty($_POST['lineId'])) {
            throw new Adrlist_CustomException('', 'lineId is empty.');
        } elseif (empty($_POST['charId'])) {
            throw new Adrlist_CustomException('', 'charName is empty.');
        }
        $Dbc->beginTransaction();
        $updateDeletedLinesStmt = $Dbc->prepare("UPDATE\n\tlinesTable\nSET\n\tlinesTable.dId = NULL,\n\tlinesTable.deleted = NULL\nWHERE\n\tlinesTable.lineId = ?");
        $updateDeletedLinesStmt->execute(array(intThis($_POST['lineId'])));
        $updateDeletedCharactersStmt = $Dbc->prepare("UPDATE\n\tcharacters\nSET\n\tcharacters.dId = NULL,\n\tcharacters.deleted = NULL\nWHERE\n\tcharacters.charId = ?");
        $updateDeletedCharactersStmt->execute(array(intThis($_POST['charId'])));
        $Dbc->commit();
        updateListHist($_SESSION['listId']);
        if (MODE == 'undeleteLine') {
            $success = true;
            $returnThis['buildLines'] = buildLines();
        }
    } catch (Adrlist_CustomException $e) {
    } catch (PDOException $e) {
        error(__LINE__, '', '<pre>' . $e . '</pre>');
    }
    if (MODE == 'undeleteLine') {
        returnData();
    }
}
Esempio n. 2
0
function unlockList()
{
    global $debug, $message, $success, $Dbc, $returnThis;
    try {
        if (empty($_POST['listId'])) {
            throw new Adrlist_CustomException('', '$_POST[\'listId\'] is empty.');
        } elseif (empty($_SESSION['credits'])) {
            throw new Adrlist_CustomException('You don\'t have any credits. Credits can be purchased in <a href="' . LINKMYACCOUNT . '" data-ajax="false">My Account</a>', '$_SESSION[\'credits\'] is empty.');
        }
        $listInfo = getListInfo($_SESSION['userId'], $_POST['listId']);
        if ($listInfo['listRoleId'] < 4) {
            throw new Adrlist_CustomException('Your role does not allow you to unlock this list.', '$listInfo[\'listRoleId\']: ' . $listInfo['listRoleId']);
        }
        $unlockStmt = $Dbc->prepare("UPDATE\n\tlists\nSET\n\tlocked = 0\nWHERE\n\tlistId = ?");
        $unlockStmt->execute(array($_POST['listId']));
        updateListHist($_POST['listId']);
        $locked = reconcileLists($_SESSION['userId']);
        if (MODE == 'unlockList') {
            $success = true;
            $returnThis['locked'] = $locked;
            $returnThis['buildLists'] = buildLists();
        }
    } catch (Adrlist_CustomException $e) {
    } catch (PDOException $e) {
        error(__LINE__, '', '<pre>' . $e . '</pre>');
    }
    if (MODE == 'unlockList') {
        returnData();
    }
}