protected function validateDestinationExistanceCopy()
    {
        if ($this->isError()) {
            return null;
        }

        $destinations = array();
        $directory = $this->getSubmitted('directory');

        $error = null;
        foreach ((array) $this->getSubmitted('files') as $index => $file) {

            /* @var $file \SplFileInfo */
            if ($file->isDir() && gplcart_path_normalize($file->getRealPath()) === $directory) {
                $error = $this->translation->text('Destination already exists');
                continue;
            }

            $destination = "$directory/" . $file->getBasename();

            if (file_exists($destination)) {
                $error = $this->translation->text('Destination already exists');
                continue;
            }

            $destinations[$index] = $destination;
        }

        if (isset($error)) {
            $this->setError('destination', $error);
        } else {
            $this->setSubmitted('destinations', $destinations);
        }

        return true;
    }
protected function validateDestinationExistanceCopy()
    {
        if ($this->isError()) {
            return null;
        }

        $destinations = array();
        $directory = $this->getSubmitted('directory');

        $error = null;
        foreach ((array) $this->getSubmitted('files') as $index => $file) {

            /* @var $file \SplFileInfo */
            if ($file->isDir() && gplcart_path_normalize($file->getRealPath()) === $directory) {
                $error = $this->translation->text('Destination already exists');
                continue;
            }

            $destination = "$directory/" . $file->getBasename();

            if (file_exists($destination)) {
                $error = $this->translation->text('Destination already exists');
                continue;
            }

            $destinations[$index] = $destination;
        }

        if (isset($error)) {
            $this->setError('destination', $error);
        } else {
            $this->setSubmitted('destinations', $destinations);
        }

        return true;
    }
protected function validateDestinationExistanceCopy ( ) { if ( $ this -> isError ( ) ) { return null ; } $ destinations = array ( ) ; $ directory = $ this -> getSubmitted ( 'directory' ) ; $ error = null ; foreach ( ( array ) $ this -> getSubmitted ( 'files' ) as $ index => $ file ) { /* @var $file \SplFileInfo */ if ( $ file -> isDir ( ) && gplcart_path_normalize ( $ file -> getRealPath ( ) ) === $ directory ) { $ error = $ this -> translation -> text ( 'Destination already exists' ) ; continue ; } $ destination = "$directory/" . $ file -> getBasename ( ) ; if ( file_exists ( $ destination ) ) { $ error = $ this -> translation -> text ( 'Destination already exists' ) ; continue ; } $ destinations [ $ index ] = $ destination ; } if ( isset ( $ error ) ) { $ this -> setError ( 'destination' , $ error ) ; } else { $ this -> setSubmitted ( 'destinations' , $ destinations ) ; } return true ; }
Validates file destinations
@return boolean
Validates file destinations