try { toolsetInit(); if (!isset($_GET['cmd'])) { $_GET['cmd'] = ''; } $view->setTitle('Compiler'); if ($_SERVER['REQUEST_METHOD'] == 'POST') { if ($_GET['cmd'] == 'chdir') { if (!toolsetValidPath($_POST['spl'])) { $view->message('The source directory is unreachable.'); } if (!toolsetValidPath($_POST['cpl'])) { $view->message('The compile directory is unreachable or you do not have write permissions there.'); } if (trim($_POST['plg']) != '') { if (!toolsetValidPath($_POST['plg'])) { $view->message('The plugin directory is unreachable or you do not have write permissions there.'); } } if (trim($_POST['mas']) != '') { if (!file_exists($_POST['mas'])) { $view->message('The specified master template is unreachable or you do not have read permissions there.'); } } if ($_POST['spl'] == $_POST['cpl']) { $view->message('The specified paths must not be the same.'); } if ($_POST['xml'] != 1 && $_POST['xml'] != 0) { $view->message('Invalid XML Syntax Mode state.'); } $config->splDir = $_POST['spl'];
<?php require './common.php'; try { toolsetInit(); $view->setTitle('Configurator'); if ($_SERVER['REQUEST_METHOD'] == 'POST') { // Validate the settings if (!toolsetValidPath($_POST['source'])) { $view->message('The source directory is unreachable.'); } if (!toolsetValidPath($_POST['destination'])) { $view->message('The destination directory is unreachable or you do not have write permissions there.'); } if ($_POST['source'] == $_POST['destination']) { $view->message('The specified paths must not be the same.'); } // Save the settings $config->sourceDir = $_POST['source']; $config->destDir = $_POST['destination']; foreach ($availableDirectives as $id => $values) { if (isset($_POST['f'][$id])) { $config->enable($id, 1); } else { $config->enable($id, 0); } } // Run the preprocessor $projectFiles = array(0 => 'opt.class.php', 'opt.compiler.php', 'opt.core.php', 'opt.instructions.php', 'opt.functions.php', 'opt.error.php', 'opt.api.php'); $tpl->assign('results', toolsetPreprocessor($projectFiles, $config->sourceDir, $config->destDir, $_POST['f'])); $view->setTemplate('configurator_results.tpl');