1
0
mirror of https://github.com/e107inc/e107.git synced 2025-08-03 13:17:24 +02:00

e107::getFile()->getUserDir(false) will now return the plugin directory without a user directory.

This commit is contained in:
Cameron
2016-12-27 16:07:03 -08:00
parent 364cfd3128
commit bb3a8e824e
2 changed files with 8 additions and 5 deletions

View File

@@ -1003,24 +1003,27 @@ class e_file
*/ */
public function getUserDir($user, $create = false, $subDir = null) public function getUserDir($user, $create = false, $subDir = null)
{ {
$user = intval($user);
$tp = e107::getParser(); $tp = e107::getParser();
$baseDir = e_MEDIA.'plugins/'.e_CURRENT_PLUGIN.'/'; $baseDir = e_MEDIA.'plugins/'.e_CURRENT_PLUGIN.'/';
if(!empty($subDir)) if(!empty($subDir))
{ {
$subDir = e107::getParser()->filter($subDir,'w');
$baseDir .= rtrim($subDir,'/').'/'; $baseDir .= rtrim($subDir,'/').'/';
} }
$baseDir .= ($user) ? "user_". $tp->leadingZeros($user, 6) : "anon"; if(is_numeric($user))
{
$baseDir .= ($user > 0) ? "user_". $tp->leadingZeros($user, 6) : "anon";
}
if($create == true && !is_dir($baseDir)) if($create == true && !is_dir($baseDir))
{ {
mkdir($baseDir, 0755, true); // recursively mkdir($baseDir, 0755, true); // recursively
} }
$baseDir .= "/"; $baseDir = rtrim($baseDir,'/')."/";
return $baseDir; return $baseDir;
} }

View File

@@ -969,7 +969,7 @@ class e_media
} }
function getPath($mime, $path=null) function getPath($mime, $path=null)
{ {
$mes = e107::getMessage(); $mes = e107::getMessage();
@@ -979,7 +979,7 @@ class e_media
if(!vartrue($this->mimePaths[$pmime])) if(!vartrue($this->mimePaths[$pmime]))
{ {
$this->log("Couldn't detect mime-type ($mime)."); $this->log("Couldn't detect mime-type ($mime).");
$text = $text = str_replace('[x]',$mime,IMALAN_111); $text = $text = str_replace('[x]',$mime,IMALAN_111); //FIXME LAN IMALAN_112 is not generic. This method can be called from anywhere, not only e107_admin/image.php.
$mes->add($text, E_MESSAGE_ERROR); $mes->add($text, E_MESSAGE_ERROR);
return FALSE; return FALSE;
} }