public function savePost() { if (!$_POST) { return; } $identifier = null; $projectDirectory = null; if (isset($_POST['project_identifier'])) { $identifier = $this->_postIdentifier = $this->_stripData($_POST['project_identifier']); } if (isset($_POST['project_directory'])) { $projectDirectory = $this->_postProjectDirectory = $this->_stripData(MagentoDebugger::getPath($_POST['project_directory'])); } if (!$this->verifyMagentoDirectory($projectDirectory)) { array_push($this->_errors, 'Please enter a right magento project directory.'); return; } $dataToSave = "[config]\n"; $dataToSave .= "name = '" . $_SERVER['SERVER_NAME'] . "'\n"; $dataToSave .= "dir = '" . $projectDirectory . "'\n"; $configDir = MagentoDebugger::getDebuggerDir() . '/config'; $varDir = MagentoDebugger::getDebuggerDir() . '/var'; $allowed = true; if (!MagentoDebugger::isWritable($varDir)) { array_push($this->_errors, 'Please make "var" dir at the Magento Debugger and all files on it writable ("' . $varDir . '").'); $allowed = false; } if (!MagentoDebugger::isWritable($configDir)) { array_push($this->_errors, 'Please make "config" dir at the Magento Debugger and all files on it writable ("' . $configDir . '").'); $allowed = false; } if ($allowed && @file_put_contents($configDir . '/' . $identifier . '.ini', $dataToSave)) { array_push($this->_messages, 'Host sucefully configured.'); } elseif ($allowed) { array_push($this->_errors, 'Please check the dir "config" on the Magento Debugger. The file ' . $configDir . '/' . $identifier . '.ini can not be written.'); } }