Fixed svn:eol-style settings

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/cms/trunk@40456 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Sam Minnee 2007-08-18 02:33:28 +00:00
parent 63cbd15456
commit 9b43207884
3 changed files with 115 additions and 115 deletions

View File

@ -1,67 +1,67 @@
<?php
/**
* Tools for adding an optional protection question to a form.
* Remember to add MathSpamProtection::enabled(true); to _config.php for this question to be added to the comments form.
*/
class MathSpamProtection {
private static $mathProtection = false;
static function isEnabled() {
return (self::$mathProtection != null) ? true : false;
}
static function setEnabled($math = true) {
MathSpamProtection::$mathProtection = $math;
}
/**
* Creates the question from random variables, which are also saved to the session.
*/
static function getMathQuestion(){
if(!Session::get("mathQuestionV1")&&!Session::get("mathQuestionV2")){
$v1 = rand(1,9);
$v2 = rand(1,9);
Session::set("mathQuestionV1",$v1);
Session::set("mathQuestionV2",$v2);
}
else{
$v1 = Session::get("mathQuestionV1");
$v2 = Session::get("mathQuestionV2");
}
return "What is ".MathSpamProtection::digitToWord($v1)." plus ".MathSpamProtection::digitToWord($v2)."?";
}
/**
* Checks the given answer if it matches the addition of the saved session variables. Users can answer using words or digits.
*/
static function correctAnswer($answer){
$v1 = Session::get("mathQuestionV1");
$v2 = Session::get("mathQuestionV2");
Session::clear('mathQuestionV1');
Session::clear('mathQuestionV2');
if(MathSpamProtection::digitToWord($v1 + $v2) == $answer || ($v1 + $v2) == $answer){
return true;
}
return false;
}
/**
* Helper method for converting digits to their equivelant english words
*/
static function digitToWord($num){
$numbers = array("zero","one","two","three","four","five","six","seven","eight","nine",
"ten","eleven","twelve","thirteen","fourteen","fifteen","sixteen","seventeen","eighteen");
if($num < 0){
return "minus ".($numbers[-1*$num]);
}
//TODO: add checking or return null for bad value??
return $numbers[$num];
}
}
?>
<?php
/**
* Tools for adding an optional protection question to a form.
* Remember to add MathSpamProtection::enabled(true); to _config.php for this question to be added to the comments form.
*/
class MathSpamProtection {
private static $mathProtection = false;
static function isEnabled() {
return (self::$mathProtection != null) ? true : false;
}
static function setEnabled($math = true) {
MathSpamProtection::$mathProtection = $math;
}
/**
* Creates the question from random variables, which are also saved to the session.
*/
static function getMathQuestion(){
if(!Session::get("mathQuestionV1")&&!Session::get("mathQuestionV2")){
$v1 = rand(1,9);
$v2 = rand(1,9);
Session::set("mathQuestionV1",$v1);
Session::set("mathQuestionV2",$v2);
}
else{
$v1 = Session::get("mathQuestionV1");
$v2 = Session::get("mathQuestionV2");
}
return "What is ".MathSpamProtection::digitToWord($v1)." plus ".MathSpamProtection::digitToWord($v2)."?";
}
/**
* Checks the given answer if it matches the addition of the saved session variables. Users can answer using words or digits.
*/
static function correctAnswer($answer){
$v1 = Session::get("mathQuestionV1");
$v2 = Session::get("mathQuestionV2");
Session::clear('mathQuestionV1');
Session::clear('mathQuestionV2');
if(MathSpamProtection::digitToWord($v1 + $v2) == $answer || ($v1 + $v2) == $answer){
return true;
}
return false;
}
/**
* Helper method for converting digits to their equivelant english words
*/
static function digitToWord($num){
$numbers = array("zero","one","two","three","four","five","six","seven","eight","nine",
"ten","eleven","twelve","thirteen","fourteen","fifteen","sixteen","seventeen","eighteen");
if($num < 0){
return "minus ".($numbers[-1*$num]);
}
//TODO: add checking or return null for bad value??
return $numbers[$num];
}
}
?>

View File

@ -1,52 +1,52 @@
div.availableWidgetsHolder,
div.usedWidgetsHolder {
width: 49%;
}
div.availableWidgetsHolder {
float: left;
}
div.usedWidgetsHolder {
float: right;
}
div.usedWidgets {
min-height: 100px;
}
div.usedWidgets div.Widget,
div.availableWidgets div.Widget {
width: 90%;
border: 1px solid #ddd;
border-top: none;
margin-bottom: 5px;
}
div.widgetDescription p,
div.widgetFields {
margin-left: 8px;
}
p.deleteWidget {
div.availableWidgetsHolder,
div.usedWidgetsHolder {
width: 49%;
}
div.availableWidgetsHolder {
float: left;
}
div.usedWidgetsHolder {
float: right;
}
div.usedWidgets {
min-height: 100px;
}
div.usedWidgets div.Widget,
div.availableWidgets div.Widget {
width: 90%;
border: 1px solid #ddd;
border-top: none;
margin-bottom: 5px;
}
div.widgetDescription p,
div.widgetFields {
margin-left: 8px;
}
p.deleteWidget {
margin: 0;
height: 2.2em;
line-height: 2.2em;
font-size: 1.2em;
}
font-size: 1.2em;
}
span.widgetDelete {
padding-left: 20px;
padding-left: 20px;
margin-right: 8px;
float: right;
float: right;
background: url(../images/delete.gif) no-repeat left center;
cursor: pointer;
}
div.usedWidgets div.Widget h3,
div.availableWidgets div.Widget h3 {
font-size: 1.3em;
height: 1.5em;
color: #fff;
line-height: 1.5em;
text-indent: 5px;
background: #7ab7ec url(../images/widget-title-bg.gif);
margin: 0;
}
cursor: pointer;
}
div.usedWidgets div.Widget h3,
div.availableWidgets div.Widget h3 {
font-size: 1.3em;
height: 1.5em;
color: #fff;
line-height: 1.5em;
text-indent: 5px;
background: #7ab7ec url(../images/widget-title-bg.gif);
margin: 0;
}

View File

@ -1,3 +1,3 @@
You have asked to view the content of our site on $ArchiveDate.Date
You have asked to view the content of our site on $ArchiveDate.Date
You can access the archived site at this link: $ArchiveURL