Index: /changelog
===================================================================
--- /changelog	(revision 7943)
+++ /changelog	(revision 7944)
@@ -471,4 +471,5 @@
 - Feature: Bei Statuswechsel ÃŒber die BestellÃŒbersicht kÃ¶nnen die Kunden jetzt optional darÃŒber informiert werden
 - Feature: Adminmail in Kundenverwaltung ohne DEBUG Modus auslÃ¶sbar (Reiter Bestelldaten)
+- Feature: Mathe Captcha Schutz bei Registrierung
 - Bugfix: PasswortzurÃŒcksetzen funktioniert jetzt auch, wenn paralell ein gelÃ¶schter Kunde mit gleicher E-Mail existiert
 - Bugfix: Produktartikel Neu Aufbauen beachtet den "Entwurfs - Status"
Index: /classes/Action.class.php
===================================================================
--- /classes/Action.class.php	(revision 7943)
+++ /classes/Action.class.php	(revision 7944)
@@ -23,5 +23,5 @@
                 filemtime(\wpsg_ShopController::getShop()->getRessourcePath('js/wpsg-block-product.js'))
             );
-             
+              
             $arProductSelect = \wpsg_ShopController::getShop()->db->fetchAssoc("
                 SELECT 
Index: /lib/wpsg_basket.class.php
===================================================================
--- /lib/wpsg_basket.class.php	(revision 7943)
+++ /lib/wpsg_basket.class.php	(revision 7944)
@@ -968,10 +968,20 @@
 			$this->shop->callMods('checkCheckout', array(&$state, &$bError, &$this->arCheckout));
 			
-			if ($state == 1 || $state)
-			{
+			if ($state == 1 || $state) {
+				
+				if (isset($_REQUEST['wpsg_mod_kundenverwaltung_register']) && $this->shop->get_option('wpsg_mod_kundenverwaltung_mathcaptcha') === '1') {
+					
+					if (\get_transient('wpsg_mod_kundenverwaltung_mathcaptcha_result') !== $_REQUEST['wpsg_mod_kundenverwaltung_mathcaptcha']) {
+						
+						$this->shop->addFrontendError(__('Bitte lÃ¶sen sie die Mathe Aufgabe und zeigen Sie, dass Sie kein Bot sind!', 'wpsg'));
+						$_SESSION['wpsg']['errorFields'][] = 'wpsg_mod_kundenverwaltung_mathcaptcha';
+						$bError = true;
+						
+					}
+					
+				}
 				
 				// Anrede ÃŒberprÃŒfen
-				if ($custom_config['anrede'] != '2' && $custom_config['anrede'] != '1' && $this->arCheckout['title'] == '-1')
-				{
+				if ($custom_config['anrede'] != '2' && $custom_config['anrede'] != '1' && $this->arCheckout['title'] == '-1') {
 					
 					$this->shop->addFrontendError(__('Bitte im Feld "Anrede" eine Angabe machen!', 'wpsg'));
@@ -982,6 +992,5 @@
 				
 				// Firma
-				if ($custom_config['firma'] != '2' && $custom_config['firma'] != '1' && trim($this->arCheckout['firma']) == '')
-				{
+				if ($custom_config['firma'] != '2' && $custom_config['firma'] != '1' && trim($this->arCheckout['firma']) == '') {
 					
 					$this->shop->addFrontendError(__('Bitte im Feld "Firma" eine Angabe machen!', 'wpsg'));
@@ -992,6 +1001,5 @@
 				
 				// Vorname
-				if ($custom_config['vname'] != '2' && $custom_config['vname'] != '1' && trim(wpsg_getStr($this->arCheckout['vname'])) == '')
-				{
+				if ($custom_config['vname'] != '2' && $custom_config['vname'] != '1' && trim(wpsg_getStr($this->arCheckout['vname'])) == '') {
 					
 					$this->shop->addFrontendError(__('Bitte im Feld "Vorname" eine Angabe machen!', 'wpsg'));
Index: /mods/wpsg_mod_export.class.php
===================================================================
--- /mods/wpsg_mod_export.class.php	(revision 7943)
+++ /mods/wpsg_mod_export.class.php	(revision 7944)
@@ -1447,5 +1447,5 @@
                         'order_invoice_title' => __('Rechnungsadresse Anrede', 'wpsg'),
                         'order_invoice_firma' => __('Rechnungsadresse Firma', 'wpsg'),
-                        'order_invoice_vorname' => __('Rechnunsadresse Vorname', 'wpsg'),
+                        'order_invoice_vorname' => __('Rechnungsadresse Vorname', 'wpsg'),
                         'order_invoice_name' => __('Rechnungsadresse Name', 'wpsg'),
                         'order_invoice_strasse' => __('Rechnungsadresse StraÃe (mit Hausnummer)', 'wpsg'),
Index: /mods/wpsg_mod_kundenverwaltung.class.php
===================================================================
--- /mods/wpsg_mod_kundenverwaltung.class.php	(revision 7943)
+++ /mods/wpsg_mod_kundenverwaltung.class.php	(revision 7944)
@@ -182,6 +182,5 @@
 		} // public function admin_setcapabilities()
 		
-		public function settings_save()
-		{
+		public function settings_save() {
 
 		    $this->shop->update_option('wpsg_mod_kundenverwaltung_perpage', $_REQUEST['wpsg_mod_kundenverwaltung_perpage'], false, false, WPSG_SANITIZE_TEXTFIELD);
@@ -202,4 +201,6 @@
 			$this->shop->update_option('wpsg_mod_kundenveraltung_recaptcha_key', $_REQUEST['wpsg_mod_kundenveraltung_recaptcha_key'], false, false, WPSG_SANITIZE_TEXTFIELD);
 			$this->shop->update_option('wpsg_mod_kundenveraltung_recaptcha_secretkey', $_REQUEST['wpsg_mod_kundenveraltung_recaptcha_secretkey'], false, false, WPSG_SANITIZE_TEXTFIELD);
+			
+			$this->shop->update_option('wpsg_mod_kundenverwaltung_mathcaptcha', $_REQUEST['wpsg_mod_kundenverwaltung_mathcaptcha'], false, false, WPSG_SANITIZE_CHECKBOX);
 			
 			$this->shop->createPage(__('Profil', 'wpsg'), 'wpsg_page_mod_kundenverwaltung_profil', $_REQUEST['wpsg_page_mod_kundenverwaltung_profil']);
@@ -860,6 +861,5 @@
 				$_SESSION['wpsg']['checkout'] = wpsg_xss($basket->arCheckout);
 				
-				if ($basket->checkCheckout(1))
-				{
+				if ($basket->checkCheckout(1)) {
  					
 					// Alles OK
@@ -885,6 +885,5 @@
 		
 					// Kundengruppe fÃŒr Checkout
-					if ($this->shop->hasMod('wpsg_mod_customergroup'))
-					{
+					if ($this->shop->hasMod('wpsg_mod_customergroup')) {
 					
 						if ($this->shop->get_option('wpsg_page_mod_kundenverwaltung_group_register') > 0) $kunde_data['group_id'] = $this->shop->get_option('wpsg_page_mod_kundenverwaltung_group_register');
@@ -2446,4 +2445,3 @@
 		
 	} // class wpsg_mod_kundenverwaltung extends wpsg_mod_basic
-
-?>
+ 
Index: /views/mods/mod_kundenverwaltung/register.phtml
===================================================================
--- /views/mods/mod_kundenverwaltung/register.phtml	(revision 7943)
+++ /views/mods/mod_kundenverwaltung/register.phtml	(revision 7944)
@@ -261,5 +261,5 @@
 		<?php if ($this->view['pflicht']['strasse'] != '2') { ?>
 			
-			<?php if ($this->view['pflicht']['wpsg_showNr'] === '1') { ?>
+			<?php if (($this->view['pflicht']['wpsg_showNr']??0) === '1') { ?>
 
 				<div class="wpsg_checkoutblock" id="wpsg_streetnr">
@@ -365,4 +365,42 @@
         <?php } ?>
         
+        <?php if ($this->get_option('wpsg_mod_kundenverwaltung_mathcaptcha') === '1') {  
+            
+            $number1 = rand(0, 9);
+            $number2 = rand(0, 10);
+            $arOperator = ['+', '-', '*']; $operator = $arOperator[array_rand($arOperator)];
+            
+            $time = time(); 
+                            
+            switch ($operator) {
+                
+                case '+': $captcha_result = $number1 + $number2; break;
+                case '-': $captcha_result = $number1 - $number2; break;
+                case '*': $captcha_result = $number1 * $number2; break;
+                
+                default: throw new \Exception();
+                
+            }
+            
+            \set_transient('wpsg_mod_kundenverwaltung_mathcaptcha_result', $captcha_result);
+            
+            ?>
+         
+            <div class="wpsg_checkoutblock">
+                <label for="wpsg_mod_kundenverwaltung_mathcaptcha" class="wpsg_register"><?php echo wpsg_translate(
+                    __("Ergebnis aus #1# #2# #3#", "wpsg"),
+                        $number1, $operator, $number2
+	            ); ?>:
+                    <span class="wpsg_required">*</span>
+                </label>
+                <input 
+                        class="validate[required] wpsg_register <?php echo ((in_array("wpsg_mod_kundenverwaltung_mathcaptcha", (array)$this->view['error']))?'wpsg_error':''); ?>" 
+                        type="text" id="wpsg_mod_kundenverwaltung_mathcaptcha" name="wpsg_mod_kundenverwaltung_mathcaptcha"
+                        placeholder="SPAM Schutz"
+                        value="" />
+            </div>
+            
+        <?php } ?>
+        
 		<div class="wpsg_mandatoryfield_hint">
 			<?php echo wpsg_translate(__('Mit #1# gekennzeichnete Felder sind Pflichtfelder.', 'wpsg'), '<span class="wpsg_required">*</span>'); ?>
Index: /views/mods/mod_kundenverwaltung/settings_edit.phtml
===================================================================
--- /views/mods/mod_kundenverwaltung/settings_edit.phtml	(revision 7943)
+++ /views/mods/mod_kundenverwaltung/settings_edit.phtml	(revision 7944)
@@ -78,4 +78,7 @@
     
 </div>
+
+<?php echo wpsg_drawForm_Checkbox('wpsg_mod_kundenverwaltung_mathcaptcha', __('Captcha Mathe Aufgabe', 'wpsg'), $this->get_option('wpsg_mod_kundenverwaltung_mathcaptcha')); ?>
+
 <script> 
     
