function pre_upgrade_checks() { include_once ISC_BASE_PATH . '/lib/class.file.php'; $f = new FileClass(); if (!is_dir(ISC_BASE_PATH . "/config")) { $this->SetError(GetLang('UpgradePreChecks1400ConfigDirectory')); } else { if (!$f->CheckDirWritable(ISC_BASE_PATH . "/config")) { $this->SetError(GetLang('UpgradePreChecks1400ConfigDirectory')); } else { if (!$f->CheckFileWritable(ISC_BASE_PATH . "/config/config.php")) { $this->SetError(GetLang('UpgradePreChecks1400ConfigDirectory')); } else { if ($f->CheckFileWritable(ISC_BASE_PATH . "/config/config.backup.php") && !$f->CheckFileWritable(ISC_BASE_PATH . "/config/config.backup.php")) { $this->SetError(GetLang('UpgradePreChecks1400ConfigDirectory')); } } } } if ($this->HasErrors()) { return false; } else { return true; } }
public function CheckPermissions() { if ($this->FoldersToCheck === null) { $this->GetFoldersToCheck(); } // Make the folders appear in alphabetical order to make it easier to go through and fix up permissions natsort($this->FoldersToCheck); // Then order them by their depth usort($this->FoldersToCheck, array($this, 'dir_depth_compare')); include_once ISC_BASE_PATH . '/lib/class.file.php'; $f = new FileClass(); $result = array(); foreach ($this->FoldersToCheck as $folder) { $path = ISC_BASE_PATH . '/' . $folder; if (file_exists($path)) { if (is_file($path)) { $file = true; $mode = '0666'; } elseif (is_dir($path)) { $file = false; $mode = '0777'; } if (is_dir($path) && $f->CheckDirWritable($path)) { } else { if (is_file($path) && $f->CheckFileWritable($path)) { } else { $result[] = array($folder, TARGET_NOT_WRITABLE, $file); } } } else { $result[] = array($folder, TARGET_DOESNT_EXIST); } } return $result; }
public function IsSupported() { $currency = GetDefaultCurrency(); // Check if the default currency is supported by the payment gateway if (!in_array($currency['currencycode'], $this->_currenciesSupported)) { $this->SetError(sprintf(GetLang('IdealCurrecyNotSupported'), implode(',',$this->_currenciesSupported))); } // check for openssl support if (!function_exists('openssl_pkey_new') || !function_exists('openssl_csr_new')) { $this->SetError(GetLang('IdealOpenSSLRequired')); } // check for writable files and folders include_once(ISC_BASE_PATH.'/lib/class.file.php'); $f = new FileClass(); // check config file is writable if (file_exists($this->_configFile) && !$f->CheckFileWritable($this->_configFile)) { $this->SetError(GetLang('IdealConfigFileNotWritable', array("configFile" => $this->_configFile))); } // check the security folder is writable $securityFolder = dirname(__FILE__) . "/lib/includes/security"; if (!$f->CheckDirWritable($securityFolder)) { $this->SetError(GetLang('IdealSecurityFolderNotWritable', array("securityFolder" => $securityFolder))); } // check key file is writable if it exists if (file_exists($this->_keyFile) && !$f->CheckFileWritable($this->_keyFile)) { $this->SetError(GetLang('IdealKeyFileNotWritable', array("keyFile" => $this->_keyFile))); } // check certificate file is writable if it exists if (file_exists($this->_certFile) && !$f->CheckFileWritable($this->_certFile)) { $this->SetError(GetLang('IdealCertFileNotWritable', array("certFile" => $this->_certFile))); } if($this->HasErrors()) { return false; } else { return true; } }
/** * _CheckPermissions * Make sure files/folders have appropriate permissions * * @param none * * @return Array containing folders with permissions */ private function _CheckPermissions() { $result = array(); $old_umask = umask(0); include_once(ISC_BASE_PATH.'/lib/class.file.php'); $f = new FileClass(); foreach($this->FoldersToCheck as $folder) { $path = ISC_BASE_PATH . '/' . $folder; if(file_exists($path)) { if (is_file($path)) { $file = true; $mode = '0666'; } elseif (is_dir($path)) { $file = false; $mode = '0777'; } //@isc_chmod($path, $mode); if(is_dir($path) && $f->CheckDirWritable($path)) { $result[] = array($folder, IS_OK, $file); } else if (is_file($path) && $f->CheckFileWritable($path)) { $result[] = array($folder, IS_OK, $file); } else { $result[] = array($folder, NOT_WRITABLE, $file); } } else { $result[] = array($folder, DOESNT_EXIST); } } umask($old_umask); return $result; }
public function DeleteDir($dir, $Recursive=false) { if (is_dir($this->GetDir() . $dir)) { if($Recursive === true) { $tmp = new FileClass; $tmp->SetLoadDir($this->GetDir() . $dir); while(($f = $tmp->NextFile()) !== false) { $tmp->DeleteFile($f); } $tmp->ResetHandle(); while(($d = $tmp->NextDir()) !== false) { $tmp->DeleteDir($d, $Recursive); } $tmp->CloseDirHandle(); unset($tmp); } if(rmdir($this->GetDir() . $dir)) { return true; } else { return false; } } else { return false; } }
public function CheckPermissions() { include_once(ISC_BASE_PATH.'/lib/class.file.php'); $f = new FileClass(); $install = GetClass('ISC_ADMIN_INSTALL'); foreach ($install->FoldersToCheck as $folder) { $path = ISC_BASE_PATH . '/' . $folder; if (file_exists($path)) { if (is_dir($path) && !$f->CheckDirWritable($path)) { $this->errors[] = sprintf(GetLang('UpgradePreCheckDirectoryNotWriteable'), $folder); } else if (is_file($path) && !$f->CheckFileWritable($path)) { $this->errors[] = sprintf(GetLang('UpgradePreCheckFileNotWriteable'), $folder); } } } if (empty($this->errors)) { return true; } else { return false; } }
/** * Save new content or revert to default, and set flash message. * * @return void */ private function saveRobotsTxtAction() { include_once(ISC_BASE_PATH.'/lib/class.file.php'); $fc = new FileClass(); $content = $_POST['robotstxtFileContent']; $success = 'RobotsSaveSuccess'; if (isset($_POST['robotstxtRevertButton'])) { // Revert button is clicked instead. $content = $this->defaultContent; $success = 'RobotsRevertSuccess'; } $res = $fc->writeToFile($content, $this->filePath); if ($res == true) { FlashMessage(GetLang($success), MSG_SUCCESS, $this->mainUrl); } else { FlashMessage(GetLang('RobotsSaveError'), MSG_ERROR, $this->mainUrl); } }
public function _GetTemplateList() { GetLib('class.file'); // Get a list of templates and return them as a sorted array $dir = ISC_BASE_PATH . "/templates"; $arrTemplates = array(); if (is_dir($dir)) { $fileHandle = new FileClass; if ($fileHandle->SetLoadDir($dir)) { while (($file = $fileHandle->NextFolder()) !== false) { if ($file != "." && $file != ".." && $file != "CVS" && $file != ".svn" && $file != 'blank.dat' && $file{0} != '_') { // These are the template categories. We will create // an array for each of them $arrTemplates[] = $file; sort($arrTemplates); } } $fileHandle->CloseHandle(); } } ksort($arrTemplates); return $arrTemplates; }
<?php $dirPath = getcwd(); include_once $dirPath . '/FileClass.php'; $fileObj = new FileClass(); echo $fileObj->getName(); ?>
/** * 删除 */ public function actionDelete() { $this->blogId = isset($_GET['blogId']) ? $_GET['blogId'] : 0; if ($this->blogId) { $nowblog = $this->markdown->getBlogById($this->blogId); if (empty($nowblog)) { $this->jumpBox('没有此文档!', Wave::app()->homeUrl, 1); } $filePath = ROOT_PATH . '/data/md/' . $nowblog['fileName']; if (file_exists($filePath)) { unlink($filePath); } $FileClass = new FileClass(); $FileClass->rmdirs(ROOT_PATH . '/data/caches'); $this->jumpBox('删除成功!', Wave::app()->homeUrl, 1); } else { $this->jumpBox('请选择文档!', Wave::app()->homeUrl, 1); } }