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.');
     }
 }
예제 #2
0
$dirResource = opendir(MagentoDebugger::getDebuggerDir() . '/includes');
while ($item = readdir($dirResource)) {
    if ($item == '.' || $dirResource == '..') {
        continue;
    }
    if ($item == 'empty' || !is_file(MagentoDebugger::getDebuggerDir() . '/includes/' . $item)) {
        continue;
    }
    require_once MagentoDebugger::getDebuggerDir() . '/includes/' . $item;
}
// Files
if (isset($_GET['magento_debug']) && $_GET['magento_debug'] == 'file' && isset($_GET['magento_debug_file'])) {
    $dir = MagentoDebugger::getDebuggerDir() . '/files/';
    $file = realpath($dir . $_GET['magento_debug_file']);
    $file = MagentoDebugger::getPath($file);
    $dir = MagentoDebugger::getPath($dir);
    if ($file && substr($file, 0, strlen($dir)) == $dir) {
        echo file_get_contents($file);
    } else {
        header("HTTP/1.0 404 Not Found");
        echo "Error 404.";
    }
    return;
}
// Installation
if (!$currentHost || isset($_GET['magento_debug']) && $_GET['magento_debug'] == 'configure') {
    require_once MagentoDebugger::getDebuggerDir() . '/libs/Debugger/installation.php';
    return;
}
if (!is_dir(MagentoDebugger::getProjectDir())) {
    header('Location: /?magento_debug=configure');