I’ve implemented a solution for the Safe-Mode problem, as I think it could be solved:
In /admin/functions.php replace this code:
// 1. Check for existing folder
if ( is_dir(WINABSPATH . $defaultpath . $name ) ) {
$suffix = 1;
do {
$alt_name = substr ($name, 0, 200 - ( strlen( $suffix ) + 1 ) ) . "_$suffix";
$dir_check = is_dir(WINABSPATH . $defaultpath . $alt_name );
$suffix++;
} while ( $dir_check );
$name = $alt_name;
}
// define relative path to gallery inside wp root folder
$nggpath = $defaultpath . $name;
// 2. Create new gallery folder
if ( !wp_mkdir_p (WINABSPATH . $nggpath) )
$txt = __('Unable to create directory ', 'nggallery').$nggpath.'!<br />';
// 3. Check folder permission
if ( !is_writeable(WINABSPATH . $nggpath ) )
$txt .= __('Directory', 'nggallery').' <strong>'.$nggpath.'</strong> '.__('is not writeable !', 'nggallery').'<br />';
// 4. Now create thumbnail folder inside
if ( !is_dir(WINABSPATH . $nggpath . '/thumbs') ) {
if ( !wp_mkdir_p ( WINABSPATH . $nggpath . '/thumbs') )
$txt .= __('Unable to create directory ', 'nggallery').' <strong>' . $nggpath . '/thumbs !</strong>';
}
if (SAFE_MODE) {
$help = __('The server setting Safe-Mode is on !', 'nggallery');
$help .= '<br />'.__('If you have problems, please create directory', 'nggallery').' <strong>' . $nggpath . '</strong> ';
$help .= __('and the thumbnails directory', 'nggallery').' <strong>' . $nggpath . '/thumbs</strong> '.__('with permission 777 manually !', 'nggallery');
if ($output) nggGallery::show_message($help);
}
// show a error message
if ( !empty($txt) ) {
if (SAFE_MODE) {
// for safe_mode , better delete folder, both folder must be created manually
@rmdir(WINABSPATH . $nggpath . '/thumbs');
@rmdir(WINABSPATH . $nggpath);
}
if ($output) nggGallery::show_error($txt);
return false;
}
with
if (SAFE_MODE) {
// define relative path to gallery inside wp root folder
$nggpath = $defaultpath . $name;
// Only check for existing gallery an thumbs folders
if ( (!is_dir(WINABSPATH . $nggpath) ) || (!is_dir(WINABSPATH . $nggpath . '/thumbs') ) ){
$help = __('The server setting Safe-Mode is on !', 'nggallery');
$help .= '<br />'.__('If you have problems, please create directory', 'nggallery').' <strong>' . $nggpath . '</strong> ';
$help .= __('and the thumbnails directory', 'nggallery').' <strong>' . $nggpath . '/thumbs</strong> '.__('with permission 777 manually !', 'nggallery');
if ($output) nggGallery::show_message($help);
if ( !is_dir(WINABSPATH . $nggpath)) $txt .= __('Directory must exist: ', 'nggallery').$nggpath.'!<br />';
if ( !is_dir(WINABSPATH . $nggpath . '/thumbs')) $txt .= __('Directory must exist: ', 'nggallery').$nggpath . '/thumbs! <br />';
if ($output) nggGallery::show_error($txt);
return false;
}
}
else {
// 1. Check for existing folder
if ( is_dir(WINABSPATH . $defaultpath . $name ) ) {
$suffix = 1;
do {
$alt_name = substr ($name, 0, 200 - ( strlen( $suffix ) + 1 ) ) . "_$suffix";
$dir_check = is_dir(WINABSPATH . $defaultpath . $alt_name );
$suffix++;
} while ( $dir_check );
$name = $alt_name;
}
// define relative path to gallery inside wp root folder
$nggpath = $defaultpath . $name;
// 2. Create new gallery folder
if ( !wp_mkdir_p (WINABSPATH . $nggpath) )
$txt = __('Unable to create directory ', 'nggallery').$nggpath.'!<br />';
// 3. Check folder permission
if ( !is_writeable(WINABSPATH . $nggpath ) )
$txt .= __('Directory', 'nggallery').' <strong>'.$nggpath.'</strong> '.__('is not writeable !', 'nggallery').'<br />';
// 4. Now create thumbnail folder inside
if ( !is_dir(WINABSPATH . $nggpath . '/thumbs') ) {
if ( !wp_mkdir_p ( WINABSPATH . $nggpath . '/thumbs') )
$txt .= __('Unable to create directory ', 'nggallery').' <strong>' . $nggpath . '/thumbs !</strong>';
}
// show a error message
if ( !empty($txt) ) {
if ($output) nggGallery::show_error($txt);
return false;
}
}
But of course hacking the plugin-files is not the best idea, as after an update these changes are gone.