Index: branches/2.8.x/CHANGELOG
===================================================================
--- branches/2.8.x/CHANGELOG	(revision 1650)
+++ branches/2.8.x/CHANGELOG	(revision 1651)
@@ -11,6 +11,9 @@
 ! = Update/Change
 ===============================================================================
 
+26 Mar-2012 Build 1651 Werner v.d.Decken(DarkViper)
+# fixed a little problem with chmod()
++ add argument 'replyTo' into class.wb::mail()
 24 Mar-2012 Build 1650 Werner v.d.Decken(DarkViper)
 + add argument 'replyTo' into class.wb::mail()
 24 Mar-2012 Build 1649 Dietmar Woellbrink (Luisehahne)
Index: branches/2.8.x/wb/admin/skel/themes/htt/addons.htt
===================================================================
--- branches/2.8.x/wb/admin/skel/themes/htt/addons.htt	(revision 1650)
+++ branches/2.8.x/wb/admin/skel/themes/htt/addons.htt	(revision 1651)
@@ -52,19 +52,19 @@
 						</td>
 					</tr>
 					<tr>
-						<td class="description" valign="top"><span class="title">{TXT_THEME_COPY_CURRENT}</span>
-							{TXT_THEME_CURRENT}: {CURRENT_THEME}<br />
-							<i>[{THEME_PATH}]</i><br />
+						<td class="description" valign="top"><hr /><span class="title">{TXT_THEME_COPY_CURRENT}</span>
+							{TXT_THEME_CURRENT}: <b>{CURRENT_THEME}</b><br />
+							<i>[ {THEME_PATH} ]</i><br /><br />
 							{MESSAGE_THEME_COPY_CURRENT}
 							<br style="margin-bottom: 0.5em" />
+							<label for="theme_newname">{TXT_THEME_NEW_NAME}: </label>
 							<input type="text" id="theme_newname" name="ThNewTheme" value="{THEME_DEFAULT_NAME}" />
-							<label for="theme_newname">{TXT_THEME_NEW_NAME}</label>
 							<input type="submit" name="cmdCopyTheme" value="{TXT_THEME_START_COPY}" />
 						</td>
 					</tr>
 					<tr>
-						<td class="description" valign="top"><span class="title">{TXT_THEME_IMPORT_HTT}</span>
-							{TXT_THEME_CURRENT}: {CURRENT_THEME}<br />
+						<td class="description" valign="top"><hr /><span class="title">{TXT_THEME_IMPORT_HTT}</span>
+							{TXT_THEME_CURRENT}: <b>{CURRENT_THEME}</b><br /><br />
 							{MESSAGE_THEME_IMPORT_HTT}
 							<br style="margin-bottom: 0.5em" />
 							<label for="theme_template">{TXT_THEME_SELECT_HTT}</label><br />
Index: branches/2.8.x/wb/admin/interface/version.php
===================================================================
--- branches/2.8.x/wb/admin/interface/version.php	(revision 1650)
+++ branches/2.8.x/wb/admin/interface/version.php	(revision 1651)
@@ -51,5 +51,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.3');
-if(!defined('REVISION')) define('REVISION', '1650');
+if(!defined('REVISION')) define('REVISION', '1651');
 if(!defined('SP')) define('SP', '');
Index: branches/2.8.x/wb/admin/addons/CopyTheme.php
===================================================================
--- branches/2.8.x/wb/admin/addons/CopyTheme.php	(revision 1650)
+++ branches/2.8.x/wb/admin/addons/CopyTheme.php	(revision 1651)
@@ -37,14 +37,14 @@
 		$this->_oDb   = $GLOBALS['database'];
 		$this->_aLang = $GLOBALS['MESSAGE'];
 	// import global Consts
-		$this->_aGlobals['TablePrefix']     = TABLE_PREFIX;
-		$this->_aGlobals['AddonTable']      = 'addons';
-		$this->_aGlobals['SettingsTable']   = 'settings';
+		$this->_aGlobals['TablePrefix']   = TABLE_PREFIX;
+		$this->_aGlobals['AddonTable']    = 'addons';
+		$this->_aGlobals['SettingsTable'] = 'settings';
 
