includes/comment.php
changeset 832 7152ca0a0ce9
parent 825 9d5c04c1414f
child 972 437f2505d340
equal deleted inserted replaced
831:45e887f23282 832:7152ca0a0ce9
    79     {
    79     {
    80       $ret = Array('mode'=>'error','error'=>'No mode defined!');
    80       $ret = Array('mode'=>'error','error'=>'No mode defined!');
    81       echo enano_json_encode($ret);
    81       echo enano_json_encode($ret);
    82       return $ret;
    82       return $ret;
    83     }
    83     }
    84     if ( getConfig('enable_comments') == '0' )
    84     if ( getConfig('enable_comments', '1') == '0' )
    85     {
    85     {
    86       $ret = Array('mode'=>'error','error'=>'Comments are not enabled on this site.');
    86       $ret = Array('mode'=>'error','error'=>'Comments are not enabled on this site.');
    87       echo enano_json_encode($ret);
    87       echo enano_json_encode($ret);
    88       return $ret;
    88       return $ret;
    89     }
    89     }
   180         $ret['user_level']['guest'] = USER_LEVEL_GUEST;
   180         $ret['user_level']['guest'] = USER_LEVEL_GUEST;
   181         $ret['user_level']['member'] = USER_LEVEL_MEMBER;
   181         $ret['user_level']['member'] = USER_LEVEL_MEMBER;
   182         $ret['user_level']['mod'] = USER_LEVEL_MOD;
   182         $ret['user_level']['mod'] = USER_LEVEL_MOD;
   183         $ret['user_level']['admin'] = USER_LEVEL_ADMIN;
   183         $ret['user_level']['admin'] = USER_LEVEL_ADMIN;
   184         
   184         
   185         $ret['approval_needed'] = ( getConfig('approve_comments') == '1' );
   185         $ret['approval_needed'] = ( getConfig('approve_comments', '0') == '1' );
   186         $ret['guest_posting'] = getConfig('comments_need_login');
   186         $ret['guest_posting'] = getConfig('comments_need_login');
   187         
   187         
   188         if ( $ret['guest_posting'] == '1' && !$session->user_logged_in )
   188         if ( $ret['guest_posting'] == '1' && !$session->user_logged_in )
   189         {
   189         {
   190           $session->kill_captcha();
   190           $session->kill_captcha();
   304           $subj = htmlspecialchars($data['subj']);
   304           $subj = htmlspecialchars($data['subj']);
   305           $text = RenderMan::preprocess_text($data['text'], true, false);
   305           $text = RenderMan::preprocess_text($data['text'], true, false);
   306           $src = $text;
   306           $src = $text;
   307           $sql_text = $db->escape($text);
   307           $sql_text = $db->escape($text);
   308           $text = RenderMan::render($text);
   308           $text = RenderMan::render($text);
   309           $appr = ( getConfig('approve_comments') == '1' ) ? COMMENT_UNAPPROVED : COMMENT_APPROVED;
   309           $appr = ( getConfig('approve_comments', '0') == '1' ) ? COMMENT_UNAPPROVED : COMMENT_APPROVED;
   310           if ( $appr === COMMENT_APPROVED && $spam_policy === 'moderate' && !$spamcheck )
   310           if ( $appr === COMMENT_APPROVED && $spam_policy === 'moderate' && !$spamcheck )
   311             $appr = COMMENT_SPAM;
   311             $appr = COMMENT_SPAM;
   312           $time = time();
   312           $time = time();
   313           $date = enano_date('F d, Y h:i a', $time);
   313           $date = enano_date('F d, Y h:i a', $time);
   314           $ip = $_SERVER['REMOTE_ADDR'];
   314           $ip = $_SERVER['REMOTE_ADDR'];