Browse Source

Fixes

master
M@d D3n 7 years ago
parent
commit
361eb3e8e0
  1. 42
      gallery/class.gallery.php

42
gallery/class.gallery.php

@ -56,6 +56,36 @@ class Gallery
*/
var $admin_size = 'c100x100';
/**
* Creates directory
*
* @param string $path Path to create
* @param integer $mode Optional permissions
* @return boolean Success
*/
function _mkdir($path, $mode = 0777)
{
$old = umask(0);
$res = @mkdir($path, $mode);
umask($old);
return $res;
}
/**
* Creates directories recursively
*
* @param string $path Path to create
* @param integer $mode Optional permissions
* @return boolean Success
*/
function rmkdir($path, $mode = 0777)
{
return is_dir($path) || (mkdir(dirname($path), $mode) && $this->_mkdir($path, $mode));
}
/**
* ВНЕШНИЕ МЕТОДЫ
*/
@ -415,8 +445,9 @@ class Gallery
if (!empty($_REQUEST['fromfolder']) && $_REQUEST['fromfolder'] == 1)
{
$src_dir = BASE_DIR . '/' . UPLOAD_GALLERY_DIR . '/.temp/';
if (!file_exists($src_dir . '/') && !rmkdir($src_dir . '/', 0777))
$src_dir = BASE_DIR . '/' . trim(UPLOAD_GALLERY_DIR, '/') . '/.temp/';
if (! file_exists($src_dir) && ! mkdir($src_dir, 0777, true))
{
header('Location:index.php?do=modules&action=modedit&mod=gallery&moduleaction=1');
exit;
@ -482,16 +513,19 @@ class Gallery
}
closedir($handle);
}
}else if (!empty($_REQUEST['fromuploader']) && $_REQUEST['fromuploader'] == 1)
}
else if (!empty($_REQUEST['fromuploader']) && $_REQUEST['fromuploader'] == 1)
{
$src_dir = BASE_DIR . '/' . UPLOAD_GALLERY_DIR . '/.uploader/' . $_SESSION['user_id'];
if (!file_exists($src_dir . '/') && !rmkdir($src_dir . '/', 0777))
if (! file_exists($src_dir . '/') && ! mkdir($src_dir . '/', 0777, true))
{
header('Location:index.php?do=modules&action=modedit&mod=gallery&moduleaction=1');
exit;
}
$htaccess_file = $src_dir . '/' . '.htaccess';
if (!file_exists($htaccess_file))
{
$fp = @fopen($htaccess_file, 'w+');

Loading…
Cancel
Save