Cleanup recaptchalib and the signup page (signup needs more work) and remove the xmpp profile remove goto which causes some problems with tools.

This commit is contained in:
Mark Crane 2012-06-21 02:18:31 +00:00
parent 21a4b0ca20
commit a36b818b7f
3 changed files with 8 additions and 22 deletions

View File

@ -88,7 +88,6 @@ if ($fp) {
include "update_complete.php"; include "update_complete.php";
end:
//show the footer //show the footer
require_once "includes/footer.php"; require_once "includes/footer.php";

View File

@ -86,7 +86,8 @@ if ($action == "update") {
if ((!isset($_REQUEST['submit'])) || ($_REQUEST['submit'] != 'Save')) { if ((!isset($_REQUEST['submit'])) || ($_REQUEST['submit'] != 'Save')) {
// If we arent saving a Profile Display the form. // If we arent saving a Profile Display the form.
include "profile_edit.php"; include "profile_edit.php";
goto end; require_once "includes/footer.php";
exit;
} }
foreach ($_REQUEST as $field => $data){ foreach ($_REQUEST as $field => $data){
@ -103,7 +104,8 @@ if (strlen($error) > 0) {
include "errors.php"; include "errors.php";
$profile = $request; $profile = $request;
include "profile_edit.php"; include "profile_edit.php";
goto end; require_once "includes/footer.php";
exit;
} }
// Save New Entry // Save New Entry
@ -162,7 +164,6 @@ if ($action == "add" && permission_exists('xmpp_add')) {
$sql .= ") "; $sql .= ") ";
$db->exec(check_sql($sql)); $db->exec(check_sql($sql));
goto writeout;
} }
elseif ($action == "update" && permission_exists('xmpp_edit')) { elseif ($action == "update" && permission_exists('xmpp_edit')) {
$sql = ""; $sql = "";
@ -194,19 +195,14 @@ elseif ($action == "update" && permission_exists('xmpp_edit')) {
$sql .= "where xmpp_profile_uuid = '" . $request['id'] . "' "; $sql .= "where xmpp_profile_uuid = '" . $request['id'] . "' ";
$db->exec(check_sql($sql)); $db->exec(check_sql($sql));
$xmpp_profile_uuid = $request['id']; $xmpp_profile_uuid = $request['id'];
goto writeout;
} }
writeout:
//prepare the xmpp files to be written. delete all jingle files that are prefixed with v_ and have a file extension of .xml //prepare the xmpp files to be written. delete all jingle files that are prefixed with v_ and have a file extension of .xml
$jingle_list = glob($_SESSION['switch']['conf']['dir'] . "/jingle_profiles/*v_*.xml"); $jingle_list = glob($_SESSION['switch']['conf']['dir'] . "/jingle_profiles/*v_*.xml");
foreach($jingle_list as $name => $value) { foreach($jingle_list as $name => $value) {
unlink($value); unlink($value);
} }
if ($request['enabled'] == "true") { if ($request['enabled'] == "true") {
//prepare the xml //prepare the xml
include "client_template.php"; include "client_template.php";
@ -238,7 +234,6 @@ if ($fp) {
include "update_complete.php"; include "update_complete.php";
end:
//show the footer //show the footer
require_once "includes/footer.php"; require_once "includes/footer.php";

View File

@ -54,8 +54,6 @@ function _recaptcha_qsencode ($data) {
return $req; return $req;
} }
/** /**
* Submits an HTTP POST to a reCAPTCHA server * Submits an HTTP POST to a reCAPTCHA server
* @param string $host * @param string $host
@ -91,8 +89,6 @@ function _recaptcha_http_post($host, $path, $data, $port = 80) {
return $response; return $response;
} }
/** /**
* Gets the challenge HTML (javascript and non-javascript version). * Gets the challenge HTML (javascript and non-javascript version).
* This is called from the browser, and the resulting reCAPTCHA HTML widget * This is called from the browser, and the resulting reCAPTCHA HTML widget
@ -106,7 +102,10 @@ function _recaptcha_http_post($host, $path, $data, $port = 80) {
function recaptcha_get_html ($pubkey, $error = null, $use_ssl = false) function recaptcha_get_html ($pubkey, $error = null, $use_ssl = false)
{ {
if ($pubkey == null || $pubkey == '') { if ($pubkey == null || $pubkey == '') {
die ("To use reCAPTCHA you must get an API key from <a href='https://www.google.com/recaptcha/admin/create'>https://www.google.com/recaptcha/admin/create</a>"); require_once "includes/header.php";
echo "To use reCAPTCHA you must get an API key from <a href='https://www.google.com/recaptcha/admin/create'>https://www.google.com/recaptcha/admin/create</a>";
require_once "includes/footer.php";
exit;
} }
if ($use_ssl) { if ($use_ssl) {
@ -128,9 +127,6 @@ function recaptcha_get_html ($pubkey, $error = null, $use_ssl = false)
</noscript>'; </noscript>';
} }
/** /**
* A ReCaptchaResponse is returned from recaptcha_check_answer() * A ReCaptchaResponse is returned from recaptcha_check_answer()
*/ */
@ -139,7 +135,6 @@ class ReCaptchaResponse {
var $error; var $error;
} }
/** /**
* Calls an HTTP POST function to verify if the user's guess was correct * Calls an HTTP POST function to verify if the user's guess was correct
* @param string $privkey * @param string $privkey
@ -158,8 +153,6 @@ function recaptcha_check_answer ($privkey, $remoteip, $challenge, $response, $ex
if ($remoteip == null || $remoteip == '') { if ($remoteip == null || $remoteip == '') {
die ("For security reasons, you must pass the remote ip to reCAPTCHA"); die ("For security reasons, you must pass the remote ip to reCAPTCHA");
} }
//discard spam submissions //discard spam submissions
if ($challenge == null || strlen($challenge) == 0 || $response == null || strlen($response) == 0) { if ($challenge == null || strlen($challenge) == 0 || $response == null || strlen($response) == 0) {
@ -221,7 +214,6 @@ function _recaptcha_aes_encrypt($val,$ky) {
return mcrypt_encrypt($enc, $ky, $val, $mode, "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"); return mcrypt_encrypt($enc, $ky, $val, $mode, "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0");
} }
function _recaptcha_mailhide_urlbase64 ($x) { function _recaptcha_mailhide_urlbase64 ($x) {
return strtr(base64_encode ($x), '+/', '-_'); return strtr(base64_encode ($x), '+/', '-_');
} }