Vergleich inc/functions_upload.php - 1.8.1 - 1.8.7

  Keine Änderungen   Hinzugefügt   Modifiziert   Entfernt
Zeile 204Zeile 204
	}

// Check we have a valid extension

	}

// Check we have a valid extension

	// This is attached to the attachment types allowed to be uploaded (set in the ACP)
$valid_extensions = array();
$extensions = $cache->read("attachtypes");

foreach($extensions as $ext => $type)
{
if(substr($type['mimetype'], 0, 5) == 'image')
{
$valid_extensions[$ext] = 1;
}
}

$ext = get_extension(my_strtolower($avatar['name']));

if(!isset($valid_extensions[$ext]))
{
$ret['error'] = $lang->error_avatartype;
return $ret;
}

    	$ext = get_extension(my_strtolower($avatar['name']));
if(!preg_match("#^(gif|jpg|jpeg|jpe|bmp|png)$#i", $ext))
{
$ret['error'] = $lang->error_avatartype;
return $ret;
}















if(defined('IN_ADMINCP'))
{


if(defined('IN_ADMINCP'))
{

Zeile 280Zeile 267
				}
else
{

				}
else
{

 
					// Copy scaled image to CDN
copy_file_to_cdn($avatarpath . '/' . $thumbnail['filename']);

					// Reset filesize
$avatar['size'] = filesize($avatarpath."/".$filename);
// Reset dimensions

					// Reset filesize
$avatar['size'] = filesize($avatarpath."/".$filename);
// Reset dimensions

Zeile 483Zeile 472
			if(!@is_dir($mybb->settings['uploadspath']."/".$month_dir))
{
$month_dir = '';

			if(!@is_dir($mybb->settings['uploadspath']."/".$month_dir))
{
$month_dir = '';

 
			}
else
{
$index = @fopen($mybb->settings['uploadspath']."/".$month_dir."/index.html", 'w');
@fwrite($index, "<html>\n<head>\n<title></title>\n</head>\n<body>\n&nbsp;\n</body>\n</html>");
@fclose($index);

			}
}
}

			}
}
}

Zeile 611Zeile 606
	if($forumpermissions['modattachments'] == 1 && !is_moderator($forum['fid'], "canapproveunapproveattachs"))
{
$attacharray['visible'] = 0;

	if($forumpermissions['modattachments'] == 1 && !is_moderator($forum['fid'], "canapproveunapproveattachs"))
{
$attacharray['visible'] = 0;

	}
else
{

	}
else
{

		$attacharray['visible'] = 1;
}


		$attacharray['visible'] = 1;
}


Zeile 665Zeile 660
 */
function delete_uploaded_file($path = '')
{

 */
function delete_uploaded_file($path = '')
{

	global $mybb;

	global $mybb, $plugins;


$deleted = false;



$deleted = false;


Zeile 674Zeile 669
	$cdn_base_path = rtrim($mybb->settings['cdnpath'], '/');
$path = ltrim($path, '/');
$cdn_path = realpath($cdn_base_path . '/' . $path);

	$cdn_base_path = rtrim($mybb->settings['cdnpath'], '/');
$path = ltrim($path, '/');
$cdn_path = realpath($cdn_base_path . '/' . $path);



 

if($mybb->settings['usecdn'] && !empty($cdn_base_path))
{
$deleted = $deleted && @unlink($cdn_path);


if($mybb->settings['usecdn'] && !empty($cdn_base_path))
{
$deleted = $deleted && @unlink($cdn_path);

	}









	}

$hook_params = array(
'path' => &$path,
'deleted' => &$deleted,
);

$plugins->run_hooks('delete_uploaded_file', $hook_params);


	return $deleted;
}

/**
* Delete an upload directory on both the local filesystem and the CDN filesystem.

	return $deleted;
}

/**
* Delete an upload directory on both the local filesystem and the CDN filesystem.

 *

 *

 * @param string $path The directory to delete.
*
* @return bool Whether the directory was deleted.
*/
function delete_upload_directory($path = '')

 * @param string $path The directory to delete.
*
* @return bool Whether the directory was deleted.
*/
function delete_upload_directory($path = '')

{
global $mybb;

$deleted = false;


{
global $mybb, $plugins;

$deleted = false;


	$deleted = @rmdir($path);

	$deleted = @rmdir($path);





	$cdn_base_path = rtrim($mybb->settings['cdnpath'], '/');
$path = ltrim($path, '/');

	$cdn_base_path = rtrim($mybb->settings['cdnpath'], '/');
$path = ltrim($path, '/');

	$cdn_path = rtrim(realpath($cdn_base_path . '/' . $path), '/');

if($mybb->settings['usecdn'] && !empty($cdn_base_path))

	$cdn_path = rtrim(realpath($cdn_base_path . '/' . $path), '/');

if($mybb->settings['usecdn'] && !empty($cdn_base_path))

	{
$deleted = $deleted && @rmdir($cdn_path);
}

	{
$deleted = $deleted && @rmdir($cdn_path);
}

 

$hook_params = array(
'path' => &$path,
'deleted' => &$deleted,
);

$plugins->run_hooks('delete_upload_directory', $hook_params);


return $deleted;
}


return $deleted;
}

Zeile 724Zeile 732
	global $plugins, $mybb;

$upload = array();

	global $plugins, $mybb;

$upload = array();





	if(empty($file['name']) || $file['name'] == "none" || $file['size'] < 1)

	if(empty($file['name']) || $file['name'] == "none" || $file['size'] < 1)

	{

	{

		$upload['error'] = 1;
return $upload;
}

if(!$filename)

		$upload['error'] = 1;
return $upload;
}

if(!$filename)

	{

	{

		$filename = $file['name'];

		$filename = $file['name'];

	}


	}


	$upload['original_filename'] = preg_replace("#/$#", "", $file['name']); // Make the filename safe
$filename = preg_replace("#/$#", "", $filename); // Make the filename safe
$moved = @move_uploaded_file($file['tmp_name'], $path."/".$filename);


	$upload['original_filename'] = preg_replace("#/$#", "", $file['name']); // Make the filename safe
$filename = preg_replace("#/$#", "", $filename); // Make the filename safe
$moved = @move_uploaded_file($file['tmp_name'], $path."/".$filename);


	$moved_cdn = false;
$cdn_base_path = rtrim($mybb->settings['cdnpath'], '/');
$cdn_path = rtrim(realpath($cdn_base_path . '/' . $path), '/');

if($mybb->settings['usecdn'] && !empty($cdn_base_path))
{
$moved_cdn = @copy($path . '/' . $filename, $cdn_path . '/' . $filename);
@my_chmod($cdn_path . '/' . $filename, '0644');
}

	$cdn_path = '';

$moved_cdn = copy_file_to_cdn($path."/".$filename, $cdn_path);








if(!$moved)
{


if(!$moved)
{