Ejemplo n.º 1
0
 /**
  * Get the permissions of the file/folder at a give path
  *
  * @param	string	$path	The path of a file/folder
  * @return	string	Filesystem permissions
  */
 public static function getPermissions($path)
 {
     $path = App_Filesystem_Folder::clean($path);
     $mode = @decoct(@fileperms($path) & 0777);
     if (strlen($mode) < 3) {
         return '---------';
     }
     $parsed_mode = '';
     for ($i = 0; $i < 3; $i++) {
         // read
         $parsed_mode .= $mode[$i] & 04 ? "r" : "-";
         // write
         $parsed_mode .= $mode[$i] & 02 ? "w" : "-";
         // execute
         $parsed_mode .= $mode[$i] & 01 ? "x" : "-";
     }
     return $parsed_mode;
 }