Index: branches/2.8.x/CHANGELOG
===================================================================
--- branches/2.8.x/CHANGELOG	(revision 1575)
+++ branches/2.8.x/CHANGELOG	(revision 1576)
@@ -11,6 +11,8 @@
 ! = Update/Change
 
 =========================== add small Features 2.8.2 ==========================
+16 Jan-2012 Build 1576 Werner v.d.Decken(DarkViper)
+# wysiwyg module changed to domain independend image links
 16 Jan-2012 Build 1575 Dietmar Woellbrink (Luisehahne)
 # fixed captcha error message in form module
 ! set form module to version 2.8.4
Index: branches/2.8.x/wb/admin/interface/version.php
===================================================================
--- branches/2.8.x/wb/admin/interface/version.php	(revision 1575)
+++ branches/2.8.x/wb/admin/interface/version.php	(revision 1576)
@@ -52,5 +52,5 @@
 
 // check if defined to avoid errors during installation (redirect to admin panel fails if PHP error/warnings are enabled)
 if(!defined('VERSION')) define('VERSION', '2.8.2');
-if(!defined('REVISION')) define('REVISION', '1575');
+if(!defined('REVISION')) define('REVISION', '1576');
 if(!defined('SP')) define('SP', 'SP2');
Index: branches/2.8.x/wb/modules/wysiwyg/view.php
===================================================================
--- branches/2.8.x/wb/modules/wysiwyg/view.php	(revision 1575)
+++ branches/2.8.x/wb/modules/wysiwyg/view.php	(revision 1576)
@@ -4,7 +4,7 @@
  * @category        modules
  * @package         wysiwyg
  * @author          WebsiteBaker Project
- * @copyright       2009-2011, Website Baker Org. e.V.
+ * @copyright       2009-2012, Website Baker Org. e.V.
  * @link			http://www.websitebaker2.org/
  * @license         http://www.gnu.org/licenses/gpl.html
  * @platform        WebsiteBaker 2.8.x
@@ -14,17 +14,18 @@
  * @lastmodified    $Date$
  *
  */
-// Must include code to stop this file being access directly
 /* -------------------------------------------------------- */
