BxDolIO.php 1.2 KB

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