Index: branches/2.8.x/CHANGELOG
===================================================================
--- branches/2.8.x/CHANGELOG	(revision 1818)
+++ branches/2.8.x/CHANGELOG	(revision 1819)
@@ -13,6 +13,9 @@
 
 
 
+16 Nov-2012 Build 1819 Dietmar Woellbrink (Luisehahne)
+# bugfix media, Undefined index /admin/media/upload.php on line 108
+- removed obselete resize_img.php
 16 Nov-2012 Build 1818 Dietmar Woellbrink (Luisehahne)
 # bugfix Ticket 10 usergroup show homefolder in media
 ! update users, create username homefolder in media/homefolders
Index: branches/2.8.x/wb/admin/media/resize_img.php
===================================================================
--- branches/2.8.x/wb/admin/media/resize_img.php	(revision 1818)
+++ branches/2.8.x/wb/admin/media/resize_img.php	(nonexistent)
@@ -1,286 +0,0 @@
-<?php
-/**
- *
- * @category        admin
- * @package         admintools
- * @author          WebsiteBaker Project
- * @copyright       2004-2009, Ryan Djurovich
- * @copyright       2009-2011, Website Baker Org. e.V.
- * @link			http://www.websitebaker2.org/
- * @license         http://www.gnu.org/licenses/gpl.html
- * @platform        WebsiteBaker 2.8.x
- * @requirements    PHP 5.2.2 and higher
- * @version         $Id$
- * @filesource		$HeadURL:  $
- * @lastmodified    $Date:  $
- *
- */
-
-	/**
-	 * Image Resizer. 
-	 * @author : Harish Chauhan
-	 * @copyright : Freeware
-	 * About :This PHP script will resize the given image and can show on the fly or save as image file.
-	 *
-	 */
-	
-
-	define("HAR_AUTO_NAME",1);	
-	Class RESIZEIMAGE
-	{
-		var $imgFile="";
-		var $imgWidth=0;
-		var $imgHeight=0;
-		var $imgType="";
-		var $imgAttr="";
-		var $type=NULL;
-		var $_img=NULL;
-		var $_error="";
-		
-		/**
-		 * Constructor
-		 *
-		 * @param [String $imgFile] Image File Name
-		 * @return RESIZEIMAGE (Class Object)
-		 */
-		
-		function RESIZEIMAGE($imgFile="")
-		{
-			if (!function_exists("imagecreate"))
-			{
-				$this->_error="Error: GD Library is not available.";
-				return false;
-			}
-
-			$this->type=Array(1 => 'GIF', 2 => 'JPG', 3 => 'PNG', 4 => 'SWF', 5 => 'PSD', 6 => 'BMP', 7 => 'TIFF', 8 => 'TIFF', 9 => 'JPC', 10 => 'JP2', 11 => 'JPX', 12 => 'JB2', 13 => 'SWC', 14 => 'IFF', 15 => 'WBMP', 16 => 'XBM');
-			if(!empty($imgFile))
-				$this->setImage($imgFile);
-		}
-		/**
-		 * Error occured while resizing the image.
-		 *
-		 * @return String 
-		 */
-		function error()
-		{
-			return $this->_error;
-		}
-		
-		/**
-		 * Set image file name
-		 *
-		 * @param String $imgFile
-		 * @return void
-		 */
-		function setImage($imgFile)
-		{
-			$this->imgFile=$imgFile;
-			return $this->_createImage();
-		}
-		/**
-		 * 
-		 * @return void
-		 */
-		function close()
-		{
-			return @imagedestroy($this->_img);
-		}
-		/**
-		 * Resize a image to given width and height and keep it's current width and height ratio
-		 * 
-		 * @param Number $imgwidth
-		 * @param Numnber $imgheight
-		 * @param String $newfile
-		 */
-		function resize_limitwh($imgwidth,$imgheight,$newfile=NULL)
-		{
-			$image_per = 100;
-			list($width, $height, $type, $attr) = @getimagesize($this->imgFile);
-			if($width > $imgwidth && $imgwidth > 0)
-				$image_per = (double)(($imgwidth * 100) / $width);
-
-			if(floor(($height * $image_per)/100)>$imgheight && $imgheight > 0)
-				$image_per = (double)(($imgheight * 100) / $height);
-
-			$this->resize_percentage($image_per,$newfile);
-
-		}
-		/**
-		 * Resize an image to given percentage.
-		 *
-		 * @param Number $percent
-		 * @param String $newfile
-		 * @return Boolean
-		 */
-		function resize_percentage($percent=100,$newfile=NULL)
-		{
-			$newWidth=($this->imgWidth*$percent)/100;
-			$newHeight=($this->imgHeight*$percent)/100;
-			return $this->resize($newWidth,$newHeight,$newfile);
-		}
-		/**
-		 * Resize an image to given X and Y percentage.
-		 *
-		 * @param Number $xpercent
-		 * @param Number $ypercent
-		 * @param String $newfile
-		 * @return Boolean
-		 */
-		function resize_xypercentage($xpercent=100,$ypercent=100,$newfile=NULL)
-		{
-			$newWidth=($this->imgWidth*$xpercent)/100;
-			$newHeight=($this->imgHeight*$ypercent)/100;
-			return $this->resize($newWidth,$newHeight,$newfile);
-		}
-		
-		/**
-		 * Resize an image to given width and height
-		 *
-		 * @param Number $width
-		 * @param Number $height
-		 * @param String $newfile
-		 * @return Boolean
-		 */
-		function resize($width,$height,$newfile=NULL)
-		{
-			if(empty($this->imgFile))
-			{
-				$this->_error="File name is not initialised.";
-				return false;
-			}
-			if($this->imgWidth<=0 || $this->imgHeight<=0)
-			{
-				$this->_error="Could not resize given image";
-				return false;
-			}
-			if($width<=0)
-				$width=$this->imgWidth;
-			if($height<=0)
-				$height=$this->imgHeight;
-				
-			return $this->_resize($width,$height,$newfile);
-		}
-		
-		/**
-		 * Get the image attributes
-		 * @access Private
-		 * 		
-		 */
-		function _getImageInfo()
-		{
-			@list($this->imgWidth,$this->imgHeight,$type,$this->imgAttr)=@getimagesize($this->imgFile);
-			$this->imgType=$this->type[$type];
-		}
-		
-		/**
-		 * Create the image resource 
-		 * @access Private
-		 * @return Boolean
-		 */
-		function _createImage()
-		{
-			$this->_getImageInfo($this->imgFile);
-			if($this->imgType=='GIF')
-			{
-				$this->_img=@imagecreatefromgif($this->imgFile);
-			}
-			elseif($this->imgType=='JPG')
-			{
-				$this->_img=@imagecreatefromjpeg($this->imgFile);
-			}
-			elseif($this->imgType=='PNG')
-			{
-				$this->_img=@imagecreatefrompng($this->imgFile);
-			}			
-			if(!$this->_img || !@is_resource($this->_img))
-			{
-				$this->_error="Error loading ".$this->imgFile;
-				return false;
-			}
-			return true;
-		}
-		
-		/**
-		 * Function is used to resize the image
-		 * 
-		 * @access Private
-		 * @param Number $width
-		 * @param Number $height
-		 * @param String $newfile
-		 * @return Boolean
-		 */
-		function _resize($width,$height,$newfile=NULL)
-		{
-			if (!function_exists("imagecreate"))
-			{
-				$this->_error="Error: GD Library is not available.";
-				return false;
-			}
-
-			$newimg=@imagecreatetruecolor($width,$height);
-			//imagecolortransparent( $newimg, imagecolorat( $newimg, 0, 0 ) );
-			
-			if($this->imgType=='GIF' || $this->imgType=='PNG')
-			{
-				/** Code to keep transparency of image **/
-				$colorcount = imagecolorstotal($this->_img);
-				if ($colorcount == 0) $colorcount = 256;
-				imagetruecolortopalette($newimg,true,$colorcount);
-				imagepalettecopy($newimg,$this->_img);
-				$transparentcolor = imagecolortransparent($this->_img);
-				imagefill($newimg,0,0,$transparentcolor);
-				imagecolortransparent($newimg,$transparentcolor); 
-			}
-
-			@imagecopyresampled ( $newimg, $this->_img, 0,0,0,0, $width, $height, $this->imgWidth,$this->imgHeight);
-			
-
-
-			if($newfile===HAR_AUTO_NAME)
-			{
-				if(@preg_match("/\..*+$/",@basename($this->imgFile),$matches))
-			   		$newfile=@substr_replace($this->imgFile,"_har",-@strlen($matches[0]),0);			
-			}
-			elseif(!empty($newfile))
-			{
-				if(!@preg_match("/\..*+$/",@basename($newfile)))
-				{
-					if(@preg_match("/\..*+$/",@basename($this->imgFile),$matches))
-					   $newfile=$newfile.$matches[0];
-				}
-			}
-
-			if($this->imgType=='GIF')
-			{
-				if(!empty($newfile))
-					@imagegif($newimg,$newfile);
-				else
-				{
-					@header("Content-type: image/gif");
-					@imagegif($newimg);
-				}
-			}
-			elseif($this->imgType=='JPG')
-			{
-				if(!empty($newfile))
-					@imagejpeg($newimg,$newfile,85);
-				else
-				{
-					@header("Content-type: image/jpeg");
-					@imagejpeg($newimg);
-				}
-			}
-			elseif($this->imgType=='PNG')
-			{
-				if(!empty($newfile))
-					@imagepng($newimg,$newfile);
-				else
-				{
-					@header("Content-type: image/png");
-					@imagepng($newimg);
-				}
-			}
-			@imagedestroy($newimg);
-		}
-	}
-?>
\ No newline at end of file

