Index: /changelog
===================================================================
--- /changelog	(revision 6617)
+++ /changelog	(revision 6618)
@@ -12,4 +12,4 @@
 
 #4.0.0
-- Bug - Rechtschreibfehler>>>>>>> .r6604
+- Bug - Rechtschreibfehler
 - Bugfix - Bestellverwaltung FÃŒllmenge nicht in WPSG_TBL_ORDERPRODUCT
Index: /controller/wpsg_AdminController.class.php
===================================================================
--- /controller/wpsg_AdminController.class.php	(revision 6617)
+++ /controller/wpsg_AdminController.class.php	(revision 6618)
@@ -924,12 +924,21 @@
 
 				}
-				
-				// TODO
+
 				if ($_REQUEST['wpsg_deinstall_sites'] == '1')
 				{
 				
 					// Seiten lÃ¶schen
-					
-				
+
+                    wp_delete_post($this->get_option('wpsg_page_basket'), true);
+                    wp_delete_post($this->get_option('wpsg_page_versand'), true);
+                    wp_delete_post($this->get_option('wpsg_page_product'), true);
+                    wp_delete_post($this->get_option('wpsg_page_agb'), true);
+                    wp_delete_post($this->get_option('wpsg_page_datenschutz'), true);
+                    wp_delete_post($this->get_option('wpsg_page_widerrufsbelehrung'), true);
+                    wp_delete_post($this->get_option('wpsg_page_impressum'), true);
+
+                    // Module
+                    $this->shop->callMods('wpsg_deinstall_sites');
+
 					$this->shop->addBackendMessage(__('Seiten erfolgreich gelÃ¶scht.', 'wpsg'));
 				
@@ -977,5 +986,5 @@
 
 					// Plugindaten lÃ¶schen
-					wpsg_rrmdir(WP_PLUGIN_DIR.'../'.WPSG_FOLDERNAME.'/');
+					wpsg_rrmdir(WPSG_PATH);
 
 					$this->shop->clearMessages();
Index: /controller/wpsg_ShopController.class.php
===================================================================
--- /controller/wpsg_ShopController.class.php	(revision 6617)
+++ /controller/wpsg_ShopController.class.php	(revision 6618)
@@ -2970,21 +2970,45 @@
 		} // public function replaceUniversalPlatzhalter($value, $order_id = false, $kunden_id = false, $rechnung_id = false)
 
+        /**
+         * Verzeichnis, in dem Ã¶ffentliche Daten abgelegt werden kÃ¶nnen
+         * @param bool $getUrl Wenn true, dann wird die URL zurÃŒckgegeben
+         */
+        public function getPublicDir($getUrl = false) {
+
+            if ($this->isMultiBlog()) {
+
+                $path = WPSG_PATH_CONTENT.WPSG_MB_UPLOADS.'/wpsg/wpsg_public/';
+                $url = WPSG_URL_CONTENT.WPSG_MB_UPLOADS.'/wpsg/wpsg_public/';
+
+            } else {
+
+                $path = WPSG_PATH_CONTENT.'uploads/wpsg/wpsg_public/';
+                $url = WPSG_URL_CONTENT.'uploads/wpsg/wpsg_public/';
+
+            }
+
+            if (!file_exists($path)) wpsg_mkdir($path);
+            if (!file_exists($path.'.htaccess'))
+            {
+
+                file_put_contents($path.'.htaccess', 'Allow from all');
+
+            }
+
+            if ($getUrl === true) return $url; else return $path;
+
+        }
+
 		/**
 		 * Gibt das Verzeichnis zurÃŒck, in dem der Shop temporÃ€re Daten ablegen kann
 		 */
