Changeset 2490

Show
Ignore:
Timestamp:
09/14/06 14:50:12 (5 months ago)
Author:
demian
Message:

Integrated captcha with comments

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/0.6-bugfix/CHANGELOG.txt

    r2488 r2490  
    2929 
    3030IMPROVEMENTS 
     3114-09-06    Integrated captcha with comments 
    313214-09-06    Added config GUI switch for enabling the library cache 
    323311-09-06    Added ability to disable blocks on a per-page basis, simply have the 
  • branches/0.6-bugfix/modules/comment/classes/CommentMgr.php

    r2460 r2490  
    7575        $input->callerId    = $req->get('frmCallerId'); 
    7676        $input->callerTmpl  = $req->get('frmCallerTmpl'); 
     77        $input->captcha     = $req->get('frmCaptcha'); 
    7778 
    7879        // if receiving post 
     
    8990            if (empty($input->comment->body)) { 
    9091                $aErrors['body'] = 'You must fill in your comment'; 
     92            } 
     93            if (isset($_POST['frmCaptcha'])) { 
     94                require_once SGL_CORE_DIR . '/Captcha.php'; 
     95                $captcha = new SGL_Captcha(); 
     96                if (!$captcha->validateCaptcha($input->captcha)) { 
     97                    $aErrors['captcha'] = 'You must enter the number in this field'; 
     98                } 
     99                $input->captcha = $captcha->generateCaptcha(); 
     100                $input->useCaptcha = true; 
    91101            } 
    92102        } 
  • branches/0.6-bugfix/modules/contactus/lang/english-iso-8859-15.php

    r2170 r2490  
    1010        'Comment' => 'Comment', 
    1111        'Contact Enquiry from' => 'Contact Enquiry from', 
    12         'Enter Captcha' => 'Please enter the number shown below in the relevant field', 
    1312        'aContactType' => array( 
    1413            'General enquiry' => 'General enquiry', 
     
    2423        'Your email is not correctly formatted' => 'Your email is not correctly formatted', 
    2524        'You must enter your email' => 'You must enter your email', 
    26         'You must enter the number in this field' => 'You must enter the number in this field', 
    2725    ); 
    2826?> 
  • branches/0.6-bugfix/modules/default/lang/english-iso-8859-15.php

    r2487 r2490  
    508508$defaultWords['templates'] = 'templates'; 
    509509$defaultWords['translations'] = 'translations'; 
     510$defaultWords['Enter Captcha'] = 'Please enter the number shown below in the relevant field'; 
     511$defaultWords['You must enter the number in this field'] = 'You must enter the number in this field'; 
    510512 
    511513/* --- PEAR::Pager --- */ 
  • branches/0.6-bugfix/modules/default/templates/comments.html

    r2464 r2490  
    7070            </dd>--> 
    7171 
     72            {if:useCaptcha} 
     73            <dt><label for="captcha"><span class="required">* </span>{translate(#Enter Captcha#)}</label></dt> 
     74            <dd> 
     75                <span class="error" flexy:if="error[captcha]">{translate(error[captcha])}</span> 
     76                <pre>{captcha}</pre> 
     77                <input type="text" id="captcha" name="frmCaptcha" size="30" /> 
     78            </dd> 
     79            {end:} 
     80 
    7281            <dt> </dt> 
    7382            <dd> 
  • branches/0.6-bugfix/modules/faq/classes/FaqMgr.php

    r2457 r2490  
    103103        if (SGL::moduleIsEnabled('comment') && !empty($this->conf['FaqMgr']['commentsEnabled'])) { 
    104104            $output->aComments = $this->da->getCommentsByEntityId('faq'); 
     105 
     106            //  with captcha? 
     107            if ($this->conf['FaqMgr']['useCaptcha']) { 
     108                require_once SGL_CORE_DIR . '/Captcha.php'; 
     109                $captcha = new SGL_Captcha(); 
     110                $output->captcha = $captcha->generateCaptcha(); 
     111                $output->useCaptcha = true; 
     112            } 
    105113        } 
    106114    } 
  • branches/0.6-bugfix/modules/faq/conf.ini

    r2452 r2490  
    22requiresAuth    = false 
    33commentsEnabled = false 
     4useCaptcha      = true 
    45 
    56[AdminFaqMgr] 
  • branches/0.6-bugfix/modules/publisher/classes/ArticleViewMgr.php

    r2472 r2490  
    152152            $output->aComments = $this->da->getCommentsByEntityId('articleview', 
    153153                $input->articleID); 
     154 
     155            //  with captcha? 
     156            if ($this->conf['ArticleViewMgr']['useCaptcha']) { 
     157                require_once SGL_CORE_DIR . '/Captcha.php'; 
     158                $captcha = new SGL_Captcha(); 
     159                $output->captcha = $captcha->generateCaptcha(); 
     160                $output->useCaptcha = true; 
     161            } 
    154162        } 
    155163    } 
  • branches/0.6-bugfix/modules/publisher/conf.ini

    r2459 r2490  
    22requiresAuth    = false 
    33commentsEnabled = false 
     4useCaptcha      = true 
    45 
    56[ArticleMgr]