XILO Community Forum

Support 03333 407 407 • Sales 0800 084 2421 • sales chat

Go Back   XILO Community Forum > Customer Support > Support Queries > core.* file problems.
Support Queries This forum should be used to contact XILO's support team should you have any problems with your account.

Closed Thread
 
LinkBack Thread Tools Display Modes
  (#21 (permalink)) Old
Techie & Moderator
Kieran is on a distinguished road
 
Kieran's Avatar
 
Posts: 753
Join Date: Apr 2006
Location: Swindon, UK
Default Re: core.* file problems. - 18/05/2006, 1:30 AM

No problem GibMonkey - anytime

Tom, the upload is the attachment mod for phpBB. The "business" end of the uploader seems to be the following code, although its hard to say where exactly it is failing as the error message presented is one built into the mod, not a pure one thrown out from php.

Code:
// Upload Attachment
			if (!$error) 
			{
				if (!(intval($attach_config['allow_ftp_upload'])))
				{
					// Descide the Upload method
					$ini_val = ( phpversion() >= '4.0.0' ) ? 'ini_get' : 'get_cfg_var';
		
					$safe_mode = @$ini_val('safe_mode');

					if (@$ini_val('open_basedir'))
					{
						if (@phpversion() < '4.0.3')
						{
							$upload_mode = 'copy';
						}
						else
						{
							$upload_mode = 'move';
						}
					}
					else if (@$ini_val('safe_mode'))
					{
						$upload_mode = 'move';
					}
					else
					{
						$upload_mode = 'copy';
					}
				}
				else
				{
					$upload_mode = 'ftp';
				}

				// Ok, upload the Attachment
				if (!$error)
				{
					$this->move_uploaded_attachment($upload_mode, $file);
				}
			}

// Copy the temporary attachment to the right location (copy, move_uploaded_file or ftp)
	function move_uploaded_attachment($upload_mode, $file)
	{
		global $error, $error_msg, $lang, $upload_dir;

		if (!is_uploaded_file($file))
		{
			message_die(GENERAL_ERROR, 'Unable to upload file. The given source has not been uploaded.', __LINE__, __FILE__);
		}

		switch ($upload_mode)
		{
			case 'copy':
				
				if (!@copy($file, $upload_dir . '/' . basename($this->attach_filename)))
				{
					if (!@move_uploaded_file($file, $upload_dir . '/' . basename($this->attach_filename))) 
					{
						$error = TRUE;
						if(!empty($error_msg))
						{
							$error_msg .= '<br />';
						}
						$error_msg .= sprintf($lang['General_upload_error'], './' . $upload_dir . '/' . $this->attach_filename);
						return;
					}
				} 
				@chmod($upload_dir . '/' . basename($this->attach_filename), 0666);

			break;

			case 'move':

				if (!@move_uploaded_file($file, $upload_dir . '/' . basename($this->attach_filename)))
				{ 
					if (!@copy($file, $upload_dir . '/' . basename($this->attach_filename)))
					{
						$error = TRUE;
						if(!empty($error_msg))
						{
							$error_msg .= '<br />';
						}
						$error_msg .= sprintf($lang['General_upload_error'], './' . $upload_dir . '/' . $this->attach_filename);
						return;
					}
				} 
				@chmod($upload_dir . '/' . $this->attach_filename, 0666);

			break;

			case 'ftp':
				ftp_file($file, basename($this->attach_filename), $this->type);
			break;
		}

		if (!$error && $this->thumbnail == 1)
		{
			if ($upload_mode == 'ftp')
			{
				$source = $file;
				$dest_file = THUMB_DIR . '/t_' . basename($this->attach_filename);
			}
			else
			{
				$source = $upload_dir . '/' . basename($this->attach_filename);
				$dest_file = amod_realpath($upload_dir);
				$dest_file .= '/' . THUMB_DIR . '/t_' . basename($this->attach_filename);
			}

			if (!create_thumbnail($source, $dest_file, $this->type))
			{
				if (!$file || !create_thumbnail($file, $dest_file, $this->type))
				{
					$this->thumbnail = 0;
				}
			}
		}
	}
The ftp functions are not the ones being used here.

Thanks for your help
  (#22 (permalink)) Old
Techie & Moderator
Kieran is on a distinguished road
 
Kieran's Avatar
 
Posts: 753
Join Date: Apr 2006
Location: Swindon, UK
Default Re: core.* file problems. - 19/05/2006, 1:38 AM

This has now been resolved by enabling register_globals which shouldn't be required - strange world, lol Thanks for the assistance
  (#23 (permalink)) Old
XILO Staff
Matt is on a distinguished road
 
Matt's Avatar
 
Posts: 694
Join Date: Nov 2005
Default Re: core.* file problems. - 19/05/2006, 1:45 AM

Glad to hear it Kieran.

Thanks for letting us know.

Matt


XILO Communications Ltd.
Internet Hosting and Online Services
w: http://www.xilo.net/
h:
http://my.xilo.net/
t: +44 (0) 845 034 6444
f: +44 (0) 845 034 6555
Closed Thread


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
File query Simon Support Queries 9 12/07/2007 1:39 PM
FTP upload file size mcoops Support Queries 1 30/01/2007 5:49 PM
Permissions on a config file iain2_uk Support Queries 3 17/07/2006 6:46 PM


Powered by vBulletin | XHTML | © Copyright 2003-2008 XILO Communications Ltd. All rights reserved. E&OE