예제 #1
0
 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;
 }
예제 #3
0
	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;
		}
	}
예제 #4
0
		/**
		 * _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;
		}
예제 #5
0
	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;
		}
	}