summaryrefslogtreecommitdiff
blob: b446e3ca0d718dfde9a6f4d4642aa85ef1aab6aa (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
<?php
include('webgliIP.php');
include('webgliUtility.php');

include('Smarty.class.php');
$smarty = new Smarty;

$smarty->template_dir = './templates';
$smarty->compile_dir = './templates_c';
$smarty->cache_dir = './cache';
$smarty->config_dir = './configs';

$ip = new InstallProfile();
$ip->parse('test.xml');

$error_msg = "";
$etc_files = $ip->get("etc_files");
$smarty->assign('dynamic', $ip->get("dynamic_stage3"));

if ($_POST['save']) {
	if ( !$_POST['currentfile'] ) {
		$error_msg .= "ERROR you must select a file to edit!<br>";
	}
	$file = $_POST['currentfile'];
	#if (array_key_exists($file,$etc_files)) {
		$etc_files[$file] = $_POST['filecontents'];
	#} else {
	#	$etc_files[$file] = 
	#etc_files[file].append($_POST['filecontents'])
	$ip->set("etc_files",$etc_files);
	#SAVE VALUES
	file_put_contents('test.xml', $ip->serialize());  #PHP 5 only
	if ( !$error_msg ) { $error_msg = "Values saved successfully"; }
}
if ($_POST['fileeditsubmit']) {
	if ($_POST['editfile']) {
		$file_to_edit = $_POST['editfile'];
		$smarty->assign('file_to_edit',$file_to_edit);
		if (array_key_exists($file_to_edit,$etc_files)) {
			$previous_contents = join("\n",$etc_files[$file_to_edit]);
		} else {
			$previous_contents = "";
		}
	}
}

#get portage file list here
$file_list["portage/package.mask"] = "A list of DEPEND atoms to mask.";
$file_list["portage/package.unmask"] = "A list of packages to unmask.";
$file_list["portage/package.keywords"] = "Per-package KEYWORDS (like ACCEPT_KEYWORDS).";
$file_list["portage/package.use"] = "Per-package USE flags.";
$smarty->assign('file_list',$file_list);
$smarty->assign('error_msg',$error_msg);
$smarty->assign('previous_contents',$previous_contents);
$smarty->display('etc_portage.tpl');

?>