BxDolIO.php 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. <?php defined('BX_DOL') or die('hack attempt');
  2. /**
  3. * Copyright (c) BoonEx Pty Limited - http://www.boonex.com/
  4. * CC-BY License - http://creativecommons.org/licenses/by/3.0/
  5. *
  6. * @defgroup DolphinCore Dolphin Core
  7. * @{
  8. */
  9. class BxDolIO extends BxDol
  10. {
  11. function __construct()
  12. {
  13. parent::__construct();
  14. }
  15. public static function isExecutable($sFile)
  16. {
  17. clearstatcache();
  18. $aPathInfo = pathinfo(__FILE__);
  19. $sFile = $aPathInfo['dirname'] . '/../../' . $sFile;
  20. return (is_file($sFile) && is_executable($sFile));
  21. }
  22. public static function isWritable($sFile, $sPrePath = '/../../')
  23. {
  24. clearstatcache();
  25. $aPathInfo = pathinfo(__FILE__);
  26. $sFile = $aPathInfo['dirname'] . '/../../' . $sFile;
  27. return is_readable($sFile) && is_writable($sFile);
  28. }
  29. public static function getPermissions($sFileName)
  30. {
  31. $sPath = isset($GLOBALS['logged']['admin']) && $GLOBALS['logged']['admin'] ? BX_DIRECTORY_PATH_ROOT : '../';
  32. clearstatcache();
  33. $hPerms = @fileperms($sPath . $sFileName);
  34. if($hPerms == false) return false;
  35. $sRet = substr( decoct( $hPerms ), -3 );
  36. return $sRet;
  37. }
  38. }
  39. /** @} */