Example #1
0
            ?>
");
	//]]>
</script>
<?php 
        } else {
            if (addComment($blogid, $comment) !== false) {
                if (!$comment['secret']) {
                    $pool->init("Entries");
                    $pool->setQualifier("blogid", "eq", $blogid);
                    $pool->setQualifier("id", "eq", $comment['entry']);
                    $pool->setQualifier("draft", "eq", 0);
                    $pool->setQualifier("visibility", "eq", 3);
                    $pool->setQualifier("acceptcomment", "eq", 1);
                    if ($row = $pool->getRow()) {
                        sendCommentPing($comment['entry'], $context->getProperty('uri.default') . "/" . ($context->getProperty('blog.useSloganOnPost') ? "entry/{$row['slogan']}" : $comment['entry']), !doesHaveMembership() ? $comment['name'] : User::getName(), !doesHaveMembership() ? $comment['homepage'] : User::getHomepage());
                    }
                }
                $skin = new Skin($context->getProperty('skin.skin'));
                printHtmlHeader();
                ?>
<script type="text/javascript">
	//<![CDATA[
		alert("<?php 
                echo _text('댓글이 등록되었습니다.');
                ?>
");
<?php 
                notifyComment();
                $entry = array();
                $entry['id'] = $comment['entry'];
Example #2
0
function updateComment($blogid, $comment, $password)
{
    $openid = Acl::getIdentity('openid');
    if (!doesHaveOwnership()) {
        // if filtered, only block and not send to trash
        if (!Filter::isAllowed($comment['homepage'])) {
            if (Filter::isFiltered('ip', $comment['ip'])) {
                return 'blocked';
            }
            if (Filter::isFiltered('name', $comment['name'])) {
                return 'blocked';
            }
            if (Filter::isFiltered('url', $comment['homepage'])) {
                return 'blocked';
            }
            if (Filter::isFiltered('content', $comment['comment'])) {
                return 'blocked';
            }
            if (!fireEvent('ModifyingComment', true, $comment)) {
                return 'blocked';
            }
        }
    }
    $pool = DBModel::getInstance();
    $comment['homepage'] = stripHTML($comment['homepage']);
    $comment['name'] = Utils_Unicode::lessenAsEncoding($comment['name'], 80);
    $comment['homepage'] = Utils_Unicode::lessenAsEncoding($comment['homepage'], 80);
    $comment['comment'] = Utils_Unicode::lessenAsEncoding($comment['comment'], 65535);
    $guestcomment = false;
    $pool->reset('Comments');
    $pool->setQualifier('blogid', 'eq', $blogid);
    $pool->setQualifier('id', 'eq', $comment['id']);
    $pool->setQualifier('replier', 'eq', NULL);
    if ($pool->doesExist()) {
        $guestcomment = true;
    }
    $pool->reset('Comments');
    $setPassword = '';
    $userid = getUserId();
    if (!empty($userid)) {
        $comment['replier'] = $userid;
        $name = User::getName($userid);
        $homepage = User::getHomepage($userid);
        $pool->setAttribute('password', '', true);
        if (empty($homepage) && $openid) {
            $homepage = $openid;
        }
    } else {
        $name = $comment['name'];
        if ($comment['password'] !== true) {
            $pool->setAttribute('password', empty($comment['password']) ? '' : md5($comment['password']), true);
        }
        $homepage = $comment['homepage'];
    }
    $comment0 = $comment['comment'];
    $wherePassword = '';
    if (!doesHaveOwnership()) {
        if ($guestcomment == false) {
            if (!doesHaveMembership()) {
                return false;
            }
            $pool->setQualifier('replier', 'eq', $userid);
        } else {
            if (empty($password) && $openid) {
                $pool->setQualifier('openid', 'eq', $openid, true);
            } else {
                $pool->setQualifier('password', 'eq', md5($password), true);
            }
        }
    }
    $replier = is_null($comment['replier']) ? NULL : $comment['replier'];
    $pool->setAttribute('name', $name, true);
    $pool->setAttribute('homepage', $homepage, true);
    $pool->setAttribute('secret', $comment['secret']);
    $pool->setAttribute('comment', $comment0, true);
    $pool->setAttribute('ip', $comment['ip'], true);
    $pool->setAttribute('written', Timestamp::getUNIXtime());
    $pool->setAttribute('isfiltered', $comment['isfiltered']);
    $pool->setAttribute('replier', $replier);
    $pool->setQualifier('blogid', 'eq', $blogid);
    $pool->setQualifier('id', 'eq', $comment['id']);
    $result = $pool->update();
    if ($result) {
        CacheControl::flushCommentRSS($comment['entry']);
        // Assume blogid = current blogid.
        CacheControl::flushDBCache('comment');
        return true;
    } else {
        return false;
    }
}
Example #3
0
function getCommentComments($parent, $parentComment = null)
{
    global $database;
    $comments = array();
    $authorized = doesHaveOwnership();
    if ($result = POD::queryAll("SELECT *\n\t\tFROM {$database['prefix']}Comments\n\t\tWHERE blogid = " . getBlogId() . "\n\t\t\tAND parent = {$parent}\n\t\t\tAND isfiltered = 0\n\t\tORDER BY written")) {
        if ($parentComment == null) {
            $parentComment = POD::queryRow("SELECT * FROM {$database['prefix']}Comments " . "  WHERE blogid = " . getBlogId() . " AND id = {$parent}");
        }
        $parentByOpenid = !empty($parentComment['openid']);
        foreach ($result as $comment) {
            if ($comment['secret'] == 1 && !$authorized) {
                if (!doesHaveOpenIDPriv($comment)) {
                    $comment['name'] = '';
                    $comment['homepage'] = '';
                    $comment['comment'] = $parentByOpenid ? _text('비밀글의 작성자만 읽을 수 있는 댓글입니다.') : _text('관리자만 볼 수 있는 댓글입니다.');
                }
            }
            if (!empty($comment['replier'])) {
                $comment['homepage'] = User::getHomepage($comment['replier']);
            }
            array_push($comments, $comment);
        }
    }
    return $comments;
}
Example #4
0
    }
    ?>
												</select>
<?php 
}
?>
												</div>
												<div>
												<input id="id-external-address" type="radio" name="type" value="external" <?php 
echo $hptype == "external" ? "checked=\"checked\"" : "";
?>
 > <label for="id-external-address"><?php 
echo _t('외부 주소');
?>
</label> <input type="text" name="homepage" id="homepage" class="input-text" value="<?php 
echo User::getHomepage();
?>
">
												</div>
												<div>
												<input id="id-default-value" type="radio" name="type" value="default" <?php 
echo $hptype == "default" ? "checked=\"checked\"" : "";
?>
 /> <label for="id-default-value"><?php 
echo _t('기본값');
?>
</label>
												</div>
											</dd>
										</dl>
									</fieldset>