Property changes on: branches/2.8.x/wb/admin/media/resize_img.php
___________________________________________________________________
Deleted: svn:executable
## -1 +0,0 ##
-*
\ No newline at end of property
Deleted: svn:keywords
## -1 +0,0 ##
-Id
\ No newline at end of property
Index: branches/2.8.x/wb/admin/media/setparameter.php
===================================================================
--- branches/2.8.x/wb/admin/media/setparameter.php	(revision 1818)
+++ branches/2.8.x/wb/admin/media/setparameter.php	(revision 1819)
@@ -123,7 +123,7 @@
 	if (isset($pathsettings[$safepath]['height'])){ $cur_height = $pathsettings[$safepath]['height'];}
 	$cur_width = ($cur_width ? (int)$cur_width : '');
 	$cur_height = ($cur_height ? (int)$cur_height : '');
-//
+// check for user homefolder
     $bPathCanEdit = (preg_match('/'.$currentHome.'/i', $safepath)) ? true : false;
 
 //	if($row_bg_color == 'DEDEDE') $row_bg_color = 'EEEEEE';
@@ -132,6 +132,7 @@
 
 	$template->set_var(array(
 					'ADMIN_URL' => ADMIN_URL,
+					'THEME_URL' => THEME_URL,
 					'PATH_NAME' => $relative,
 					'WIDTH' => $TEXT['WIDTH'],
 					'HEIGHT' => $TEXT['HEIGHT'],
@@ -138,6 +139,7 @@
 					'FIELD_NAME_W' => $safepath.'-w',
 					'FIELD_NAME_H' => $safepath.'-h',
 					'CAN_EDIT_CLASS' => ($bPathCanEdit==false) ? '' : 'bold',
+					'SHOW_EDIT_CLASS' => ($bPathCanEdit==false) ? 'hide' : '',
 					'READ_ONLY_DIR' => ($bPathCanEdit==false) ? ' readonly="readonly"' : '',
 					'CUR_HEIGHT' => $cur_height,
 					'CUR_WIDTH' => $cur_width,
Index: branches/2.8.x/wb/admin/media/thumbs.php
===================================================================
--- branches/2.8.x/wb/admin/media/thumbs.php	(revision 1818)
+++ branches/2.8.x/wb/admin/media/thumbs.php	(revision 1819)
@@ -15,7 +15,15 @@
  *
  */
 
-require('../../config.php');
+if(!defined('WB_URL'))
+{
+    $config_file = realpath('../../config.php');
+    if(file_exists($config_file) && !defined('WB_URL'))
+    {
+    	require($config_file);
+    }
+}
+//if(!class_exists('admin', false)){ include(WB_PATH.'/framework/class.admin.php'); }
 $modulePath = dirname(__FILE__);
 
 /*
@@ -35,12 +43,13 @@
 	$thumb = PhpThumbFactory::create(WB_PATH.MEDIA_DIRECTORY.'/'.$image);
 
 	if ($type == 1) {
+        $thumb->adaptiveResize(20,20);
+//        $thumb->resize(30,30);
 //		$thumb->cropFromCenter(80,50);
-        $thumb->resize(30,30);
 // 		$thumb->resizePercent(40);
 	} else {
-    	$thumb->resize(250,250);
-// 		$thumb->resizePercent(50);
+//    	$thumb->adaptiveResize(250,250);
+ 		$thumb->resizePercent(30);
 //		$thumb->cropFromCenter(80,50);
 	}
 	$thumb->show();
Index: branches/2.8.x/wb/admin/media/parameters.php
===================================================================
--- branches/2.8.x/wb/admin/media/parameters.php	(revision 1818)
+++ branches/2.8.x/wb/admin/media/parameters.php	(revision 1819)
@@ -3,8 +3,8 @@
  *
  * @category        admin
  * @package         media
- * @author          Ryan Djurovich, WebsiteBaker Project
- * @copyright       2009-2011, Website Baker Org. e.V.
+ * @author          Ryan Djurovich (2004-2009), WebsiteBaker Project
+ * @copyright       2009-2012, WebsiteBaker Org. e.V.
  * @link			http://www.websitebaker2.org/
  * @license         http://www.gnu.org/licenses/gpl.html
  * @platform        WebsiteBaker 2.8.x
@@ -34,4 +34,3 @@
 		$database->query ( "INSERT INTO ".TABLE_PREFIX."settings (`name`,`value`) VALUES ('mediasettings','')" );
 	}
 }
-
Index: branches/2.8.x/wb/admin/media/upload.php
===================================================================
--- branches/2.8.x/wb/admin/media/upload.php	(revision 1818)
+++ branches/2.8.x/wb/admin/media/upload.php	(revision 1819)
@@ -15,13 +15,21 @@
  *
  */
 
-// Print admin header
-require('../../config.php');
-include_once('resize_img.php');
-include_once('parameters.php');
+if(!defined('WB_URL'))
+{
+    $config_file = realpath('../../config.php');
+    if(file_exists($config_file) && !defined('WB_URL'))
+    {
+    	require($config_file);
+    }
+}
+if(!class_exists('admin', false)){ include(WB_PATH.'/framework/class.admin.php'); }
 
-require_once(WB_PATH.'/framework/class.admin.php');
-// require_once(WB_PATH.'/include/pclzip/pclzip.lib.php');	// Required to unzip file.
+$modulePath = dirname(__FILE__);
+
+//include_once('resize_img.php');
+include_once($modulePath.'/parameters.php');
+
 // suppress to print the header, so no new FTAN will be set
 $admin = new admin('Media', 'media_upload', false);
 
@@ -57,12 +65,14 @@
 // Find out whether we should replace files or give an error
 $overwrite = ($admin->get_post('overwrite') != '') ? true : false;
 
+$file_extension_string = '';
 // Get list of file types to which we're supposed to append 'txt'
-$get_result=$database->query("SELECT value FROM ".TABLE_PREFIX."settings WHERE name='rename_files_on_upload' LIMIT 1");
-$file_extension_string='';
-if ($get_result->numRows()>0) {
-	$fetch_result=$get_result->fetchRow();
-	$file_extension_string=$fetch_result['value'];
+$sql = 'SELECT ´value´ FROM ´'.TABLE_PREFIX. 'settings´ '.
+       'WHERE ´name´=\'rename_files_on_upload\'';
+
+if($oRes = $database->query($sql)) {
+    $aResult = $oRes->fetchRow(MYSQL_ASSOC);
+    $file_extension_string = $aResult['value'];
 }
 
 $file_extensions=explode(",",$file_extension_string);
@@ -104,12 +114,33 @@
 				}
 			}
 
+
 			if(file_exists($relative.$filename)) {
-				if ($pathsettings[$resizepath]['width'] || $pathsettings[$resizepath]['height'] ) {
-					$rimg=new RESIZEIMAGE($relative.$filename);
-					$rimg->resize_limitwh($pathsettings[$resizepath]['width'],$pathsettings[$resizepath]['height'],$relative.$filename);
-					$rimg->close();
+
+                $ImgWidth  = isset($pathsettings[$resizepath]['width'])  ? intval($pathsettings[$resizepath]['width'])  : null;
+                $ImgHeigth = isset($pathsettings[$resizepath]['height']) ? intval($pathsettings[$resizepath]['height']) : null;
+
+				if ($ImgWidth!=null || $ImgHeigth!=null ) {
+                    if(!class_exists('PhpThumbFactory', false)){ include($modulePath.'/inc/ThumbLib.inc.php'); }
+                	$oImage = PhpThumbFactory::create($relative.$filename);
+                    $aOldSize = $oImage->getCurrentDimensions();
+                    $ImgPercent = 50;
+
+    				if ($ImgWidth!=null && $ImgHeigth==null ) {
+                        $ImgPercent =  $ImgWidth*100/$aOldSize['width'];
+                        $ImgHeigth = $ImgWidth;
+                    } elseif( $ImgWidth==null && $ImgHeigth!=null ) {
+                        $ImgPercent =  $ImgHeigth*100/$aOldSize['height'];
+                        $ImgWidth = $ImgHeigth;
+                    } else {
+                        $ImgPercent = $ImgWidth*100/$aOldSize['width'];
+                    }
+                    $oImage->resize($ImgWidth,$ImgHeigth)->save($relative.$filename);
+//                    $oImage->resizePercent($ImgPercent)->save($relative.$filename);
+//                    $oImage->adaptiveResize($ImgWidth,$ImgHeigth)->save($relative.$filename);
+//                    $oImage->save($relative.$filename);
 				}
+
 			}
 
 			// store file name of first file for possible unzip action
Index: branches/2.8.x/wb/admin/media/index.php
===================================================================
--- branches/2.8.x/wb/admin/media/index.php	(revision 1818)
+++ branches/2.8.x/wb/admin/media/index.php	(revision 1819)
@@ -41,6 +41,14 @@
 // Include the WB functions file
 require_once(WB_PATH.'/framework/functions.php');
 
+// Target location
+$requestMethod = '_'.strtoupper($_SERVER['REQUEST_METHOD']);
+$directory = (isset(${$requestMethod}['dir'])) ? ${$requestMethod}['dir'] : '';
+
+$directory = ($directory == '/') ?  '' : $directory;
+$dirlink = 'index.php?dir='.$directory;
+$rootlink = 'index.php?dir=';
+
 // Get home folder not to show
 $home_folders = get_home_folders();
 
@@ -90,6 +98,7 @@
 $template->set_var(array(
 					'HEADING_BROWSE_MEDIA' => $HEADING['BROWSE_MEDIA'],
 					'HOME_DIRECTORY' => $currentHome,
+//					'HOME_DIRECTORY' => ( $currentHome!='') ? $currentHome : $directory,
 					'DISPLAY_UP_ARROW' => $display_up_arrow, // **!
 					'HEADING_CREATE_FOLDER' => $HEADING['CREATE_FOLDER'],
 					'HEADING_UPLOAD_FILES' => $HEADING['UPLOAD_FILES']
Index: branches/2.8.x/wb/admin/skel/themes/htt/setparameter.htt
===================================================================
--- branches/2.8.x/wb/admin/skel/themes/htt/setparameter.htt	(revision 1818)
+++ branches/2.8.x/wb/admin/skel/themes/htt/setparameter.htt	(revision 1819)
@@ -33,6 +33,7 @@
 .bold { color: #2C50A3; }
 .path-name { width: 65%;}
 tbody.path-option tr th  { font-weight: normal;}
+.show-img { width: 30px; text-align: center;}
 
 </style>
 </head>
@@ -64,6 +65,9 @@
         {HEIGHT}
         <input size="5" type="text" name="{FIELD_NAME_H}" value="{CUR_HEIGHT}"{READ_ONLY_DIR} />
         </td>
+		<td class="show-img" >
+            <img class="{SHOW_EDIT_CLASS}" height="16" width="16" alt="" src="{THEME_URL}/images/resize_16.png" />
+        </td>
 	</tr>
 <!-- END list_block -->
 	<tr>
Index: branches/2.8.x/wb/admin/interface/version.php
===================================================================
--- branches/2.8.x/wb/admin/interface/version.php	(revision 1818)
+++ branches/2.8.x/wb/admin/interface/version.php	(revision 1819)
@@ -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', '1818');
+if(!defined('REVISION')) define('REVISION', '1819');
 if(!defined('SP')) define('SP', '');