-		public function getTempDir($getUrl = false)
-		{
-
-			$path = '';
-
-			if ($this->isMultiBlog())
-			{
+		public function getTempDir($getUrl = false) {
+
+			if ($this->isMultiBlog()) {
 
 				$path = WPSG_PATH_CONTENT.WPSG_MB_UPLOADS.'/wpsg/wpsg_temp/';
 				$url = WPSG_URL_CONTENT.WPSG_MB_UPLOADS.'/wpsg/wpsg_temp/';
 
-			}
-			else
-			{
+			} else {
 
 				$path = WPSG_PATH_CONTENT.'uploads/wpsg/wpsg_temp/';
Index: /lib/filter_functions.inc.php
===================================================================
--- /lib/filter_functions.inc.php	(revision 6617)
+++ /lib/filter_functions.inc.php	(revision 6618)
@@ -117,5 +117,5 @@
 				echo '<script type="text/javascript"> ';
 
-				echo 'jQuery("input[name=\'wpsg_insertlicence_submit\']").on("click", function() { jQuery("tr[data-slug=\'wpshopgermany-free\']").find("input[type=\'checkbox\']").prop("checked", true); } ); ';
+				echo 'jQuery("input[name=\'wpsg_insertlicence_submit\']").on("click", function() { jQuery("tr[data-slug=\''.WPSG_FOLDERNAME.'\']").find("input[type=\'checkbox\']").prop("checked", true); } ); ';
 				echo 'jQuery("input[name=\'wpsg_licence_file\']").on("keydown", function(event) { if(event.which == 10 || event.which == 13) { jQuery("#wpsg_insertlicence_hidden").attr("name", "wpsg_insertlicence_submit"); jQuery("#wpsg_insertlicence_submit").click(); }  } ); ';
 				echo 'jQuery("#the-list").parent().parent().attr("enctype", "multipart/form-data"); ';
@@ -152,5 +152,5 @@
 				echo '<script type="text/javascript"> ';
 
-				echo 'jQuery("input[name=\'wpsg_insertlicence_submit\']").on("click", function() { jQuery("tr[data-slug=\'wpshopgermany-free\']").find("input[type=\'checkbox\']").prop("checked", true); } ); ';
+				echo 'jQuery("input[name=\'wpsg_insertlicence_submit\']").on("click", function() { jQuery("tr[data-slug=\''.WPSG_FOLDERNAME.'\']").find("input[type=\'checkbox\']").prop("checked", true); } ); ';
 				echo 'jQuery("input[name=\'wpsg_licence_file\']").on("keydown", function(event) { if(event.which == 10 || event.which == 13) { jQuery("#wpsg_insertlicence_hidden").attr("name", "wpsg_insertlicence_submit"); jQuery("#wpsg_insertlicence_submit").click(); }  } ); ';
 				echo 'jQuery("#the-list").parent().parent().attr("enctype", "multipart/form-data"); ';
Index: /mods/wpsg_mod_basic.class.php
===================================================================
--- /mods/wpsg_mod_basic.class.php	(revision 6617)
+++ /mods/wpsg_mod_basic.class.php	(revision 6618)
@@ -144,5 +144,5 @@
 		/** Wird bei der Darstellung der Bibliotheken / Includes aufgerufen */
 		public function admin_includes() { }
-		
+
 		/** ErmÃ¶glicht es Debuginformationen in der wpAdminBar anzuzeigen, wenn der Debug Modus aktiv ist */
 		public function admin_debugInfo() { }
@@ -380,4 +380,7 @@
 		/** Wird vom Backend aufgerufen wenn die Einstellungen gespeichert werden sollen */
 		public function settings_save() { }
+
+        /** Wird beim deinstallieren aufgerufen wenn die Seiten gelÃ¶scht werden sollen, die der Shop angelegt hat */
+        public function wpsg_deinstall_sites() { } // public function wpsg_deinstall_sites()
 
 		/** Wird wÃ€hrend der Anzeige der Produkte im Frontend aufgerufen um das Template fÃŒr die Anzeige zu verÃ€ndern. */
Index: /mods/wpsg_mod_billsafe.class.php
===================================================================
--- /mods/wpsg_mod_billsafe.class.php	(revision 6617)
+++ /mods/wpsg_mod_billsafe.class.php	(revision 6618)
@@ -121,4 +121,11 @@
 			
 		} // public function settings_save()
+
+        public function wpsg_deinstall_sites() {
+
+            wp_delete_post($this->shop->get_option('wpsg_mod_billsafe_success'));
+            wp_delete_post($this->shop->get_option('wpsg_mod_billsafe_error'));
+
+        } // public function wpsg_deinstall_sites()
 		 
 		public function addPayment(&$arPayment) 
Index: /mods/wpsg_mod_flexipay.class.php
===================================================================
--- /mods/wpsg_mod_flexipay.class.php	(revision 6617)
+++ /mods/wpsg_mod_flexipay.class.php	(revision 6618)
@@ -112,5 +112,12 @@
 		
 		} // public function settings_save()
-		
+
+        public function wpsg_deinstall_sites() {
+
+            wp_delete_post($this->shop->get_option('wpsg_mod_flexipay_successPage'));
+            wp_delete_post($this->shop->get_option('wpsg_mod_flexipay_errorPage'));
+
+        } // public function wpsg_deinstall_sites()
+
 		public function addPayment(&$arPayment)
 		{
Index: /mods/wpsg_mod_giropay.class.php
===================================================================
--- /mods/wpsg_mod_giropay.class.php	(revision 6617)
+++ /mods/wpsg_mod_giropay.class.php	(revision 6618)
@@ -40,5 +40,5 @@
 			
 		} // public function install()
-		
+
 		public function settings_edit()
 		{
@@ -120,5 +120,12 @@
 			
 		} // public function settings_save()
-		
+
+        public function wpsg_deinstall_sites() {
+
+            wp_delete_post($this->shop->get_option('wpsg_mod_giropay_successPage'));
+            wp_delete_post($this->shop->get_option('wpsg_mod_giropay_errorPage'));
+
+        } // public function wpsg_deinstall_sites()
+
 		public function addPayment(&$arPayment)
 		{
Index: /mods/wpsg_mod_icp.class.php
===================================================================
--- /mods/wpsg_mod_icp.class.php	(revision 6617)
+++ /mods/wpsg_mod_icp.class.php	(revision 6618)
@@ -112,5 +112,12 @@
 				
 		} // public function settings_save()
-		
+
+        public function wpsg_deinstall_sites() {
+
+            wp_delete_post($this->shop->get_option('wpsg_mod_icp_successPage'));
+            wp_delete_post($this->shop->get_option('wpsg_mod_icp_errorPage'));
+
+        } // public function wpsg_deinstall_sites()
+
 		public function addPayment(&$arPayment)
 		{
Index: /mods/wpsg_mod_klarna.class.php
===================================================================
--- /mods/wpsg_mod_klarna.class.php	(revision 6617)
+++ /mods/wpsg_mod_klarna.class.php	(revision 6618)
@@ -84,5 +84,12 @@
 						
 		} // public function settings_save()
-		
+
+        public function wpsg_deinstall_sites() {
+
+            wp_delete_post($this->shop->get_option('wpsg_mod_klarna_success'));
+            wp_delete_post($this->shop->get_option('wpsg_mod_klarna_error'));
+
+        } // public function wpsg_deinstall_sites()
+
 		public function addPayment(&$arPayment) 
 		{
Index: /mods/wpsg_mod_kundenverwaltung.class.php
===================================================================
--- /mods/wpsg_mod_kundenverwaltung.class.php	(revision 6617)
+++ /mods/wpsg_mod_kundenverwaltung.class.php	(revision 6618)
@@ -157,4 +157,14 @@
 
 		} // public function settings_save()
+
+        public function wpsg_deinstall_sites() {
+
+            wp_delete_post($this->shop->get_option('wpsg_page_mod_kundenverwaltung_profil'));
+            wp_delete_post($this->shop->get_option('wpsg_page_mod_kundenverwaltung_registrierung'));
+            wp_delete_post($this->shop->get_option('wpsg_page_mod_kundenverwaltung_weiterleitung_nach_registrierung'));
+            wp_delete_post($this->shop->get_option('wpsg_page_mod_kundenverwaltung_passwordsend'));
+            wp_delete_post($this->shop->get_option('wpsg_page_mod_kundenverwaltung_order'));
+
+        } // public function wpsg_deinstall_sites()
 		
 		public function admin_setcapabilities() { 
Index: /mods/wpsg_mod_micropayment.class.php
===================================================================
--- /mods/wpsg_mod_micropayment.class.php	(revision 6617)
+++ /mods/wpsg_mod_micropayment.class.php	(revision 6618)
@@ -239,5 +239,11 @@
 			
 		} // public function settings_save()
-		
+
+        public function wpsg_deinstall_sites() {
+
+            wp_delete_post($this->shop->get_option('wpsg_mod_micropayment_successPage'));
+
+        } // public function wpsg_deinstall_sites()
+
 		public function addPayment(&$arPayment)
 		{
Index: /mods/wpsg_mod_onepagecheckout.class.php
===================================================================
--- /mods/wpsg_mod_onepagecheckout.class.php	(revision 6617)
+++ /mods/wpsg_mod_onepagecheckout.class.php	(revision 6618)
@@ -57,5 +57,11 @@
 				
 		} // public function settings_save()
-			 
+
+        public function wpsg_deinstall_sites() {
+
+            wp_delete_post($this->shop->get_option('wpsg_mod_onepagecheckout_page'));
+
+        } // public function wpsg_deinstall_sites()
+
 		public function content_filter(&$content)
 		{
Index: /mods/wpsg_mod_paypal.class.php
===================================================================
--- /mods/wpsg_mod_paypal.class.php	(revision 6617)
+++ /mods/wpsg_mod_paypal.class.php	(revision 6618)
@@ -129,5 +129,12 @@
 			
 		} // public function settings_save()
-				
+
+        public function wpsg_deinstall_sites() {
+
+            wp_delete_post($this->shop->get_option('wpsg_page_mod_paypal_success'));
+            wp_delete_post($this->shop->get_option('wpsg_page_mod_paypal_error'));
+
+        } // public function wpsg_deinstall_sites()
+
 		public function order_ajax()
 		{
Index: /mods/wpsg_mod_paypalapi.class.php
===================================================================
--- /mods/wpsg_mod_paypalapi.class.php	(revision 6617)
+++ /mods/wpsg_mod_paypalapi.class.php	(revision 6618)
@@ -152,5 +152,12 @@
 			
 		} // public function settings_save()
-		
+
+        public function wpsg_deinstall_sites() {
+
+            wp_delete_post($this->shop->get_option('wpsg_page_mod_paypalapi_success'));
+            wp_delete_post($this->shop->get_option('wpsg_page_mod_paypalapi_error'));
+
+        } // public function wpsg_deinstall_sites()
+
 		public function setOrderStatus($order_id, $status_id, $inform)
 		{
Index: /mods/wpsg_mod_produktartikel.class.php
===================================================================
--- /mods/wpsg_mod_produktartikel.class.php	(revision 6617)
+++ /mods/wpsg_mod_produktartikel.class.php	(revision 6618)
@@ -523,5 +523,22 @@
 		{
 
+		    $post_id = $this->hasPostId($produkt_data['id']);
+
 			$this->shop->view['data'] = $produkt_data;
+
+            if (wpsg_isSizedInt($post_id))
+            {
+
+                $this->shop->view['data']['post_name'] = $this->db->fetchOne("
+                    SELECT
+                        `post_name`
+                    FROM
+                        `".$this->shop->prefix."posts`
+                    WHERE
+                        `ID` = '".wpsg_q($post_id)."' 
+                ");
+
+            }
+
 			$this->shop->render(WPSG_PATH_VIEW.'/mods/mod_produktartikel/produkt_edit_allgemein.phtml');
 
@@ -864,4 +881,27 @@
 		} // private function updatePostThumbnail($product_id)
 
+        /**
+         * Gibt false zurÃŒck, wenn noch kein POST existiert oder die POST_ID
+         * Im Gegensatz zu getPostIdFromPRoductId wird nicht angelegt
+         *
+         * @param $product_id
+         */
+        public function hasPostId($product_id) {
+
+            $post_id = $this->db->fetchOne("
+				SELECT
+					`id`
+				FROM
+					`".$this->shop->prefix."posts`
+				WHERE
+					`wpsg_produkt_id` = '".wpsg_q($product_id)."' AND
+					`post_type` = '".wpsg_q($this->shop->get_option('wpsg_mod_produktartikel_pathkey'))."'
+			");
+
+            if (wpsg_isSizedInt($post_id)) return $post_id;
+            else return false;
+
+        } // public function hasPostId($product_id)
+
 		/**
 		 * Gibt die Post_ID anhand einer ProduktID zurÃŒck.
@@ -871,5 +911,5 @@
 		{
 
-			global $wpdb, $current_user;
+			global $current_user;
 
 			$post_id = $this->db->fetchOne("
@@ -1150,5 +1190,4 @@
 		} // public function getSubCategory($parent = 0)
 
-
 		/**
 		 * Gibt einen Array mit Kategorien zurÃŒck
Index: /mods/wpsg_mod_request.class.php
===================================================================
--- /mods/wpsg_mod_request.class.php	(revision 6617)
+++ /mods/wpsg_mod_request.class.php	(revision 6618)
@@ -76,5 +76,12 @@
 			
 		} // public function settings_save()
-		
+
+        public function wpsg_deinstall_sites() {
+
+            wp_delete_post($this->shop->get_option('wpsg_mod_request_afterinsert'));
+            wp_delete_post($this->shop->get_option('wpsg_mod_request_customerdata'));
+
+        } // public function wpsg_deinstall_sites()
+
 		public function template_redirect() 
 		{ 
Index: /mods/wpsg_mod_securepay.class.php
===================================================================
--- /mods/wpsg_mod_securepay.class.php	(revision 6617)
+++ /mods/wpsg_mod_securepay.class.php	(revision 6618)
@@ -113,5 +113,12 @@
 			
 		} // public function settings_save()
-		
+
+        public function wpsg_deinstall_sites() {
+
+            wp_delete_post($this->shop->get_option('wpsg_mod_securepay_successPage'));
+            wp_delete_post($this->shop->get_option('wpsg_mod_securepay_errorPage'));
+
+        } // public function wpsg_deinstall_sites()
+
 		public function addPayment(&$arPayment)
 		{
Index: /mods/wpsg_mod_shs.class.php
===================================================================
--- /mods/wpsg_mod_shs.class.php	(revision 6617)
+++ /mods/wpsg_mod_shs.class.php	(revision 6618)
@@ -151,5 +151,12 @@
 							
 		} // public function settings_save()
-		
+
+        public function wpsg_deinstall_sites() {
+
+            wp_delete_post($this->shop->get_option('wpsg_page_mod_shs_success'));
+            wp_delete_post($this->shop->get_option('wpsg_page_mod_shs_error'));
+
+        } // public function wpsg_deinstall_sites()
+
 		public function addPayment(&$arPayment)
 		{
Index: /mods/wpsg_mod_skrill.class.php
===================================================================
--- /mods/wpsg_mod_skrill.class.php	(revision 6617)
+++ /mods/wpsg_mod_skrill.class.php	(revision 6618)
@@ -101,5 +101,12 @@
 			
 		} // public function settings_save()
-		
+
+        public function wpsg_deinstall_sites() {
+
+            wp_delete_post($this->shop->get_option('wpsg_page_mod_skrill_success'));
+            wp_delete_post($this->shop->get_option('wpsg_page_mod_skrill_error'));
+
+        } // public function wpsg_deinstall_sites()
+
 		public function addPayment(&$arPayment) 
 		{ 
Index: /mods/wpsg_mod_trustedshops.class.php
===================================================================
--- /mods/wpsg_mod_trustedshops.class.php	(revision 6617)
+++ /mods/wpsg_mod_trustedshops.class.php	(revision 6618)
@@ -26,6 +26,6 @@
 			$this->desc = __('ErmÃ¶glicht die Integration von Trusted Shops.', 'wpsg');
 			
-			$this->cache_file = $this->shop->getTempDir().'trusted_shops_siegel.gif';
-			$this->cache_url = $this->shop->getTempDir(true).'trusted_shops_siegel.gif';
+			$this->cache_file = $this->shop->getPublicDir().'trusted_shops_siegel.gif';
+			$this->cache_url = $this->shop->getPublicDir(true).'trusted_shops_siegel.gif';
 			
 		} // public function __construct();
@@ -446,8 +446,10 @@
 			$strQuery = "
 				SELECT
-					K.`email`, O.`onr`, K.`vname`, K.`name`
+					O.`onr`, 
+					K.`email`, A.`vname`, A.`name`
 				FROM
 					`".WPSG_TBL_ORDER."` AS O
 						LEFT JOIN `".WPSG_TBL_KU."` AS K ON (K.`id` = O.`k_id`)
+						LEFT JOIN `".WPSG_TBL_ADRESS."` AS A ON (A.`id` = K.`adress_id`)
 				WHERE
 					O.`wpsg_mod_trustedshops_set` = '1' AND
Index: /mods/wpsg_mod_wirecard.class.php
===================================================================
--- /mods/wpsg_mod_wirecard.class.php	(revision 6617)
+++ /mods/wpsg_mod_wirecard.class.php	(revision 6618)
@@ -119,5 +119,14 @@
 			
 		} // public function settings_save()
-		
+
+        public function wpsg_deinstall_sites() {
+
+            wp_delete_post($this->shop->get_option('wpsg_page_mod_wirecard_success'));
+            wp_delete_post($this->shop->get_option('wpsg_page_mod_wirecard_error'));
+            wp_delete_post($this->shop->get_option('wpsg_page_mod_wirecard_cancel'));
+            wp_delete_post($this->shop->get_option('wpsg_page_mod_wirecard_pending'));
+
+        } // public function wpsg_deinstall_sites()
+
 		public function checkGeneralBackendError()
 		{
Index: /views/admin/deinstall.phtml
===================================================================
--- /views/admin/deinstall.phtml	(revision 6617)
+++ /views/admin/deinstall.phtml	(revision 6618)
@@ -36,5 +36,5 @@
 		<br />
 		
-		<?php echo wpsg_drawForm_Checkbox ('wpsg_deinstall_sites', __('Shopseiten (Warenkorbseite, Produktdetailseite, Versandkosten, AGB, Datenschutz, Widerrufsbelehrung, Impressum, ... )', 'wpsg'), false, array('fullWidth' => true)); ?>
+		<?php echo wpsg_drawForm_Checkbox('wpsg_deinstall_sites', __('Shopseiten (Warenkorbseite, Produktdetailseite, Versandkosten, AGB, Datenschutz, Widerrufsbelehrung, Impressum, ... )', 'wpsg'), false, array('fullWidth' => true)); ?>
 		
 		<p class="submit"><input onclick="return wpsg_check_deinstall();" type="submit" value="<?php echo __('Deinstallation durchfÃŒhren', 'wpsg'); ?>" class="button-primary" id="submit" name="submit" /></p>
Index: /views/admin/module.phtml
===================================================================
--- /views/admin/module.phtml	(revision 6617)
+++ /views/admin/module.phtml	(revision 6618)
@@ -9,6 +9,4 @@
 	if (wpsg_isSizedArray($wpsg_update_data['modulinfo'])) $modul_info = $wpsg_update_data['modulinfo'];
 	else $modul_info = array();
-
-	//wpsg_debug($modul_info);
 
 ?>
@@ -143,7 +141,7 @@
 					
 		<?php } ?>
-		
+
 		<?php if (!isset($this->arAllModule[$_REQUEST['modul']]->version) || (@$wpsg_update_data['modulinfo'][$_REQUEST['modul']]['demo_active'] === true || @$wpsg_update_data['modulinfo'][$_REQUEST['modul']]['active'] === true || $wpsg_update_data['modulinfo'][$_REQUEST['modul']]['free'] === true)) { ?>
-		
+
 			<hr />
 		
