util.php 405 B

12345678910111213141516171819202122232425
  1. <?
  2. require 'config.php';
  3. # True if the input path is junk -- self-links, OS X noise, etc.
  4. function isJunk($path) {
  5. $path = basename($path);
  6. # Ignore certain fixed paths
  7. foreach (array('.', '..', '.DS_Store') as $value) {
  8. if ($path == $value) {
  9. return true;
  10. }
  11. }
  12. # Ignore ._ paths
  13. if (preg_match('/^\.\_/', $path)) {
  14. return true;
  15. }
  16. # Otherwise the path is good
  17. return false;
  18. }
  19. ?>