예제 #1
0
 function copyFiles($files, $overwrite = null)
 {
     $ftp = JClientHelper::getCredentials('ftp');
     // try to make writeable
     if ($overwrite || $this->getOverwrite()) {
         foreach ($files as $file) {
             $type = array_key_exists('type', $file) ? $file['type'] : 'file';
             switch ($type) {
                 case 'file':
                     if (!$ftp['enabled'] && JFile::exists($file['dest']) && JPath::isOwner($file['dest'])) {
                         JPath::setPermissions($file['dest']);
                     }
                     break;
                 case 'folder':
                     if (!$ftp['enabled'] && JFolder::exists($file['dest']) && JPath::isOwner($file['dest'])) {
                         JPath::setPermissions($file['dest']);
                     }
                     break;
             }
         }
     }
     return parent::copyFiles($files, $overwrite);
 }
 public function copyFiles($files, $overwrite = null)
 {
     // To allow for manual override on the overwriting flag, we check to see if
     // the $overwrite flag was set and is a boolean value. If not, use the object
     // allowOverwrite flag.
     if (is_null($overwrite) || !is_bool($overwrite)) {
         if (version_compare(JVERSION, '3.0', '<')) {
             // Joomla 2.5 compatibility.
             $overwrite = $this->_overwrite;
         } else {
             $overwrite = $this->overwrite;
         }
     }
     $ftp = JClientHelper::getCredentials('ftp');
     if (!$ftp['enabled'] && $overwrite && is_array($files)) {
         foreach ($files as $file) {
             $filedest = JPath::clean($file['dest']);
             $filetype = array_key_exists('type', $file) ? $file['type'] : 'file';
             switch ($filetype) {
                 case 'file':
                     if (JFile::exists($filedest) && JPath::isOwner($filedest)) {
                         JPath::setPermissions($filedest);
                     }
                     break;
                 case 'folder':
                     if (JFolder::exists($filedest) && JPath::isOwner($filedest)) {
                         JPath::setPermissions($filedest);
                     }
                     break;
             }
         }
     }
     return parent::copyFiles($files, $overwrite);
 }