<?php // comment filters if (isset($_GET['cofilter'])) { $area = 'cofilter'; $areaName = 'Comment filters'; $pageOffset = isset($_GET['offset']) && is_numeric($_GET['offset']) ? $_GET['offset'] : 0; $itemsPerPage = 20; $status = isset($_GET['status']) ? $_GET['status'] : FALSE; $filter = array(); $filter['LIMIT'] = sprintf('%d, %d', $pageOffset * $itemsPerPage, $itemsPerPage); if (ae_CommentfilterModel::isValidStatus($status)) { $filter['WHERE'] = 'cf_status = "' . $status . '"'; } $list = new ae_CommentfilterList($filter); $urlBasis = '?area=settings&offset=' . $pageOffset . '&' . $area; } else { $area = 'general'; $areaName = 'General'; } ?> <h1>Settings: <?php echo $areaName; ?> </h1> <?php if ($area == 'general') { ?>
try { $co->setPostId($_POST['comment-post']); } catch (Exception $exc) { header('Location: ../?p=' . $_POST['comment-post'] . '&error=invalid_data#comment-form'); exit; } // Forgivable errors with default values for fallback try { $co->setAuthorName($_POST['comment-author-name']); $co->setAuthorEmail($_POST['comment-author-email']); $co->setAuthorUrl($url); $co->setAuthorIp($_SERVER['REMOTE_ADDR']); $co->setContent($content); $co->setStatus(COMMENT_DEFAULT_STATUS); if (ae_Security::isLoggedIn()) { $co->setUserId(ae_Security::getCurrentUserId()); } $filter = array('LIMIT' => FALSE, 'WHERE' => 'cf_status = :status'); $params = array(':status' => ae_CommentfilterModel::STATUS_ACTIVE); $cfList = new ae_CommentfilterList($filter, $params, FALSE); $keep = $cfList->applyFilters($co); if (!$keep) { header('Location: ../?p=' . $_POST['comment-post'] . '&error=comment_deleted_by_filter'); exit; } $co->save(); } catch (Exception $exc) { header('Location: ../?p=' . $_POST['comment-post'] . '&error=failed_to_save#comment-form'); exit; } header('Location: ../?p=' . $_POST['comment-post'] . '&saved#comment-' . $co->getId());