(bug 4816) Allow captcha images to be loaded multiple times during the session, if...
authorBrion Vibber <brion@users.mediawiki.org>
Wed, 13 Feb 2008 06:44:23 +0000 (06:44 +0000)
committerBrion Vibber <brion@users.mediawiki.org>
Wed, 13 Feb 2008 06:44:23 +0000 (06:44 +0000)
Konqueror seems to reload the image sometimes, which was causing it to vanish from the page when scrolling, redrawing etc.

FancyCaptcha.class.php

index fa968202b3a4f4156924ae5cacfd70d410edade4..abdb2f8842bfa2f25a3b5b3c972d3d563197e59a 100644 (file)
@@ -158,10 +158,15 @@ class FancyCaptcha extends SimpleCaptcha {
 
                $info = $this->retrieveCaptcha();
                if( $info ) {
+                       /*
+                       // Be a little less restrictive for now; in at least some circumstances,
+                       // Konqueror tries to reload the image even if you haven't navigated
+                       // away from the page.
                        if( $info['viewed'] ) {
                                wfHttpError( 403, 'Access Forbidden', "Can't view captcha image a second time." );
                                return false;
                        }
+                       */
 
                        $info['viewed'] = wfTimestamp();
                        $this->storeCaptcha( $info );
@@ -173,6 +178,7 @@ class FancyCaptcha extends SimpleCaptcha {
                        if( file_exists( $file ) ) {
                                global $IP;
                                require_once "$IP/includes/StreamFile.php";
+                               header( "Cache-Control: private, s-maxage=0, max-age=3600" );
                                wfStreamFile( $file );
                                return true;
                        }