-		$this->_aGlobals['Debug']           = (defined('DEBUG') && DEBUG === true);
-		$this->_aGlobals['IsLinux']         = ((substr(__FILE__, 0, 1)) == '/');
-		$this->_aGlobals['StringDirMode']   = STRING_DIR_MODE;
-		$this->_aGlobals['StringFileMode']  = STRING_FILE_MODE;
+		$this->_aGlobals['Debug']          = (defined('DEBUG') && DEBUG === true);
+		$this->_aGlobals['IsLinux']        = ((substr(__FILE__, 0, 1)) == '/');
+		$this->_aGlobals['DirMode']       = octdec(STRING_DIR_MODE);
+		$this->_aGlobals['FileMode']      = octdec(STRING_FILE_MODE);
 	}
 /**
  * start copy current theme into a new theme
@@ -153,8 +153,10 @@
 			}
 			natsort($aFileList);
 		}catch(Exeption $e) {
-			$msg  = 'CopyTheme::_copyTree => '.$this->_aLang['GENERIC_FAILED_COMPARE'];
-			$msg .= '<br />'.$e->getMessage();
+			$msg  = $this->_aLang['GENERIC_FAILED_COMPARE'];
+			if($this->_aGlobals['Debug']) {
+				$msg .= '<br />'.__CLASS__.'::'.__METHOD__. '<br />'.$e->getMessage();
+			}
 			$this->_setError($msg);
 			$bRetval = false;
 		}
@@ -181,9 +183,13 @@
 			$sNewDir = $this->_sThemesBasePath.'/'.$this->_sNewThemeDir.$sDir;
 			if(!file_exists($sNewDir) &&  mkdir($sNewDir, 0777, true)) {
 				if($this->_aGlobals['IsLinux']) {
-					if(!chmod($sNewDir, $this->_aGlobals['StringDirMode'])) {
-						$sMsg = 'CopyTheme::createDirs::chmod('.$sNewDir.') >> '
-								.$this->_aLang['GENERIC_FAILED_COMPARE'];
+					if(!chmod($sNewDir, $this->_aGlobals['DirMode'])) {
+						$sMsg = $this->_aLang['UPLOAD_ERR_CANT_WRITE'].' ['.$sNewDir.']';
+						if($this->_aGlobals['Debug']) {
+							$sMsg .= '<br />'.__CLASS__.'::'.__METHOD__.'::'
+								 . 'chmod(\''.$sNewDir.$_sThemePath.$sFile.'\', '
+								 . decoct($this->_aGlobals['DirMode']).')';
+						}
 						$this->_setError($sMsg);
 						$bRetval = false;
 						break;
@@ -190,8 +196,11 @@
 					}
 				}
 			}else {
-				$sMsg = 'CopyTheme::createDirs::mkdir('.$sNewDir.') >> '
-						.$this->_aLang['GENERIC_FAILED_COMPARE'];
+				$sMsg = $this->_aLang['GENERIC_FAILED_COMPARE'].' ['.$sFile.']';
+				if($this->_aGlobals['Debug']) {
+					$sMsg .= '<br />'.__CLASS__.'::'.__METHOD__.'::'
+						 . 'mkdir(\''.$sNewDir.'\', 0777, true)';
+				}
 				$this->_setError($sMsg);
 				$bRetval = false;
 				break;
@@ -211,9 +220,13 @@
 		foreach($aFileList as $sFile) {
 			if(copy($sSourceDir.$sFile, $sDestinationDir.$sFile)) {
 				if($this->_aGlobals['IsLinux']) {
-					if(!chmod($sDestinationDir.$sFile, $this->_aGlobals['StringFileMode'])) {
-						$sMsg = 'CopyTheme::copyFiles::chmod('.$sDestinationDir.$sFile.') >> '
-								.$this->_aLang['GENERIC_FAILED_COMPARE'];
+					if(!chmod($sDestinationDir.$sFile, $this->_aGlobals['FileMode'])) {
+						$sMsg = $this->_aLang['GENERIC_FAILED_COMPARE'].' ['.$sFile.']';
+						if($this->_aGlobals['Debug']) {
+							$sMsg .= '<br />'.__CLASS__.'::'.__METHOD__.'::'
+								  . 'chmod(\''.$sDestinationDir.$sFile.'\', '
+								  .decoct($this->_aGlobals['FileMode']).', true)';
+						}
 						$this->_setError($sMsg);
 						$bRetval = false;
 						break;
@@ -220,8 +233,12 @@
 					}
 				}
 			}else {
-				$sMsg = 'CopyTheme::copyFiles::copy('.$sDestinationDir.$sFile.') >> '
-						.$this->_aLang['GENERIC_FAILED_COMPARE'];
+				$sMsg = $this->_aLang['GENERIC_FAILED_COMPARE'].' ['.$sFile.']';
+				if($this->_aGlobals['Debug']) {
+					$sMsg .= '<br />'.__CLASS__.'::'.__METHOD__.'::'
+						  . 'copy(\''.$sSourceDir.$sFile.'\', '
+					      . '\''.$sDestinationDir.$sFile.'\')';
+				}
 				$this->_setError($sMsg);
 				$bRetval = false;
 				break;
@@ -249,9 +266,11 @@
 		     .     '`author`=\''.mysql_real_escape_string($aVariables['author']).'\', '
 		     .     '`license`=\''.mysql_real_escape_string($aVariables['license']).'\'';
 		if(!$this->_oDb->query($sql)) {
-			$sMsg = 'CopyTheme::registerNewTheme('.$this->_sNewThemeName.') >> '
-			        .$this->_aLang['GENERIC_NOT_UPGRADED'];
-			$sMsg .= (($this->_aGlobals['Debug']) ? '<br />'.$this->_oDb->get_error() : '');
+
+			$sMsg = $this->_aLang['GENERIC_NOT_UPGRADED'].' ['.$this->_sNewThemeDir.'/info.php]';
+			if($this->_aGlobals['Debug']) {
+				$sMsg .= '<br />'.__CLASS__.'::'.__METHOD__. '<br />'.$this->_oDb->get_error();
+			}
 			$this->_setError($sMsg);
 			$bRetval = false;
 		}
@@ -270,7 +289,7 @@
 		$aVariables['name']        = $this->_sNewThemeName;
 		$aVariables['version']     = '0.0.1';
 		$aVariables['description'] = '(copy): '.$aVariables['description'];
-		if(file_exists($sThemeInfoFile)) {
+		if(is_writeable($sThemeInfoFile)) {
 			$sInfoContent = file_get_contents($sThemeInfoFile);
 			foreach($aVariables as $key=>$val) {
 				$sSearch  = '/(\$template_'.$key.'\s*=\s*(["\'])).*?(\2)\s*;/s';
@@ -284,8 +303,11 @@
 				return true;
 			}
 		}
-		$this->_setError('CopyTheme::modifyInfoFile('.$this->_sNewThemeDir.'/info.php) >> '
-		               .$this->_aLang['GENERIC_NOT_UPGRADED']);
+		$sMsg = $this->_aLang['GENERIC_NOT_UPGRADED'].' ['.$this->_sNewThemeDir.'/info.php]';
+		if($this->_aGlobals['Debug']) {
+			$sMsg .= '<br />'.__CLASS__.'::'.__METHOD__.'(\''.$sThemeInfoFile.'\')';
+		}
+		$this->_setError($sMsg);
 		return $bRetval;
 	}
 /**
@@ -329,9 +351,10 @@
 		                         'default_theme',
 		                         $value = $this->_sNewThemeDir))
 		{
-			$sMsg = 'CopyTheme::activateTheme('.$this->_sNewThemeName.') >> '
-			        .$this->_aLang['GENERIC_NOT_UPGRADED'];
-			$sMsg .= (($this->_aGlobals['Debug']) ? '<br />'.$this->_oDb->get_error() : '');
+			$sMsg = $this->_aLang['GENERIC_NOT_UPGRADED'];
+			if($this->_aGlobals['Debug']) {
+				$sMsg .= '<br />'.__CLASS__.'::'.__METHOD__. '<br />'.$this->_oDb->get_error();
+			}
 			$this->_setError($sMsg);
 			$bRetval = false;
 		}
Index: branches/2.8.x/wb/admin/addons/CopyThemeHtt.php
===================================================================
--- branches/2.8.x/wb/admin/addons/CopyThemeHtt.php	(revision 1650)
+++ branches/2.8.x/wb/admin/addons/CopyThemeHtt.php	(revision 1651)
@@ -16,9 +16,10 @@
 
 	private static $_sSkelPath  = ''; 
 	private static $_sThemePath = '';
-	private static $_sOs        = '';
+	private static $_IsLinux    = '';
 	private static $_sFileMode  = '';
 	private static $_aLang      = '';
+	private static $_bDebug     = false;
 /**
  * import all needed global constants and variables
  */
