Skip to content
This repository has been archived by the owner on Apr 1, 2019. It is now read-only.

Changed from Request::instance() to Request::current() #26

Open
wants to merge 12 commits into
base: master
Choose a base branch
from
12 changes: 6 additions & 6 deletions classes/captcha.php → classes/Captcha.php
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ public function __construct($group = NULL)
public function update_response_session()
{
// Store the correct Captcha response in a session
Session::instance()->set('captcha_response', sha1(utf8::strtoupper($this->response)));
Session::instance()->set('captcha_response', sha1(UTF8::strtoupper($this->response)));
}

/**
Expand All @@ -178,7 +178,7 @@ public static function valid($response)
return TRUE;

// Challenge result
$result = (bool) (sha1(utf8::strtoupper($response)) === Session::instance()->get('captcha_response'));
$result = (bool) (sha1(UTF8::strtoupper($response)) === Session::instance()->get('captcha_response'));

// Increment response counter
if ($counted !== TRUE)
Expand Down Expand Up @@ -434,10 +434,10 @@ public function image_render($html)
return '<img src="'.url::site('captcha/'.Captcha::$config['group']).'" width="'.Captcha::$config['width'].'" height="'.Captcha::$config['height'].'" alt="Captcha" class="captcha" />';

// Send the correct HTTP header
Request::instance()->headers['Content-Type'] = 'image/'.$this->image_type;
Request::instance()->headers['Cache-Control'] = 'no-store, no-cache, must-revalidate, post-check=0, pre-check=0';
Request::instance()->headers['Pragma'] = 'no-cache';
Request::instance()->headers['Connection'] = 'close';
Request::current()->headers('Content-Type', 'image/'.$this->image_type)
->headers('Cache-Control', 'no-store, no-cache, must-revalidate, post-check=0, pre-check=0')
->headers('Pragma', 'no-cache')
->headers('Connection', 'close');

// Pick the correct output function
$function = 'image'.$this->image_type;
Expand Down
2 changes: 1 addition & 1 deletion classes/captcha/alpha.php → classes/captcha/Alpha.php
Original file line number Diff line number Diff line change
Expand Up @@ -92,4 +92,4 @@ public function render($html = TRUE)
return $this->image_render($html);
}

} // End Captcha Alpha Driver Class
} // End Captcha Alpha Driver Class
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion classes/captcha/math.php → classes/captcha/Math.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,4 +61,4 @@ public function render($html = TRUE)
return $this->math_exercise;
}

} // End Captcha Math Driver Class
} // End Captcha Math Driver Class
2 changes: 1 addition & 1 deletion classes/captcha/riddle.php → classes/captcha/Riddle.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,4 +47,4 @@ public function render($html = TRUE)
return $this->riddle;
}

} // End Captcha Riddle Driver Class
} // End Captcha Riddle Driver Class
File renamed without changes.
2 changes: 1 addition & 1 deletion init.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@
// Catch-all route for Captcha classes to run
Route::set('captcha', 'captcha(/<group>)')
->defaults(array(
'controller' => 'captcha',
'controller' => 'Captcha',
'action' => 'index',
'group' => NULL));