} if ($_POST['action'] == 'restore') { $cmd = "sudo chmod 666 {$_INICONF['settingspath']}/*"; exec($cmd); $restored = $snapshot->restore($profile_name, $type); if (!empty($restored)) { $_MSGS[] = array('type' => 'info', 'msg' => "arkontrol has restored the configuration profile `{$profile_name}`."); // make sure we send a message telling them to restart ARK dedicated server. $_SESSION['need_to_restart'] = true; } else { $_MSGS[] = array('type' => 'error', 'msg' => "Restoration of configuration profile `{$profile_name}` has failed."); } } if ($_POST['action'] == 'save') { $cmd = "sudo chmod 666 {$_INICONF['settingspath']}/*"; exec($cmd); $saved = $snapshot->create($profile_name, $type); if (!empty($saved)) { $_MSGS[] = array('type' => 'info', 'msg' => "arkontrol has saved the configuration profile `{$profile_name}`."); } else { $_MSGS[] = array('type' => 'error', 'msg' => "Unable to save configuration profile `{$profile_name}`."); } } } } $profiles_snapshot = $snapshot->list_profiles("snapshot"); $profiles_custom = $snapshot->list_profiles("custom"); $_VIEW->assign('profiles_snapshot', $profiles_snapshot); $_VIEW->assign('profiles_custom', $profiles_custom); $_VIEW->assign('_MSGS', $_MSGS); $_VIEW->display('serverProfiles.tpl');
$iniinfo['name'] = $defaults['name']; $iniinfo['ClassName'] = $ClassName; if (isset($defaults['thumbnail'])) { $iniinfo['thumbnail'] = $defaults['thumbnail']; } $taming_combined[$ClassName] = $iniinfo; } } } if (!empty($_POST)) { //We are updating. Good thing we already have a combined list of the defaults plus the current config. //So, we should just be able to foreach through the combined list, look for changes in the postdata, and then write() the ini file. //Make a snapshot, just in case. We make it before we change anything. require_once $_INICONF['webdocroot'] . '/includes/class/class.snapshot.php'; $snapshot = new snapshot($_INICONF); $saved = $snapshot->create(null, 'snapshot'); $taming_towrite = array(); $post_keys = array_keys($_POST); foreach ($taming_combined as $id => $info) { $taming_combined[$id]['TamingDisabled'] = in_array("TamingDisabled_{$id}", $post_keys) ? 1 : 0; if (!empty($taming_combined[$id]['TamingDisabled'])) { //we just plain ol' don't include the ones that we want to be tameable. we need to list only the ones that are untamable $taming_towrite[] = '"' . $taming_combined[$id]['ClassName'] . '"'; } } $iniGame->gameini['/script/shootergame.shootergamemode']['PreventDinoTameClassNames'] = $taming_towrite; $iniGame->write(); //there were diffs, make sure we send a message telling them to restart ARK dedicated server. $_SESSION['need_to_restart'] = true; } //Assign our combined array: the defaults, with any values gleaned from the INI merged in, with any new details from the POST data merged in.