PMA\libraries\Util::userDir PHP Method

userDir() public static method

example: $user_dir = userDir('/var/pma_tmp/%u/'); // '/var/pma_tmp/root/'
public static userDir ( string $dir ) : string
$dir string with wildcard for user
return string per user directory
    public static function userDir($dir)
    {
        // add trailing slash
        if (mb_substr($dir, -1) != '/') {
            $dir .= '/';
        }
        return str_replace('%u', PMA_securePath($GLOBALS['cfg']['Server']['user']), $dir);
    }

Usage Example

コード例 #1
0
ファイル: File.php プロジェクト: phpmyadmin/phpmyadmin
 /**
  * Sets named file to be read from UploadDir.
  *
  * @param string $name file name
  *
  * @return boolean success
  * @access  public
  */
 public function setLocalSelectedFile($name)
 {
     if (empty($GLOBALS['cfg']['UploadDir'])) {
         return false;
     }
     $this->setName(Util::userDir($GLOBALS['cfg']['UploadDir']) . PMA_securePath($name));
     if (@is_link($this->getName())) {
         $this->_error_message = __('File is a symbolic link');
         $this->setName(null);
         return false;
     }
     if (!$this->isReadable()) {
         $this->_error_message = Message::error(__('File could not be read!'));
         $this->setName(null);
         return false;
     }
     return true;
 }
Util