Example #1
0
 /**
  * Constructor.
  *
  * @param string       $newFileName  new file name
  * @param string       $fileName     current file name
  * @param string       $folder       current file folder
  * @param ResourceType $resourceType current file resource type
  * @param CKFinder     $app          CKFinder app
  */
 public function __construct($newFileName, $fileName, $folder, ResourceType $resourceType, CKFinder $app)
 {
     parent::__construct($fileName, $folder, $resourceType, $app);
     $this->newFileName = static::secureName($newFileName, $this->config->get('disallowUnsafeCharacters'));
     if ($this->config->get('checkDoubleExtension')) {
         $this->newFileName = Utils::replaceDisallowedExtensions($this->newFileName, $resourceType);
     }
 }
Example #2
0
 /**
  * Sanitizes current file name using options set in Config
  */
 public function sanitizeFilename()
 {
     $this->fileName = static::secureName($this->fileName, $this->config->get('disallowUnsafeCharacters'));
     $resourceType = $this->workingFolder->getResourceType();
     if ($this->config->get('checkDoubleExtension')) {
         $this->fileName = Utils::replaceDisallowedExtensions($this->fileName, $resourceType);
     }
 }