-if(defined('WB_PATH') == false)
-{
-	// Stop this file being access directly
-		die('<head><title>Access denied</title></head><body><h2 style="color:red;margin:3em auto;text-align:center;">Cannot access this file directly</h2></body></html>');
+// Must include code to stop this file being accessed directly
+if(!defined('WB_PATH')) {
+	require_once(dirname(dirname(__FILE__)).'/framework/globalExceptionHandler.php');
+	throw new IllegalFileException();
 }
 /* -------------------------------------------------------- */
+$MEDIA_URL = WB_URL.MEDIA_DIRECTORY;
 // Get content
-$get_content = $database->query("SELECT content FROM ".TABLE_PREFIX."mod_wysiwyg WHERE section_id = '$section_id'");
-$fetch_content = $get_content->fetchRow();
-$content = ($fetch_content['content']);
-
+$content = '';
+$sql = 'SELECT `content` FROM `'.TABLE_PREFIX.'mod_wysiwyg` WHERE `section_id`='.(int)$section_id;
+if( ($content = $database->get_one($sql)) ) {
+	$content = str_replace('{SYSVAR:MEDIA_REL}',$MEDIA_REL, $content );
+}
 echo $content;
Index: branches/2.8.x/wb/modules/wysiwyg/info.php
===================================================================
--- branches/2.8.x/wb/modules/wysiwyg/info.php	(revision 1575)
+++ branches/2.8.x/wb/modules/wysiwyg/info.php	(revision 1576)
@@ -4,7 +4,7 @@
  * @category        modules
  * @package         wysiwyg
  * @author          WebsiteBaker Project
- * @copyright       2009-2011, Website Baker Org. e.V.
+ * @copyright       2009-2012, Website Baker Org. e.V.
  * @link			http://www.websitebaker2.org/
  * @license         http://www.gnu.org/licenses/gpl.html
  * @platform        WebsiteBaker 2.8.x
@@ -15,17 +15,16 @@
  *
  */
 /* -------------------------------------------------------- */
-if(defined('WB_PATH') == false)
-{
-	// Stop this file being access directly
-		die('<head><title>Access denied</title></head><body><h2 style="color:red;margin:3em auto;text-align:center;">Cannot access this file directly</h2></body></html>');
+// Must include code to stop this file being accessed directly
+if(!defined('WB_PATH')) {
+	require_once(dirname(dirname(__FILE__)).'/framework/globalExceptionHandler.php');
+	throw new IllegalFileException();
 }
 /* -------------------------------------------------------- */
-
 $module_directory = 'wysiwyg';
 $module_name = 'WYSIWYG';
 $module_function = 'page';
-$module_version = '2.8.3';
+$module_version = '2.9.0';
 $module_platform = '2.8.2';
 $module_author = 'Ryan Djurovich';
 $module_license = 'GNU General Public License';
Index: branches/2.8.x/wb/modules/wysiwyg/save.php
===================================================================
--- branches/2.8.x/wb/modules/wysiwyg/save.php	(revision 1575)
+++ branches/2.8.x/wb/modules/wysiwyg/save.php	(revision 1576)
@@ -4,7 +4,7 @@
  * @category        backend
  * @package         wysiwyg
  * @author          WebsiteBaker Project
- * @copyright       2009-2011, Website Baker Org. e.V.
+ * @copyright       2009-2012, Website Baker Org. e.V.
  * @link			http://www.websitebaker2.org/
  * @license         http://www.gnu.org/licenses/gpl.html
  * @platform        WebsiteBaker 2.8.x
@@ -35,9 +35,13 @@
 // Include the WB functions file
 require_once(WB_PATH.'/framework/functions.php');
 
+$MEDIA_URL = WB_URL.MEDIA_DIRECTORY;
 // Update the mod_wysiwygs table with the contents
 if(isset($_POST['content'.$section_id])) {
-	$content = $admin->add_slashes($_POST['content'.$section_id]);
+    $content = $_POST['content'.$section_id];
+    $searchfor = '#(<.*= *\")('.quotemeta($MEDIA_URL).')(.*\".*>)#iU';
+    $content = preg_replace($searchfor, '$1{SYSVAR:MEDIA_REL}$3', $content);
+    $content = $admin->add_slashes($content);
 	// searching in $text will be much easier this way
 	$text = umlauts_to_entities(strip_tags($content), strtoupper(DEFAULT_CHARSET), 0);
 	$query = "UPDATE ".TABLE_PREFIX."mod_wysiwyg SET content = '$content', text = '$text' WHERE section_id = '$section_id'";
Index: branches/2.8.x/wb/modules/wysiwyg/install.php
===================================================================
--- branches/2.8.x/wb/modules/wysiwyg/install.php	(revision 1575)
+++ branches/2.8.x/wb/modules/wysiwyg/install.php	(revision 1576)
@@ -4,7 +4,7 @@
  * @category        modules
  * @package         wysiwyg
  * @author          WebsiteBaker Project
- * @copyright       2009-2011, Website Baker Org. e.V.
+ * @copyright       2009-2012, Website Baker Org. e.V.
  * @link			http://www.websitebaker2.org/
  * @license         http://www.gnu.org/licenses/gpl.html
  * @platform        WebsiteBaker 2.8.x
@@ -14,18 +14,16 @@
  * @lastmodified    $Date$
  *
  */
-// Must include code to stop this file being access directly
 /* -------------------------------------------------------- */
-if(defined('WB_PATH') == false)
-{
-	// Stop this file being access directly
-		die('<head><title>Access denied</title></head><body><h2 style="color:red;margin:3em auto;text-align:center;">Cannot access this file directly</h2></body></html>');
+// Must include code to stop this file being accessed directly
+if(!defined('WB_PATH')) {
+	require_once(dirname(dirname(__FILE__)).'/framework/globalExceptionHandler.php');
+	throw new IllegalFileException();
 }
 /* -------------------------------------------------------- */
 
 if(defined('WB_URL'))
 {
-
 	// Create table
 	//$database->query("DROP TABLE IF EXISTS `".TABLE_PREFIX."mod_wysiwyg`");
 	$mod_wysiwyg = 'CREATE TABLE IF NOT EXISTS `'.TABLE_PREFIX.'mod_wysiwyg` ( '
@@ -37,35 +35,33 @@
 		. ' ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci';
 	$database->query($mod_wysiwyg);
 
-
-    $mod_search = "SELECT * FROM ".TABLE_PREFIX."search  WHERE value = 'wysiwyg'";
-    $insert_search = $database->query($mod_search);
-    if( $insert_search->numRows() == 0 )
-    {
-    	// Insert info into the search table
-    	// Module query info
-    	$field_info = array();
-    	$field_info['page_id'] = 'page_id';
-    	$field_info['title'] = 'page_title';
-    	$field_info['link'] = 'link';
-    	$field_info['description'] = 'description';
-    	$field_info['modified_when'] = 'modified_when';
-    	$field_info['modified_by'] = 'modified_by';
-    	$field_info = serialize($field_info);
-    	$database->query("INSERT INTO ".TABLE_PREFIX."search (name,value,extra) VALUES ('module', 'wysiwyg', '$field_info')");
-    	// Query start
-    	$query_start_code = "SELECT [TP]pages.page_id, [TP]pages.page_title,	[TP]pages.link, [TP]pages.description, [TP]pages.modified_when, [TP]pages.modified_by	FROM [TP]mod_wysiwyg, [TP]pages WHERE ";
-    	$database->query("INSERT INTO ".TABLE_PREFIX."search (name,value,extra) VALUES ('query_start', '$query_start_code', 'wysiwyg')");
-    	// Query body
-    	$query_body_code = " [TP]pages.page_id = [TP]mod_wysiwyg.page_id AND [TP]mod_wysiwyg.text [O] \'[W][STRING][W]\' AND [TP]pages.searching = \'1\'";
-    	$database->query("INSERT INTO ".TABLE_PREFIX."search (name,value,extra) VALUES ('query_body', '$query_body_code', 'wysiwyg')");
-    	// Query end
-    	$query_end_code = "";
-    	$database->query("INSERT INTO ".TABLE_PREFIX."search (name,value,extra) VALUES ('query_end', '$query_end_code', 'wysiwyg')");
-
-    	// Insert blank row (there needs to be at least on row for the search to work)
-    	$database->query("INSERT INTO ".TABLE_PREFIX."mod_wysiwyg (page_id,section_id) VALUES ('0','0')");
-
-
-    }
+// remove old version of search (deprecated)
+//    $mod_search = "SELECT * FROM ".TABLE_PREFIX."search  WHERE value = 'wysiwyg'";
+//    $insert_search = $database->query($mod_search);
+//    if( $insert_search->numRows() == 0 )
+//    {
+//    	// Insert info into the search table
+//    	// Module query info
+//    	$field_info = array();
+//    	$field_info['page_id'] = 'page_id';
+//    	$field_info['title'] = 'page_title';
+//    	$field_info['link'] = 'link';
+//    	$field_info['description'] = 'description';
+//    	$field_info['modified_when'] = 'modified_when';
+//    	$field_info['modified_by'] = 'modified_by';
+//    	$field_info = serialize($field_info);
+//    	$database->query("INSERT INTO ".TABLE_PREFIX."search (name,value,extra) VALUES ('module', 'wysiwyg', '$field_info')");
+//    	// Query start
+//    	$query_start_code = "SELECT [TP]pages.page_id, [TP]pages.page_title,	[TP]pages.link, [TP]pages.description, [TP]pages.modified_when, [TP]pages.modified_by	FROM [TP]mod_wysiwyg, [TP]pages WHERE ";
+//    	$database->query("INSERT INTO ".TABLE_PREFIX."search (name,value,extra) VALUES ('query_start', '$query_start_code', 'wysiwyg')");
+//    	// Query body
+//    	$query_body_code = " [TP]pages.page_id = [TP]mod_wysiwyg.page_id AND [TP]mod_wysiwyg.text [O] \'[W][STRING][W]\' AND [TP]pages.searching = \'1\'";
+//    	$database->query("INSERT INTO ".TABLE_PREFIX."search (name,value,extra) VALUES ('query_body', '$query_body_code', 'wysiwyg')");
+//    	// Query end
+//    	$query_end_code = "";
+//    	$database->query("INSERT INTO ".TABLE_PREFIX."search (name,value,extra) VALUES ('query_end', '$query_end_code', 'wysiwyg')");
+//
+//    	// Insert blank row (there needs to be at least on row for the search to work)
+//    	$database->query("INSERT INTO ".TABLE_PREFIX."mod_wysiwyg (page_id,section_id) VALUES ('0','0')");
+//    }
 }
Index: branches/2.8.x/wb/modules/wysiwyg/modify.php
===================================================================
--- branches/2.8.x/wb/modules/wysiwyg/modify.php	(revision 1575)
+++ branches/2.8.x/wb/modules/wysiwyg/modify.php	(revision 1576)
@@ -4,7 +4,7 @@
  * @category        modules
  * @package         wysiwyg
  * @author          WebsiteBaker Project
- * @copyright       2009-2011, Website Baker Org. e.V.
+ * @copyright       2009-2012, Website Baker Org. e.V.
  * @link			http://www.websitebaker2.org/
  * @license         http://www.gnu.org/licenses/gpl.html
  * @platform        WebsiteBaker 2.8.x
@@ -16,19 +16,21 @@
  */
 
 /* -------------------------------------------------------- */
-if(defined('WB_PATH') == false)
-{
-	// Stop this file being access directly
-		die('<head><title>Access denied</title></head><body><h2 style="color:red;margin:3em auto;text-align:center;">Cannot access this file directly</h2></body></html>');
+// Must include code to stop this file being accessed directly
+if(!defined('WB_PATH')) {
+	require_once(dirname(dirname(__FILE__)).'/framework/globalExceptionHandler.php');
+	throw new IllegalFileException();
 }
 /* -------------------------------------------------------- */
 
+$MEDIA_URL = WB_URL.MEDIA_DIRECTORY;
 // Get page content
-$query = "SELECT content FROM ".TABLE_PREFIX."mod_wysiwyg WHERE section_id = '$section_id'";
-$get_content = $database->query($query);
-$content = $get_content->fetchRow();
-$content = (htmlspecialchars($content['content']));
-
+$query = 'SELECT `content` FROM `'.TABLE_PREFIX.'mod_wysiwyg` WHERE `section_id`='.(int)$section_id;
+if ( ($content = $database->get_one($sql)) ) {
+	$content = htmlspecialchars(str_replace('{SYSVAR:MEDIA_REL}',$MEDIA_URL, $content));
+}else {
+	$content = '';
+}
 if(!isset($wysiwyg_editor_loaded)) {
 	$wysiwyg_editor_loaded=true;
 
@@ -37,12 +39,13 @@
 			echo '<textarea name="'.$name.'" id="'.$id.'" style="width: '.$width.'; height: '.$height.';">'.$content.'</textarea>';
 		}
 	} else {
-		$id_list=array();
-		$query_wysiwyg = $database->query("SELECT section_id FROM ".TABLE_PREFIX."sections WHERE page_id = '$page_id' AND module = 'wysiwyg'");
-		if($query_wysiwyg->numRows() > 0) {
+		$id_list = array();
+		$sql  = 'SELECT `section_id` FROM `'.TABLE_PREFIX.'sections` ';
+		$sql .= 'WHERE `page_id`='.(int)$page_id.' AND `module`=\'wysiwyg\'';
+		if (($query_wysiwyg = $database->query($sql))) {
 			while($wysiwyg_section = $query_wysiwyg->fetchRow()) {
 				$entry='content'.$wysiwyg_section['section_id'];
-				array_push($id_list,$entry);
+				$id_list[] = $entry;
 			}
 			require(WB_PATH.'/modules/'.WYSIWYG_EDITOR.'/include.php');
 		}
@@ -50,28 +53,22 @@
 }
 
 ?>
-
 <form name="wysiwyg<?php echo $section_id; ?>" action="<?php echo WB_URL; ?>/modules/wysiwyg/save.php" method="post">
-
-<input type="hidden" name="page_id" value="<?php echo $page_id; ?>" />
-<input type="hidden" name="section_id" value="<?php echo $section_id; ?>" />
-
+	<input type="hidden" name="page_id" value="<?php echo $page_id; ?>" />
+	<input type="hidden" name="section_id" value="<?php echo $section_id; ?>" />
 <?php
 echo $admin->getFTAN()."\n"; 
 show_wysiwyg_editor('content'.$section_id,'content'.$section_id,$content,'100%','350');
 ?>
-
-<table summary="" cellpadding="0" cellspacing="0" border="0" width="100%" style="padding-bottom: 10px;">
-<tr>
-	<td align="left">
-		<input type="submit" value="<?php echo $TEXT['SAVE']; ?>" style="width: 100px; margin-top: 5px;" />
-	</td>
-	<td align="right">
-		<input type="button" value="<?php echo $TEXT['CANCEL']; ?>" onclick="javascript: window.location = 'index.php';" style="width: 100px; margin-top: 5px;" />
-	</td>
-</tr>
-</table>
-
+	<table summary="" cellpadding="0" cellspacing="0" border="0" width="100%" style="padding-bottom: 10px;">
+		<tr>
+			<td align="left">
+				<input type="submit" value="<?php echo $TEXT['SAVE']; ?>" style="width: 100px; margin-top: 5px;" />
+			</td>
+			<td align="right">
+				<input type="button" value="<?php echo $TEXT['CANCEL']; ?>" onclick="javascript: window.location = 'index.php';" style="width: 100px; margin-top: 5px;" />
+			</td>
+		</tr>
+	</table>
 </form>
-
 <br />
\ No newline at end of file
Index: branches/2.8.x/wb/modules/wysiwyg/upgrade.php
===================================================================
--- branches/2.8.x/wb/modules/wysiwyg/upgrade.php	(revision 1575)
+++ branches/2.8.x/wb/modules/wysiwyg/upgrade.php	(revision 1576)
@@ -4,7 +4,7 @@
  * @category        modules
  * @package         wysiwyg
  * @author          WebsiteBaker Project
- * @copyright       2009-2011, Website Baker Org. e.V.
+ * @copyright       2009-2012, Website Baker Org. e.V.
  * @link			http://www.websitebaker2.org/
  * @license         http://www.gnu.org/licenses/gpl.html
  * @platform        WebsiteBaker 2.8.x
@@ -14,12 +14,11 @@
  * @lastmodified    $Date$
  *
  */
-// Must include code to stop this file being access directly
 /* -------------------------------------------------------- */
-if(defined('WB_PATH') == false)
-{
-	// Stop this file being access directly
-		die('<head><title>Access denied</title></head><body><h2 style="color:red;margin:3em auto;text-align:center;">Cannot access this file directly</h2></body></html>');
+// Must include code to stop this file being accessed directly
+if(!defined('WB_PATH')) {
+	require_once(dirname(dirname(__FILE__)).'/framework/globalExceptionHandler.php');
+	throw new IllegalFileException();
 }
 /* -------------------------------------------------------- */
 
@@ -32,6 +31,14 @@
 		}
 	}
 } else {
-	$msg = $database->get_error();
+	$msg .= $database->get_error().'<br />';
 }
+// change internal absolute links into relative links
+$sTable = TABLE_PREFIX.'mod_wysiwyg';
+$sql  = 'UPDATE `'.$sTable.'` ';
+$sql .= 'SET `content` = REPLACE(`content`, \'"'.WB_URL.MEDIA_DIRECTORY.'\', \'"{SYSVAR:MEDIA_REL}\')';
+if (!$database->query($sql)) {
+	$msg .= $database->get_error().'<br />';
+}
+
 // ------------------------------------
\ No newline at end of file
