Guest User

Untitled

a guest
May 25th, 2018
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.34 KB | None | 0 0
  1. <?php
  2.  
  3. function smartChmod($path, $chmod = null) {
  4. if (file_exists($path)) {
  5. if (is_null($chmod)) {
  6. $chmod = is_file($path) ? 644 : 755;
  7.  
  8. if (in_array(get_current_user(), explode('|', 'apache|httpd|nobody|system|webdaemon|www|www-data'))) {
  9. $chmod += 22;
  10. }
  11. }
  12.  
  13. return chmod($path, octdec(intval($chmod)));
  14. }
  15.  
  16. return false;
  17. }
  18.  
  19. ?>
Add Comment
Please, Sign In to add comment