| version 1.4, 2013/10/04 14:16:47 |
version 1.5, 2013/10/04 14:39:30 |
|
|
| * 1.01, 2012-03-26 17:22 Igor |
* 1.01, 2012-03-26 17:22 Igor |
| * 1.02, 2012-05-11 10:51 Igor |
* 1.02, 2012-05-11 10:51 Igor |
| * 1.03, 2012-10-02 10:20 Igor |
* 1.03, 2012-10-02 10:20 Igor |
| |
* 1.04, 2013-02-27 09:56 Igor |
| |
* 1.05, 2013-08-05 16:43 Igor |
| * |
* |
| */ |
*/ |
| |
|
| Line 71 class RotateAntispam { |
|
| Line 73 class RotateAntispam { |
|
| 'mime' => null |
'mime' => null |
| ); |
); |
| |
|
| |
// konfiguracia vzhladu |
| |
protected $design = array( |
| |
// Left Button |
| |
'leftButtonColor' => '#000', |
| |
'leftButtonColorHover' => '#fc0', |
| |
'leftButtonBorderColor' => '#ccc', |
| |
'leftButtonImage' => '', |
| |
'leftButtonImageHover' => '', |
| |
// Right Button |
| |
'rightButtonColor' => '#000', |
| |
'rightButtonColorHover' => '#fc0', |
| |
'rightButtonBorderColor' => '#ccc', |
| |
'rightButtonImage' => '', |
| |
'rightButtonImageHover' => '', |
| |
); |
| |
|
| // ====[ Konstruktor ]===================================================== |
// ====[ Konstruktor ]===================================================== |
| |
|
| /** |
/** |
| Line 198 class RotateAntispam { |
|
| Line 216 class RotateAntispam { |
|
| echo '<script type="text/javascript">console.log("'.$init_log.'");</script>'; |
echo '<script type="text/javascript">console.log("'.$init_log.'");</script>'; |
| $this->log .= $init_log.'<br>'; |
$this->log .= $init_log.'<br>'; |
| } |
} |
| |
$msg = str_replace("\n", '', $msg); |
| |
$msg = str_replace("\r", '', $msg); |
| echo '<script type="text/javascript">console.log("'.addslashes($msg).'");</script>'; |
echo '<script type="text/javascript">console.log("'.addslashes($msg).'");</script>'; |
| } |
} |
| $this->log .= $msg.'<br>'; |
$this->log .= $msg.'<br>'; |
| Line 245 class RotateAntispam { |
|
| Line 265 class RotateAntispam { |
|
| return $this->texts[$key]; |
return $this->texts[$key]; |
| } |
} |
| |
|
| |
/** |
| |
* vrati dizajn jedneho elementu |
| |
* |
| |
* @param string $key - kluc elementu |
| |
* @return string - hodnota ziadaneho elementu |
| |
*/ |
| |
protected function getDesignElement($key) { |
| |
if (strlen($key) <= 0 |
| |
|| !isset($this->design[$key])) |
| |
{ |
| |
return false; |
| |
} |
| |
return $this->design[$key]; |
| |
} |
| |
|
| |
/** |
| |
* vrati informacie o obrazku |
| |
* |
| |
* @param string $image - subor obrazka |
| |
* @return array - pole s informacia o obrazku |
| |
*/ |
| |
protected function getImageInfo($image) { |
| |
if (strlen($image) <= 0) { |
| |
return false; |
| |
} |
| |
$img = getimagesize($image); |
| |
return array( |
| |
'width' => $img[0], |
| |
'height' => $img[1], |
| |
'type' => $img[2], |
| |
'mime' => $img['mime'] |
| |
); |
| |
} |
| |
|
| // ====[ Verejne metody ]================================================== |
// ====[ Verejne metody ]================================================== |
| |
|
| Line 277 class RotateAntispam { |
|
| Line 330 class RotateAntispam { |
|
| } |
} |
| $_SESSION['RotateAntispam']['image'] = $relative_path; |
$_SESSION['RotateAntispam']['image'] = $relative_path; |
| |
|
| $img = getimagesize($this->image); |
$this->imageInfo = $this->getImageInfo($this->image); |
| $this->imageInfo['width'] = $img[0]; |
|
| $this->imageInfo['height'] = $img[1]; |
|
| $this->imageInfo['type'] = $img[2]; |
|
| $this->imageInfo['mime'] = $img['mime']; |
|
| |
|
| $this->addLog('Obrazok "'.$image.'" bol nastaveny'); |
$this->addLog('Obrazok "'.$image.'" bol nastaveny'); |
| return true; |
return true; |
| Line 303 class RotateAntispam { |
|
| Line 352 class RotateAntispam { |
|
| .antispam-box-hide { display: none; } |
.antispam-box-hide { display: none; } |
| .antispam-box { |
.antispam-box { |
| width: '.($this->imageInfo['width'] + 200).'px; |
width: '.($this->imageInfo['width'] + 200).'px; |
| height: '.($this->imageInfo['height'] + 120).'px; |
height: '.($this->imageInfo['height'] + 130).'px; |
| background: #FFFFFF; |
background: #FFFFFF; |
| color: #000000; |
color: #000000; |
| text-align: center; |
text-align: center; |
| Line 331 class RotateAntispam { |
|
| Line 380 class RotateAntispam { |
|
| <div id="antispam-box" class="antispam-box-hide"> |
<div id="antispam-box" class="antispam-box-hide"> |
| <center> |
<center> |
| <span class="antispam-box-title">'.$this->getText('title').'</span> |
<span class="antispam-box-title">'.$this->getText('title').'</span> |
| <div id="rotimg"><img id="logo" src="'.$this->getUrlRotateAntispam().'?getImage" /></div> |
<div id="rotimg"> |
| |
<img id="rotateantispamimage" src="'.$this->getUrlRotateAntispam().'?getImage" /> |
| |
'; |
| |
$leftButtonImage = (strlen($this->getDesignElement('leftButtonImage')) > 0 |
| |
&& strlen($this->getDesignElement('leftButtonImageHover')) > 0); |
| |
if ($leftButtonImage) { |
| |
$html .= '<img id="rotateantispamimage_leftButton" src="'.$this->getDesignElement('leftButtonImage').'" />'; |
| |
$html .= '<img id="rotateantispamimage_leftButtonHover" src="'.$this->getDesignElement('leftButtonImageHover').'" />'; |
| |
$leftButtonImageInfo = $this->getImageInfo($this->getDesignElement('leftButtonImage')); |
| |
|
| |
} |
| |
$rightButtonImage = (strlen($this->getDesignElement('rightButtonImage')) > 0 |
| |
&& strlen($this->getDesignElement('rightButtonImageHover')) > 0); |
| |
if ($rightButtonImage) { |
| |
$html .= '<img id="rotateantispamimage_rightButton" src="'.$this->getDesignElement('rightButtonImage').'" />'; |
| |
$html .= '<img id="rotateantispamimage_rightButtonHover" src="'.$this->getDesignElement('rightButtonImageHover').'" />'; |
| |
$rightButtonImageInfo = $this->getImageInfo($this->getDesignElement('rightButtonImage')); |
| |
} |
| |
$submitType = (strlen($this->getText('submit')) <= 0) ? 'image' : 'submit'; |
| |
$cancelType = (strlen($this->getText('cancel')) <= 0) ? 'image' : 'button'; |
| |
$html .= ' |
| |
</div> |
| '.$this->getText('description').'<br> |
'.$this->getText('description').'<br> |
| <input type="submit" value="'.$this->getText('submit').'" id="rotate_antispam_submit_button"> |
<input type="'.$submitType.'" value="'.$this->getText('submit').'" id="rotate_antispam_submit_button"> |
| <input type="button" value="'.$this->getText('cancel').'" onclick="antispam_box_hide();"> |
<input type="'.$cancelType.'" value="'.$this->getText('cancel').'" id="rotate_antispam_cancel_button" onclick="antispam_box_hide(); return false;"> |
| </center> |
</center> |
| </div> |
</div> |
| <input type="hidden" name="'.$this->answer_name.'" id="ezin_antispam" value="'.$shift.'"> |
<input type="hidden" name="'.$this->answer_name.'" id="ezin_antispam" value="'.$shift.'"> |
| |
<input type="hidden" name="antispam_log" id="antispam_log" value=""> |
| <script type="text/javascript"> |
<script type="text/javascript"> |
| |
if (typeof RotateAntispam == "undefined") window.RotateAntispam = {}; |
| |
var _beforeBox = null; |
| |
RotateAntispam.beforeBox = function(fnc) { |
| |
_beforeBox = fnc; |
| |
} |
| var button_submit; |
var button_submit; |
| if (button_submit == null) { |
if (button_submit == null) { |
| console.error("Not exists submit button with name '.$this->submit_name.'"); |
console.error("Not exists submit button with name '.$this->submit_name.'"); |
| return false; |
return false; |
| } |
} |
| var IE; |
var IE; |
| |
var MSIE_ver; |
| function initRotateAntispam() { |
function initRotateAntispam() { |
| var button_submit = document.getElementsByName("'.$this->submit_name.'")[0]; |
var button_submit = document.getElementsByName("'.$this->submit_name.'")[0]; |
| |
var fnc = button_submit.getAttribute("onclick"); |
| //var IE = document.all ? true : false; |
//var IE = document.all ? true : false; |
| var IE = (navigator.appName == "Microsoft Internet Explorer"); |
IE = (navigator.appName == "Microsoft Internet Explorer"); |
| if(IE) { // fixnute pre IE8 a IE9 |
//var version = navigator.appVersion.substr(0,3); |
| button_submit.setAttribute("onclick", function(){ antispam_box(); return false; }); // for IE |
var MSIE_pos = navigator.appVersion.search("MSIE"); |
| |
MSIE_ver = parseFloat(navigator.appVersion.substr(MSIE_pos+4, 5)); |
| |
if(IE && MSIE_ver < 10) { // fixnute pre IE7 a menej; 2013-07-16 zmenene na IE9 a starsie |
| |
var ret = button_submit.setAttribute("onclick", function(){ antispam_box(); return false; }); |
| } else { // if onclick is a function, use the IE7 method and call onclick() in the anonymous function |
} else { // if onclick is a function, use the IE7 method and call onclick() in the anonymous function |
| button_submit.setAttribute("onclick","antispam_box(); return false;"); // for FF,Opera,Chrome |
var ret = button_submit.setAttribute("onclick","antispam_box(); return false;"); // for FF,Opera,Chrome |
| } |
} |
| |
//console.info(button_submit.getAttribute("onclick").toString().toString()); |
| button_submit.setAttribute("name","submit"); |
button_submit.setAttribute("name","submit"); |
| // hide old input |
// hide old input |
| var old_inputs = document.getElementsByName("ezin_antispam"); |
var old_inputs = document.getElementsByName("ezin_antispam"); |
| Line 430 class RotateAntispam { |
|
| Line 512 class RotateAntispam { |
|
| arrayPageScroll = new Array(xScroll,yScroll); |
arrayPageScroll = new Array(xScroll,yScroll); |
| return arrayPageScroll; |
return arrayPageScroll; |
| }; |
}; |
| function antispam_box(){ |
function antispam_box(){ |
| var pageSize = getPageSize(); |
if (!triggerBeforeBox()) { |
| var pageScroll = getPageScroll(); |
return false; |
| var myWidth = pageSize[0]; |
} |
| |
var pageSize = getPageSize(); |
| |
var pageScroll = getPageScroll(); |
| |
var myWidth = pageSize[0]; |
| var myHeight = pageSize[1]; |
var myHeight = pageSize[1]; |
| var paddingTop = pageScroll[1]; |
var paddingTop = pageScroll[1]; |
| |
|
| var windowHeight = window.innerHeight ? window.innerHeight : document.documentElement.clientHeight ? document.documentElement.clientHeight : document.body.clientHeight; |
var windowHeight = window.innerHeight ? window.innerHeight : document.documentElement.clientHeight ? document.documentElement.clientHeight : document.body.clientHeight; |
| var screen = document.getElementById("screen"); |
var screen = document.getElementById("screen"); |
| screen.style.display = "block"; |
screen.style.display = "block"; |
| Line 453 class RotateAntispam { |
|
| Line 537 class RotateAntispam { |
|
| var antispam_box = document.getElementById("antispam-box"); |
var antispam_box = document.getElementById("antispam-box"); |
| antispam_box.className = "antispam-box-hide"; |
antispam_box.className = "antispam-box-hide"; |
| } |
} |
| var src = document.getElementById("logo").src; |
function antispam_log(val) { |
| |
console.log(val); |
| |
document.getElementById("antispam_log").value += val+"\n"; |
| |
} |
| |
function triggerBeforeBox() { |
| |
if (_beforeBox != null) { |
| |
return _beforeBox(); |
| |
} |
| |
return true; |
| |
} |
| |
var src = document.getElementById("rotateantispamimage").src; |
| |
'; |
| |
if ($leftButtonImage) { |
| |
$html .= 'var src_leftButton = document.getElementById("rotateantispamimage_leftButton").src;'; |
| |
$html .= 'var src_leftButtonHover = document.getElementById("rotateantispamimage_leftButtonHover").src;'; |
| |
} |
| |
if ($rightButtonImage) { |
| |
$html .= 'var src_rightButton = document.getElementById("rotateantispamimage_rightButton").src;'; |
| |
$html .= 'var src_rightButtonHover = document.getElementById("rotateantispamimage_rightButtonHover").src;'; |
| |
} |
| |
$html .= ' |
| var angle = '.$shift.'; |
var angle = '.$shift.'; |
| document.getElementById("rotimg").innerHTML = ""; |
document.getElementById("rotimg").innerHTML = ""; |
| var R = Raphael("rotimg", '.($this->imageInfo['width'] + 100).', '.($this->imageInfo['height'] + 50).'); |
var R = Raphael("rotimg", '.($this->imageInfo['width'] + 100).', '.($this->imageInfo['height'] + 50).'); |
| Line 461 class RotateAntispam { |
|
| Line 565 class RotateAntispam { |
|
| var img = R.image(src, 50, 25, '.$this->imageInfo['width'].', '.$this->imageInfo['height'].'); |
var img = R.image(src, 50, 25, '.$this->imageInfo['width'].', '.$this->imageInfo['height'].'); |
| var butt1 = R.set(), |
var butt1 = R.set(), |
| butt2 = R.set(); |
butt2 = R.set(); |
| butt1.push(R.circle(24.833, 26.917, 26.667).attr({stroke: "#ccc", fill: "#fff", "fill-opacity": .4, "stroke-width": 2}), |
'; |
| R.path("M12.582,9.551C3.251,16.237,0.921,29.021,7.08,38.564l-2.36,1.689l4.893,2.262l4.893,2.262l-0.568-5.36l-0.567-5.359l-2.365,1.694c-4.657-7.375-2.83-17.185,4.352-22.33c7.451-5.338,17.817-3.625,23.156,3.824c5.337,7.449,3.625,17.813-3.821,23.152l2.857,3.988c9.617-6.893,11.827-20.277,4.935-29.896C35.591,4.87,22.204,2.658,12.582,9.551z").attr({stroke: "none", fill: "#000"}), |
if ($leftButtonImage) { |
| R.circle(24.833, 26.917, 26.667).attr({fill: "#fff", opacity: 0})); |
$html .= ' |
| butt2.push(R.circle(24.833, 26.917, 26.667).attr({stroke: "#ccc", fill: "#fff", "fill-opacity": .4, "stroke-width": 2}), |
butt1.push(R.image(src_leftButton, 0, 0, '.$leftButtonImageInfo['width'].', '.$leftButtonImageInfo['height'].')); |
| R.path("M37.566,9.551c9.331,6.686,11.661,19.471,5.502,29.014l2.36,1.689l-4.893,2.262l-4.893,2.262l0.568-5.36l0.567-5.359l2.365,1.694c4.657-7.375,2.83-17.185-4.352-22.33c-7.451-5.338-17.817-3.625-23.156,3.824C6.3,24.695,8.012,35.06,15.458,40.398l-2.857,3.988C2.983,37.494,0.773,24.109,7.666,14.49C14.558,4.87,27.944,2.658,37.566,9.551z").attr({stroke: "none", fill: "#000"}), |
butt1.translate(10, 20); |
| |
butt1.click(function () { //antispam_log("klik DOLAVA"); |
| |
angle -= 10; //antispam_log("angle "+angle.toString()); |
| |
img.stop().animate({transform: "r" + angle}, 1000, "<>"); |
| |
document.getElementById("ezin_antispam").value = angle; //antispam_log("-------------------------"); |
| |
}).mouseover(function () { |
| |
if(IE && MSIE_ver < 9) { |
| |
butt1[0].node.href.baseVal = src_leftButtonHover; |
| |
} else { |
| |
butt1.animate({opacity: 0.5}, 200, function() { |
| |
butt1[0].node.href.baseVal = src_leftButtonHover; |
| |
butt1.animate({opacity: 1}, 200); |
| |
}); |
| |
} |
| |
}).mouseout(function () { |
| |
if(IE && MSIE_ver < 9) { |
| |
butt1[0].node.href.baseVal = src_leftButton; |
| |
} else { |
| |
butt1.animate({opacity: 0.5}, 200, function() { |
| |
butt1[0].node.href.baseVal = src_leftButton; |
| |
butt1.animate({opacity: 1}, 200); |
| |
}); |
| |
} |
| |
}); |
| |
'; |
| |
} else { |
| |
$html .= ' |
| |
butt1.push(R.circle(24.833, 26.917, 26.667).attr({stroke: "'.$this->getDesignElement('leftButtonBorderColor').'", fill: "#fff", "fill-opacity": .4, "stroke-width": 2}), |
| |
R.path("M12.582,9.551C3.251,16.237,0.921,29.021,7.08,38.564l-2.36,1.689l4.893,2.262l4.893,2.262l-0.568-5.36l-0.567-5.359l-2.365,1.694c-4.657-7.375-2.83-17.185,4.352-22.33c7.451-5.338,17.817-3.625,23.156,3.824c5.337,7.449,3.625,17.813-3.821,23.152l2.857,3.988c9.617-6.893,11.827-20.277,4.935-29.896C35.591,4.87,22.204,2.658,12.582,9.551z").attr({stroke: "none", fill: "'.$this->getDesignElement('leftButtonColor').'"}), |
| R.circle(24.833, 26.917, 26.667).attr({fill: "#fff", opacity: 0})); |
R.circle(24.833, 26.917, 26.667).attr({fill: "#fff", opacity: 0})); |
| butt1.translate(10, 20); |
butt1.translate(10, 20); |
| butt2.translate('.($this->imageInfo['width'] + 40).', 20); |
|
| butt1[2].click(function () { |
butt1[2].click(function () { |
| angle -= 10; |
angle -= 10; |
| img.stop().animate({transform: "r" + angle}, 1000, "<>"); |
img.stop().animate({transform: "r" + angle}, 1000, "<>"); |
| document.getElementById("ezin_antispam").value = angle; |
document.getElementById("ezin_antispam").value = angle; |
| }).mouseover(function () { |
}).mouseover(function () { |
| butt1[1].animate({fill: "#fc0"}, 300); |
butt1[1].animate({fill: "'.$this->getDesignElement('leftButtonColorHover').'"}, 300); |
| |
}).mouseout(function () { |
| |
butt1[1].stop().attr({fill: "'.$this->getDesignElement('leftButtonColor').'"}); |
| |
}); |
| |
'; |
| |
} |
| |
if ($rightButtonImage) { |
| |
$html .= ' |
| |
butt2.push(R.image(src_rightButton, 0, 0, '.$rightButtonImageInfo['width'].', '.$rightButtonImageInfo['height'].')); |
| |
butt2.translate('.($this->imageInfo['width'] + 40).', 20); |
| |
butt2.click(function () { //antispam_log("klik DOPRAVA"); |
| |
angle += 10; //antispam_log("angle "+angle.toString()); |
| |
img.stop().animate({transform: "r" + angle}, 1000, "<>"); |
| |
document.getElementById("ezin_antispam").value = angle; //antispam_log("-------------------------"); |
| |
}).mouseover(function () { |
| |
if(IE && MSIE_ver < 9) { |
| |
butt2[0].node.href.baseVal = src_rightButtonHover; |
| |
} else { |
| |
butt2.animate({opacity: 0.5}, 200, function() { |
| |
butt2[0].node.href.baseVal = src_rightButtonHover; |
| |
butt2.animate({opacity: 1}, 200); |
| |
}); |
| |
} |
| }).mouseout(function () { |
}).mouseout(function () { |
| butt1[1].stop().attr({fill: "#000"}); |
if(IE && MSIE_ver < 9) { |
| |
butt2[0].node.href.baseVal = src_rightButton; |
| |
} else { |
| |
butt2.animate({opacity: 0.5}, 200, function() { |
| |
butt2[0].node.href.baseVal = src_rightButton; |
| |
butt2.animate({opacity: 1}, 200); |
| |
}); |
| |
} |
| }); |
}); |
| |
'; |
| |
} else { |
| |
$html .= ' |
| |
butt2.push(R.circle(24.833, 26.917, 26.667).attr({stroke: "'.$this->getDesignElement('rightButtonBorderColor').'", fill: "#fff", "fill-opacity": .4, "stroke-width": 2}), |
| |
R.path("M37.566,9.551c9.331,6.686,11.661,19.471,5.502,29.014l2.36,1.689l-4.893,2.262l-4.893,2.262l0.568-5.36l0.567-5.359l2.365,1.694c4.657-7.375,2.83-17.185-4.352-22.33c-7.451-5.338-17.817-3.625-23.156,3.824C6.3,24.695,8.012,35.06,15.458,40.398l-2.857,3.988C2.983,37.494,0.773,24.109,7.666,14.49C14.558,4.87,27.944,2.658,37.566,9.551z").attr({stroke: "none", fill: "'.$this->getDesignElement('rightButtonColor').'"}), |
| |
R.circle(24.833, 26.917, 26.667).attr({fill: "#fff", opacity: 0})); |
| |
butt2.translate('.($this->imageInfo['width'] + 40).', 20); |
| butt2[2].click(function () { |
butt2[2].click(function () { |
| angle += 10; |
angle += 10; |
| img.animate({transform: "r" + angle}, 1000, "<>"); |
img.animate({transform: "r" + angle}, 1000, "<>"); |
| document.getElementById("ezin_antispam").value = angle; |
document.getElementById("ezin_antispam").value = angle; |
| }).mouseover(function () { |
}).mouseover(function () { |
| butt2[1].animate({fill: "#fc0"}, 300); |
butt2[1].animate({fill: "'.$this->getDesignElement('rightButtonColorHover').'"}, 300); |
| }).mouseout(function () { |
}).mouseout(function () { |
| butt2[1].stop().attr({fill: "#000"}); |
butt2[1].stop().attr({fill: "'.$this->getDesignElement('rightButtonColor').'"}); |
| }); |
}); |
| |
'; |
| |
} |
| |
$html .= ' |
| setTimeout(function () {R.safari();}); |
setTimeout(function () {R.safari();}); |
| |
|
| |
function updateAngle() { |
| |
img.stop().animate({transform: "r" + angle}, 1, "<>"); |
| |
//console.log("updateAngle"); |
| |
setTimeout("updateAngle();", 5000); |
| |
} |
| |
updateAngle(); |
| |
|
| </script> |
</script> |
| '; |
'; |
| return $html; |
return $html; |
| Line 503 class RotateAntispam { |
|
| Line 681 class RotateAntispam { |
|
| public function setText($key, $value) { |
public function setText($key, $value) { |
| $this->texts[$key] = $value; |
$this->texts[$key] = $value; |
| } |
} |
| |
|
| |
/** |
| |
* nastavy dizajn |
| |
* |
| |
* @param string $arr - asociativne pole prvkov |
| |
* @return void |
| |
*/ |
| |
public function setDesign($arr) { |
| |
if (!is_array($arr)) { |
| |
return false; |
| |
} |
| |
foreach($arr as $key => $val) { |
| |
$this->setDesignElement($key, $val); |
| |
} |
| |
} |
| |
|
| |
/** |
| |
* nastavy dizajn jedneho elementu |
| |
* |
| |
* @param string $key - kluc elementu |
| |
* @param string $val - hodnota elementu |
| |
* @return void |
| |
*/ |
| |
public function setDesignElement($key, $val) { |
| |
if (strlen($key) <= 0) { |
| |
return false; |
| |
} |
| |
$this->design[$key] = $val; |
| |
} |
| |
|
| /** |
/** |
| * skontroluje ovdpoved |
* skontroluje ovdpoved |
| Line 514 class RotateAntispam { |
|
| Line 721 class RotateAntispam { |
|
| $this->addLog('Spusta sa correctAnswer'); |
$this->addLog('Spusta sa correctAnswer'); |
| if (is_null($this->correctAnswer_cache)) { |
if (is_null($this->correctAnswer_cache)) { |
| $this->addLog('Prvy krat spracuvavam'); |
$this->addLog('Prvy krat spracuvavam'); |
| $answer_user = (is_null($answer_user)) ? $_POST[$this->answer_name] : $answer_user; |
$answer_user = (is_null($answer_user)) ? @$_POST[$this->answer_name] : $answer_user; |
| $answer = $_SESSION['RotateAntispam']['answer']; |
$answer = @$_SESSION['RotateAntispam']['answer']; |
| $this->addLog('Odpoved pouzivatela je "'.$answer_user.'"'); |
$this->addLog('Odpoved pouzivatela je "'.$answer_user.'"'); |
| if (!isset($answer) |
if (!isset($answer) |
| || strlen($answer) <= 0) |
|| strlen($answer) <= 0) |
| Line 529 class RotateAntispam { |
|
| Line 736 class RotateAntispam { |
|
| $_SESSION['RotateAntispam'] = null; |
$_SESSION['RotateAntispam'] = null; |
| unset($_SESSION['RotateAntispam']); |
unset($_SESSION['RotateAntispam']); |
| } |
} |
| $this->addLog('Vraciam odpoved '.(($this->correctAnswer_cache) ? 'TRUE' : 'FALSE')); |
$this->addLog('Vraciam odpoved '.(($this->correctAnswer_cache) ? 'TRUE' : 'FALSE')); |
| |
$this->addLog('<hr>JavaScript LOG: <br>'.nl2br(@$_REQUEST['antispam_log'])); |
| return $this->correctAnswer_cache; |
return $this->correctAnswer_cache; |
| } |
} |
| |
|
| Line 538 class RotateAntispam { |
|
| Line 746 class RotateAntispam { |
|
| |
|
| } // class RotateAntispam |
} // class RotateAntispam |
| |
|
| |
error_reporting(E_ALL && ~E_NOTICE); |
| |
|
| // ak nie je nastartovana $_SESSION |
// ak nie je nastartovana $_SESSION |
| if (!isset($_SESSION) |
if (!isset($_SESSION) |
| || strlen(session_id()) == 0) |
|| strlen(session_id()) == 0) |
| Line 545 if (!isset($_SESSION) |
|
| Line 755 if (!isset($_SESSION) |
|
| session_start(); |
session_start(); |
| } |
} |
| |
|
| |
function loadFromSession($name) { |
| |
$ret = null; |
| |
$maxSleep = 10; |
| |
$sleep = 1; |
| |
while (strlen($ret) <= 0 && $maxSleep > 0) { |
| |
$ret = @$_SESSION['RotateAntispam'][$name]; |
| |
sleep($sleep); // prve nacitanie = 0 |
| |
$sleep = 1; |
| |
$maxSleep--; |
| |
} |
| |
return $ret; |
| |
} |
| |
|
| // Spracovanie vyziadaneho obrazku |
// Spracovanie vyziadaneho obrazku |
| if (isset($_REQUEST['getImage'])) { |
if (isset($_REQUEST['getImage'])) { |
| $filename = $_SESSION['RotateAntispam']['image']; |
$filename = loadFromSession('image'); |
| if (!file_exists($filename)) { |
if (strlen($filename) <= 0 |
| |
|| !file_exists($filename)) |
| |
{ |
| die('Neexistuje obrazok "'.$filename.'"'); |
die('Neexistuje obrazok "'.$filename.'"'); |
| } |
} |
| $shift = $_SESSION['RotateAntispam']['shift']; |
$shift = loadFromSession('shift'); |
| do { |
do { |
| $degrees = (rand(-5,5) * 10) + $shift; |
$degrees = (rand(-5,5) * 10) + $shift; |
| } while($degrees == $shift || $_SESSION['RotateAntispam']['answer'] == $degrees); |
} while($degrees == $shift || $_SESSION['RotateAntispam']['answer'] == $degrees); |