예제 #1
0
 /**
  * Apply chmod on file(s)
  *
  * @param $right, string : rights to apply to file(s)
  *  format : 
  *  r	read (and execute if it's a folder)
  *  w	read and write (and execute if it's a folder)
  *  x	read+write+execute
  *  XXX	unix chmod octal value (ex : 664, 775, etc.)
  * @param $files, string : the files to apply new rights (relative to CMS_file::FILE_SYSTEM)
  * @return string, the files who can't apply the chmod, else nothing if all is done.
  * @access public
  */
 function applyChmod($right, $files)
 {
     $filesList = CMS_file::getFileList($files);
     if (is_array($filesList) && $filesList) {
         $nok = '';
         foreach ($filesList as $aFile) {
             switch ($right) {
                 case 'r':
                     $nok .= CMS_file::makeReadable($aFile['name']) ? '' : $aFile['name'] . '<br />';
                     break;
                 case 'w':
                     $nok .= CMS_file::makeWritable($aFile['name']) ? '' : $aFile['name'] . '<br />';
                     break;
                 case 'x':
                     $nok .= CMS_file::makeExecutable($aFile['name']) ? '' : $aFile['name'] . '<br />';
                     break;
                 default:
                     $nok .= CMS_file::chmodFile($right, $aFile['name']) ? '' : $aFile['name'] . '<br />';
                     break;
             }
         }
         return $nok;
     } else {
         return '';
     }
 }