public function __construct() { global $langmessage, $dataDir; $this->server_name = gpsession::ServerName(); //get current rules $this->rule_file_name = self::IIS() ? 'web.config' : '.htaccess'; $this->rule_file = $dataDir . '/' . $this->rule_file_name; if (file_exists($this->rule_file)) { $this->orig_rules = file_get_contents($this->rule_file); } $this->FileSystem = \gp\tool\FileSystem::init($this->rule_file); $this->WWWAvail(); echo '<h2>' . $langmessage['permalink_settings'] . '</h2>'; $cmd = common::GetCommand(); switch ($cmd) { case 'continue': if (!$this->SaveHtaccess()) { break; } default: $this->ShowForm(); break; } }
/** * Prepare FileSystem for writing to $dataDir * $dataDir writability is required so that we can create & rename subfolders: $dataDir/data, $dataDir/themes * */ public function RevertFilesystem() { global $dataDir, $langmessage; $this->FileSystem = \gp\tool\FileSystem::init($dataDir); if (is_null($this->FileSystem)) { message($langmessage['OOPS'] . ' (No filesystem)'); return false; } return true; }
/** * Determine how we'll be writing the new code to the server (ftp or direct) * */ function DetectFileSystem() { global $dataDir; //already determined if (isset($_POST['filesystem_method'])) { $this->FileSystem = \gp\tool\FileSystem::set_method($_POST['filesystem_method']); if ($this->FileSystem) { return $_POST['filesystem_method']; } } $this->curr_step = 1; //make sure we don't attempt anything beyond step 1 $context[$dataDir] = 'file'; // Need to be able to write to the dataDir $context[$dataDir . '/include'] = 'file'; // Need to be able to rename or delete the include directory $context[$dataDir . '/themes'] = 'dir'; // These may have user content in them and should not be completely replaced $context[$dataDir . '/addons'] = 'dir'; $this->FileSystem = \gp\tool\FileSystem::init($context); if (!$this->FileSystem) { return false; } return $this->FileSystem->method; }