コード例 #1
0
ファイル: post.php プロジェクト: kaz6120/Loggix
/**
 * Post Comment Controller
 *
 * @package  Loggix_Module_Comment
 * @since    5.5.15
 * @version  9.3.17
 */
/**
 * Include Module class
 */
$pathToIndex = '../..';
require_once $pathToIndex . '/lib/Loggix/Module/Comment.php';
$app = new Loggix_Module_Comment();
$config = $app->getConfigArray();
$app->insertTagSafe();
if (isset($_POST['title'], $_POST['comment'], $_POST['user_name'], $_POST['user_pass'], $_POST['refer_id'], $_POST['parent_key']) && $_POST['title'] != '' && $_POST['comment'] != '' && $_POST['user_name'] != '' && $_POST['user_pass'] != '' && $_POST['refer_id'] != '' && $_POST['parent_key'] != '') {
    // Check if posting comment to the entry is allowed.
    $checkSql = 'SELECT ' . 'allow_comments ' . 'FROM ' . LOG_TABLE . ' ' . 'WHERE ' . "id = '" . $_POST['refer_id'] . "'";
    $checkRes = $app->db->query($checkSql);
    $checkRes = $checkRes->fetchColumn();
    $receiveComment = $checkRes == '1' ? 'allowed' : 'not_allowed';
    /**
     * Comment User Cookie
     */
    if (isset($_POST['loggix_comment_cookie'])) {
        if (isset($_POST['user_name'])) {
            $item['user_cookie']['user_name'] = $_POST['user_name'];
            setcookie('loggix_comment_user', $item['user_cookie']['user_name'], time() + 86400 * 365, '/');
        }
        if (isset($_POST['user_email'])) {