Added reCAPTCHA (still needs some testing), updated links (finally), fixed one more invalid token error, fix very minor "exploit"
git-svn-id: http://kusabax.cultnet.net/svn/repo/stable@306 73d99b7e-4f53-4972-b7b7-2ecd3c4d89ee
This commit is contained in:
1 parent
9d84e86b7f
commit
0248cd497a
15 files changed
+336
-15
No files matched your search
@@ -686,6 +686,11 @@ class Board {
|
||||
$oekposts = $tc_db->GetAll("SELECT `id` FROM `" . KU_DBPREFIX."posts` WHERE `boardid` = " . $this->board['id']." AND (`id` = ".$replythread." OR `parentid` = ".$replythread.") AND `file` != '' AND `file` != 'removed' AND `file_type` IN ('jpg', 'gif', 'png') AND `IS_DELETED` = 0 ORDER BY `parentid` ASC, `timestamp` ASC");
|
||||
$this->dwoo_data->assign('oekposts', $oekposts);
|
||||
}
|
||||
if ($this->board['enablecaptcha'] == 1) {
|
||||
require_once(KU_ROOTDIR.'recaptchalib.php');
|
||||
$publickey = "6LdVg8YSAAAAAOhqx0eFT1Pi49fOavnYgy7e-lTO";
|
||||
$this->dwoo_data->assign('recaptcha', recaptcha_get_html($publickey));
|
||||
}
|
||||
if(($this->board['type'] == 1 && $replythread == 0) || $this->board['type'] != 1) {
|
||||
$postbox .= $this->dwoo->get(KU_TEMPLATEDIR . '/' . $this->board['text_readable'] . '_post_box.tpl', $this->dwoo_data);
|
||||
}
|
||||
|
||||
@@ -2083,7 +2083,9 @@ class Manage {
|
||||
function editfiletypes() {
|
||||
global $tc_db, $tpl_page;
|
||||
$this->AdministratorsOnly();
|
||||
|
||||
if ($_POST['filetype'] == "htaccess") {
|
||||
exitWithErrorPage(_gettext('Invalid filetype.'));
|
||||
}
|
||||
$tpl_page .= '<h2>'. _gettext('Edit filetypes') . '</h2><br />';
|
||||
if (isset($_GET['do'])) {
|
||||
if ($_GET['do'] == 'addfiletype') {
|
||||
@@ -3049,7 +3051,7 @@ class Manage {
|
||||
<br /><hr />
|
||||
|
||||
<form action="manage_page.php?action=delposts" method="post">
|
||||
<input type="hidden" name="token" value="' . $_SESSION['token'] . '" />
|
||||
<input type="hidden" name="token" value="' . $_SESSION['token'] . '" />
|
||||
<label for="boarddir">'. _gettext('Board') .':</label>' .
|
||||
$this->MakeBoardListDropdown('boarddir', $this->BoardList($_SESSION['manageusername'])) .
|
||||
'<br />
|
||||
|
||||
@@ -128,10 +128,27 @@ class Posting {
|
||||
|
||||
/* If the board has captcha's enabled... */
|
||||
if ($board_class->board['enablecaptcha'] == 1) {
|
||||
/* Check if they entered the correct code. If not... */
|
||||
if ($_SESSION['security_code'] != strtolower($_POST['captcha']) || empty($_SESSION['security_code'])) {
|
||||
/* Kill the script, stopping the posting process */
|
||||
exitWithErrorPage(_gettext('Incorrect captcha entered.'));
|
||||
if ($board_class->board['type'] == 1 && $_POST['replythread']) {
|
||||
/* Check if they entered the correct code. If not... */
|
||||
if ($_SESSION['security_code'] != strtolower($_POST['captcha']) || empty($_SESSION['security_code'])) {
|
||||
/* Kill the script, stopping the posting process */
|
||||
exitWithErrorPage(_gettext('Incorrect captcha entered.'));
|
||||
}
|
||||
}
|
||||
else {
|
||||
require_once(KU_ROOTDIR.'recaptchalib.php');
|
||||
$privatekey = "6LdVg8YSAAAAALayugP2r148EEQAogHPfQOSYow-";
|
||||
|
||||
// was there a reCAPTCHA response?
|
||||
$resp = recaptcha_check_answer ($privatekey,
|
||||
$_SERVER["REMOTE_ADDR"],
|
||||
$_POST["recaptcha_challenge_field"],
|
||||
$_POST["recaptcha_response_field"]
|
||||
);
|
||||
if (!$resp->is_valid) {
|
||||
// Show error and give user opportunity to try again.
|
||||
exitWithErrorPage(_gettext('Incorrect captcha entered.'));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user