@@ -27,8 +28,10 @@
 //		self::$_sSkelPath  = ADMIN_PATH.'/themes/templates/';
 		self::$_sSkelPath  = ADMIN_PATH.'/skel/themes/htt/';
 		self::$_sThemePath = THEME_PATH.'/templates/';
-		self::$_sOs        = OPERATING_SYSTEM;
-		self::$_sFileMode  = STRING_FILE_MODE;
+		self::$_IsLinux    = ((substr(__FILE__, 0, 1)) == '/');
+		self::$_sFileMode  = octdec(STRING_FILE_MODE);
+		self::$_bDebug      = (defined('DEBUG') && DEBUG === true);
+
 		self::$_aLang      = $GLOBALS['MESSAGE'];
 	}
 /**
@@ -59,12 +62,28 @@
 			if(sizeof($aFileList) > 0 ) {
 				foreach($aFileList as $sFile) {
 					$sFile = basename($sFile);
-					if(copy(self::$_sSkelPath.$sFile, self::$_sThemePath.$sFile)) {
-						if(self::$_sOs == 'linux') {
-							chmod(self::$_sThemePath.$sFile, self::$_sFileMode);
+					if(is_writable(self::$_sThemePath) &&
+					   copy(self::$_sSkelPath.$sFile, self::$_sThemePath.$sFile))
+					{
+						if(self::$_IsLinux) {
+							if(!chmod(self::$_sThemePath.$sFile, self::$_sFileMode)) {
+								$msg = self::$_aLang['UPLOAD_ERR_CANT_WRITE'].' ['.$sFile.']';
+								if(self::$_bDebug) {
+									$msg .= __CLASS__.'::'.__METHOD__.'::'
+									     . 'chmod(\'self::'.$_sThemePath.$sFile.'\', '
+									     . decoct(self::$_sFileMode).')';
+								}
+								$aErrors[] = $msg;
+							}
 						}
 					}else {
-						$aErrors[] = self::$_aLang['UPLOAD_ERR_CANT_WRITE'].' ['.$sFile.']';
+						$msg = self::$_aLang['UPLOAD_ERR_CANT_WRITE'].' ['.$sFile.']';
+						if(self::$_bDebug) {
+							$msg .= __CLASS__.'::'.__METHOD__.'::'
+							     . 'copy(\''.self::$_sSkelPath.$sFile.'\', '
+							     . '\''.self::$_sThemePath.$sFile.'\')';
+						}
+						$aErrors[] = $msg;
 					}
 				}
 			}
Index: branches/2.8.x/wb/admin/addons/index.php
===================================================================
--- branches/2.8.x/wb/admin/addons/index.php	(revision 1650)
+++ branches/2.8.x/wb/admin/addons/index.php	(revision 1651)
@@ -106,7 +106,9 @@
 		 . 'WHERE `directory`=\''.DEFAULT_THEME.'\' AND `function`=\'theme\'';
 	$tmp = $database->get_one($sql);
 	$template->set_var('THEME_DEFAULT_NAME', $tmp);
-	$template->set_var('THEME_PATH', THEME_PATH);
+	$template->set_var('CURRENT_THEME', $tmp);
+	$tmp = str_replace(str_replace('\\', '/', WB_PATH), '', str_replace('\\', '/', THEME_PATH));
+	$template->set_var('THEME_PATH', $tmp);
 // end copy current theme
 // start template import
 	include(dirname(__FILE__).'/CopyThemeHtt.php');
Index: branches/2.8.x/wb/framework/functions.php
===================================================================
--- branches/2.8.x/wb/framework/functions.php	(revision 1650)
+++ branches/2.8.x/wb/framework/functions.php	(revision 1651)
@@ -414,28 +414,26 @@
 	return $retVal;
 }
 
-// Function to chmod files and directories
-function change_mode($name)
+/**
+ * Function to chmod files and/or directories
+ * @param string $sName
+ * @param int rights in dec-value. 0= use wb-defaults
+ * @return bool
+ */
+function change_mode($sName, $iMode = 0)
 {
-	if(OPERATING_SYSTEM != 'windows')
-    {
-		// Only chmod if os is not windows
-		if(is_dir($name)) {
-			$mode = OCTAL_DIR_MODE;
-		}else {
-			$mode = OCTAL_FILE_MODE;
+	$bRetval = true;
+	if((substr(__FILE__, 0, 1)) == '/')
+	{ // Only chmod if os is not windows
+		$bRetval = false;
+		if(!$iMode) {
+			$iMode = (is_file($sName) ? octdec(STRING_FILE_MODE) : octdec(STRING_DIR_MODE));
 		}
-		if(file_exists($name)) {
-			$umask = umask(0);
-			chmod($name, $mode);
-			umask($umask);
-			return true;
-		}else {
-			return false;
+		if(is_writable($sName)) {
+			$bRetval = chmod($sName, $iMode);
 		}
-	}else {
-		return true;
 	}
+	return $bRetval;
 }
 
 // Function to figure out if a parent exists
