From a36b818b7ff889d8e7b2bcf8e214ac3fc681edcc Mon Sep 17 00:00:00 2001 From: Mark Crane Date: Thu, 21 Jun 2012 02:18:31 +0000 Subject: [PATCH] Cleanup recaptchalib and the signup page (signup needs more work) and remove the xmpp profile remove goto which causes some problems with tools. --- app/xmpp/v_profile_delete.php | 1 - app/xmpp/v_profile_edit.php | 13 ++++--------- includes/recaptchalib.php | 16 ++++------------ 3 files changed, 8 insertions(+), 22 deletions(-) diff --git a/app/xmpp/v_profile_delete.php b/app/xmpp/v_profile_delete.php index 5de0fc7d33..0329f7f2d4 100644 --- a/app/xmpp/v_profile_delete.php +++ b/app/xmpp/v_profile_delete.php @@ -88,7 +88,6 @@ if ($fp) { include "update_complete.php"; -end: //show the footer require_once "includes/footer.php"; diff --git a/app/xmpp/v_profile_edit.php b/app/xmpp/v_profile_edit.php index 1b4a478fcc..ce3c567e17 100644 --- a/app/xmpp/v_profile_edit.php +++ b/app/xmpp/v_profile_edit.php @@ -86,7 +86,8 @@ if ($action == "update") { if ((!isset($_REQUEST['submit'])) || ($_REQUEST['submit'] != 'Save')) { // If we arent saving a Profile Display the form. include "profile_edit.php"; - goto end; + require_once "includes/footer.php"; + exit; } foreach ($_REQUEST as $field => $data){ @@ -103,7 +104,8 @@ if (strlen($error) > 0) { include "errors.php"; $profile = $request; include "profile_edit.php"; - goto end; + require_once "includes/footer.php"; + exit; } // Save New Entry @@ -162,7 +164,6 @@ if ($action == "add" && permission_exists('xmpp_add')) { $sql .= ") "; $db->exec(check_sql($sql)); - goto writeout; } elseif ($action == "update" && permission_exists('xmpp_edit')) { $sql = ""; @@ -194,19 +195,14 @@ elseif ($action == "update" && permission_exists('xmpp_edit')) { $sql .= "where xmpp_profile_uuid = '" . $request['id'] . "' "; $db->exec(check_sql($sql)); $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 $jingle_list = glob($_SESSION['switch']['conf']['dir'] . "/jingle_profiles/*v_*.xml"); foreach($jingle_list as $name => $value) { unlink($value); } - if ($request['enabled'] == "true") { //prepare the xml include "client_template.php"; @@ -238,7 +234,6 @@ if ($fp) { include "update_complete.php"; -end: //show the footer require_once "includes/footer.php"; diff --git a/includes/recaptchalib.php b/includes/recaptchalib.php index e18ddb8856..225a04a5dc 100644 --- a/includes/recaptchalib.php +++ b/includes/recaptchalib.php @@ -54,8 +54,6 @@ function _recaptcha_qsencode ($data) { return $req; } - - /** * Submits an HTTP POST to a reCAPTCHA server * @param string $host @@ -91,8 +89,6 @@ function _recaptcha_http_post($host, $path, $data, $port = 80) { return $response; } - - /** * Gets the challenge HTML (javascript and non-javascript version). * 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) { if ($pubkey == null || $pubkey == '') { - die ("To use reCAPTCHA you must get an API key from https://www.google.com/recaptcha/admin/create"); + require_once "includes/header.php"; + echo "To use reCAPTCHA you must get an API key from https://www.google.com/recaptcha/admin/create"; + require_once "includes/footer.php"; + exit; } if ($use_ssl) { @@ -128,9 +127,6 @@ function recaptcha_get_html ($pubkey, $error = null, $use_ssl = false) '; } - - - /** * A ReCaptchaResponse is returned from recaptcha_check_answer() */ @@ -139,7 +135,6 @@ class ReCaptchaResponse { var $error; } - /** * Calls an HTTP POST function to verify if the user's guess was correct * @param string $privkey @@ -158,8 +153,6 @@ function recaptcha_check_answer ($privkey, $remoteip, $challenge, $response, $ex if ($remoteip == null || $remoteip == '') { die ("For security reasons, you must pass the remote ip to reCAPTCHA"); } - - //discard spam submissions 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"); } - function _recaptcha_mailhide_urlbase64 ($x) { return strtr(base64_encode ($x), '+/', '-_'); }