|
@@ -1918,7 +1918,7 @@ function ApproveAttachments($attachments)
|
|
*/
|
|
*/
|
|
function ManageAttachmentPaths()
|
|
function ManageAttachmentPaths()
|
|
{
|
|
{
|
|
- global $modSettings, $scripturl, $context, $txt, $sourcedir, $boarddir, $smcFunc;
|
|
|
|
|
|
+ global $modSettings, $scripturl, $context, $txt, $sourcedir, $boarddir, $smcFunc, $settings;
|
|
|
|
|
|
// Since this needs to be done eventually.
|
|
// Since this needs to be done eventually.
|
|
if (!is_array($modSettings['attachmentUploadDir']))
|
|
if (!is_array($modSettings['attachmentUploadDir']))
|
|
@@ -1944,8 +1944,17 @@ function ManageAttachmentPaths()
|
|
if ($id < 1)
|
|
if ($id < 1)
|
|
continue;
|
|
continue;
|
|
|
|
|
|
|
|
+ // Sorry, these dirs are NOT valid
|
|
|
|
+ $invalid_dirs = array($boarddir, $settings['default_theme_dir'], $sourcedir);
|
|
|
|
+ if (in_array($path, $invalid_dirs))
|
|
|
|
+ {
|
|
|
|
+ $errors[] = $path . ': ' . $txt['attach_dir_invalid'];
|
|
|
|
+ continue;
|
|
|
|
+ }
|
|
|
|
+
|
|
// Hmm, a new path maybe?
|
|
// Hmm, a new path maybe?
|
|
- if (!array_key_exists($id, $modSettings['attachmentUploadDir']))
|
|
|
|
|
|
+ // Don't allow empty paths
|
|
|
|
+ if (!array_key_exists($id, $modSettings['attachmentUploadDir']) && !empty($path))
|
|
{
|
|
{
|
|
// or is it?
|
|
// or is it?
|
|
if (in_array($path, $modSettings['attachmentUploadDir']) || in_array($boarddir . DIRECTORY_SEPARATOR . $path, $modSettings['attachmentUploadDir']))
|
|
if (in_array($path, $modSettings['attachmentUploadDir']) || in_array($boarddir . DIRECTORY_SEPARATOR . $path, $modSettings['attachmentUploadDir']))
|
|
@@ -1953,6 +1962,11 @@ function ManageAttachmentPaths()
|
|
$errors[] = $path . ': ' . $txt['attach_dir_duplicate_msg'];
|
|
$errors[] = $path . ': ' . $txt['attach_dir_duplicate_msg'];
|
|
continue;
|
|
continue;
|
|
}
|
|
}
|
|
|
|
+ elseif (empty($path))
|
|
|
|
+ {
|
|
|
|
+ // Ignore this and set $id to one less
|
|
|
|
+ continue;
|
|
|
|
+ }
|
|
|
|
|
|
// OK, so let's try to create it then.
|
|
// OK, so let's try to create it then.
|
|
require_once($sourcedir . '/Subs-Attachments.php');
|
|
require_once($sourcedir . '/Subs-Attachments.php');
|