makePath() public method

Concat two paths together. Basically $pathA+$pathB
public makePath ( string $pathA, string $pathB ) : string
$pathA string path one
$pathB string path two
return string a trailing slash combinded path.
 /**
  * Create new directories.
  * If in safe_mode, nothing happens.
  * @return boolean true if created, false otherwise.
  */
 function processNewDir()
 {
     if ($this->config['safe_mode'] == true) {
         return false;
     }
     if (isset($_GET['newDir']) && isset($_GET['dir'])) {
         $newDir = rawurldecode($_GET['newDir']);
         $dir = rawurldecode($_GET['dir']);
         $path = Files::makePath($this->getImagesDir(), $dir);
         $fullpath = Files::makePath($path, Files::escape($newDir));
         if (is_dir($fullpath)) {
             return false;
         }
         return Files::createFolder($fullpath);
     }
 }
 /**
  * Create new directories.
  * If in safe_mode, nothing happens.
  * @return boolean true if created, false otherwise.
  */
 function processNewDir()
 {
     if ($this->config['safe_mode']) {
         return false;
     }
     if (isset($_GET['newDir']) && isset($_GET['dir'])) {
         $newDir = rawurldecode($_GET['newDir']);
         $dir = rawurldecode($_GET['dir']);
         $path = Files::makePath($this->getBaseDir(), $dir);
         $fullpath = Files::makePath($path, Files::escape($newDir));
         if (is_dir($fullpath)) {
             return false;
         } else {
             //adding to the DB
             // now the create_unexisting_directory will create the folder
             //$result = Files::createFolder($fullpath);
             global $_course;
             if (isset($_course) && !empty($_course) && isset($_course['code'])) {
                 //@todo make this str to functions
                 $base_dir = substr($path, 0, strpos($path, '/document/') + 9);
                 //
                 $new_dir = substr($fullpath, strlen($base_dir), -1);
                 //
                 create_unexisting_directory($_course, api_get_user_id(), api_get_session_id(), 0, 0, $base_dir, $new_dir, $newDir);
                 $doc_id = DocumentManager::get_document_id($_course, $new_dir);
                 api_item_property_update($_course, TOOL_DOCUMENT, $doc_id, 'invisible', api_get_user_id(), null, null, null, null, api_get_session_id());
             } else {
                 return Files::createFolder($fullpath);
             }
             return true;
         }
     }
 }
 function processPaste()
 {
     switch ($_GET['paste']) {
         case 'copyFile':
             $src = Files::makeFile($this->getImagesDir(), $_GET['srcdir'] . $_GET['file']);
             $file = $_GET['file'];
             $dest = Files::makeFile($this->getImagesDir(), $_GET['dir']);
             return Files::copyFile($src, $dest, $file);
             break;
         case 'copyDir':
             $basePath = $this->getImagesDir();
             $src = $_GET['srcdir'] . $_GET['file'];
             $dest = $_GET['dir'] . $_GET['file'];
             return Files::copyDir($basePath, $src, $dest);
             break;
         case 'moveFile':
             $src = Files::makePath($this->getImagesDir(), $_GET['srcdir'] . $_GET['file']);
             $dest = Files::makePath($this->getImagesDir(), $_GET['dir'] . $_GET['file']);
             return Files::rename($src, $dest);
             break;
         case 'moveDir':
             $src = Files::makeFile($this->getImagesDir(), $_GET['srcdir'] . $_GET['file']);
             $dest = Files::makeFile($this->getImagesDir(), $_GET['dir'] . $_GET['file']);
             return Files::rename($src, $dest);
             break;
     }
 }
Beispiel #4
0
 /**
  * Create new directories.
  * If in safe_mode, nothing happens.
  * @return boolean true if created, false otherwise.
  */
 function processNewDir()
 {
     if ($this->config['safe_mode'] == true) {
         return false;
     }
     if (isset($_GET['newDir']) && isset($_GET['dir'])) {
         $newDir = rawurldecode($_GET['newDir']);
         $dir = rawurldecode($_GET['dir']);
         $path = Files::makePath($this->getBaseDir(), $dir);
         $fullpath = Files::makePath($path, Files::escape($newDir));
         if (is_dir($fullpath)) {
             return false;
         }
         return Files::createFolder($fullpath, $this->config['modx']['folder_permissions']);
         //modified for MODx
     }
 }