Example #1
0
 } else {
     if (array_key_exists('btn_table_save', $_POST)) {
         $schemaFile = $_COOKIE['schemaFile'];
         if (!$schemaFile) {
             $schemaFile = MAX_PATH . '/etc/tables_core.xml';
         }
         $changesFile = $_COOKIE['changesetFile'];
         if (!$changesFile) {
             $changesFile = MAX_PATH . '/var/changes_tables_core.xml';
         } else {
             //$schemaFile = MAX_CHG.str_replace('changes_', 'schema_', $changesFile);
             //        $schemaFile = MAX_PATH.'/etc/'.$schemaFile;
             //        $schemaFile = MAX_PATH.'/etc/'.$schemaFile;
         }
         require_once 'oaSchema.php';
         $oaSchema = new Openads_Schema_Manager($schemaFile, $changesFile, $schemaPath);
         if (($aErrs = $oaSchema->checkPermissions()) !== true) {
             die(join("<br />\n", $aErrs));
         }
         //$table_name = $_POST['table_name'];
         $table_name = $_POST['tbl_old_name'];
         $table_name_was = $_POST['tbl_new_name'];
         $oaSchema->tableWasSave(MAX_CHG . $changesFile, $table_name, $table_name_was);
         $file = MAX_CHG . $changesFile;
     } else {
         $file = getLastChangeset();
         if ($file) {
             setcookie('changesetFile', $file);
             $file = MAX_CHG . $file;
         }
     }
Example #2
0
    }
}
if (empty($schemaPath) || empty($schemaFile)) {
    $schemaPath = '';
    //OX_CORE;
    $schemaFile = 'tables_core.xml';
}
// ensure correct directory format. $schemaPath requires trailing '/'. Using trailing DIRECTORY_SEPARATOR fails on Windows for reasons unknown
if (isset($schemaPath) && $schemaPath != '') {
    $schemaPath = OX::realPathRelative(urldecode($schemaPath));
    $schemaPath .= '/';
}
setcookie('schemaPath', $schemaPath);
setcookie('schemaFile', $schemaFile);
global $oaSchema;
$oaSchema = new Openads_Schema_Manager($schemaFile, '', $schemaPath);
if (is_array($aErrs = OX_DevToolbox::checkFilePermissions(array(PATH_DEV, PATH_VAR, MAX_PATH . $pluginPath)))) {
    setcookie('schemaFile', '');
    setcookie('schemaPath', '');
    $errorMessage = join("<br />\n", $aErrs['errors']) . "<br /><br ><hr /><br />\n" . 'To fix, please execute the following commands:' . "<br /><br >\n" . join("<br />\n", $aErrs['fixes']);
    die($errorMessage);
}
require_once PATH_DEV . '/lib/xajax.inc.php';
if (array_key_exists('btn_copy_final', $_POST)) {
    $oaSchema->createTransitional();
} else {
    if (array_key_exists('btn_schema_new', $_POST)) {
        $oaSchema->createNew($_POST['new_schema_name']);
    } else {
        if (array_key_exists('btn_delete_trans', $_POST)) {
            $oaSchema->deleteTransitional();