示例#1
0
/// See the GNU General Public License for more details. (/documents/LICENSE, /documents/COPYRIGHT)
$IV = array('POST' => array('targets' => array('list', 'default' => '', 'mandatory' => false), 'ip' => array('ip', 'default' => '', 'mandatory' => false), 'targetIPs' => array('string', 'default' => '', 'mandatory' => false)));
require ROOT . '/library/preprocessor.php';
importlib("model.blog.comment");
requireStrictRoute();
$isAjaxRequest = checkAjaxRequest();
if (isset($suri['id'])) {
    if (trashCommentInOwner($blogid, $suri['id']) === true) {
        $isAjaxRequest ? Respond::ResultPage(0) : header("Location: " . $_SERVER['HTTP_REFERER']);
    } else {
        $isAjaxRequest ? Respond::ResultPage(-1) : header("Location: " . $_SERVER['HTTP_REFERER']);
    }
} else {
    if (!empty($_POST['targets'])) {
        foreach (explode(',', $_POST['targets']) as $target) {
            trashCommentInOwner($blogid, $target);
        }
    }
    if (!empty($_POST['targetIPs'])) {
        $targetIPs = array_unique(explode(',', $_POST['targetIPs']));
        foreach ($targetIPs as $target) {
            if (Validator::ip($target)) {
                trashCommentInOwnerByIP($blogid, $target);
            }
        }
    }
    if (!empty($_POST['ip'])) {
        trashCommentInOwnerByIP($blogid, $_POST['ip']);
    }
    Respond::ResultPage(0);
}
示例#2
0
            $correction .= ' name = \'' . POD::escapeString(Utils_Unicode::correct($comment['name'], '?')) . '\'';
        }
        if (!Utils_Unicode::validate($comment['homepage'])) {
            $correction .= ' homepage = \'' . POD::escapeString(Utils_Unicode::correct($comment['homepage'], '?')) . '\'';
        }
        if (!Utils_Unicode::validate($comment['comment'])) {
            $correction .= ' comment = \'' . POD::escapeString(Utils_Unicode::correct($comment['comment'], '?')) . '\'';
        }
        if (strlen($correction) > 0) {
            POD::query("UPDATE {$database['prefix']}Comments SET {$correction} WHERE blogid = {$blogid} AND id = {$comment['id']}");
            $corrected++;
        }
        if (!is_null($comment['parent']) && $comment['isfiltered'] == 0) {
            $r2 = POD::queryCount("SELECT id FROM {$database['prefix']}Comments WHERE blogid = {$blogid} AND id = {$comment['parent']} AND isfiltered = 0");
            if ($r2 <= 0) {
                trashCommentInOwner($blogid, $comment['id']);
            }
        }
    }
    POD::free($result);
}
if ($result = POD::query("SELECT id, url, site, subject, excerpt FROM {$database['prefix']}RemoteResponses WHERE blogid = {$blogid}")) {
    while ($trackback = POD::fetch($result)) {
        setProgress($item++ / $items * 100, _t('걸린 글 데이터를 교정하고 있습니다.'));
        $correction = '';
        if (!Utils_Unicode::validate($trackback['url'])) {
            $correction .= ' url = \'' . POD::escapeString(Utils_Unicode::correct($trackback['url'], '?')) . '\'';
        }
        if (!Utils_Unicode::validate($trackback['site'])) {
            $correction .= ' site = \'' . POD::escapeString(Utils_Unicode::correct($trackback['site'], '?')) . '\'';
        }
示例#3
0
function trashCommentInOwnerByIP($blogid, $ip)
{
    $pool = DBModel::getInstance();
    $pool->reset('Comments');
    $pool->setQualifier('blogid', 'eq', $blogid);
    $pool->setQualifier('ip', 'eq', $ip, true);
    $ids = $pool->getColumn('id');
    foreach ($ids as $id) {
        trashCommentInOwner($blogid, $id);
    }
    return true;
}