Gentoo Archives: gentoo-commits

From: Liam McLoughlin <hexxeh@××××××.net>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/gentoaster:webui commit in: web/
Date: Thu, 28 Jul 2011 01:02:56
Message-Id: 6f16b6f20007012cc8e63056f9a7629310d67412.hexxeh@gentoo
1 commit: 6f16b6f20007012cc8e63056f9a7629310d67412
2 Author: Liam McLoughlin <hexxeh <AT> hexxeh <DOT> net>
3 AuthorDate: Thu Jul 28 00:56:34 2011 +0000
4 Commit: Liam McLoughlin <hexxeh <AT> hexxeh <DOT> net>
5 CommitDate: Thu Jul 28 01:02:10 2011 +0000
6 URL: http://git.overlays.gentoo.org/gitweb/?p=proj/gentoaster.git;a=commit;h=6f16b6f2
7
8 Adding USE, package USE, FEATURES and keywords to WebUI
9
10 ---
11 web/config.php | 12 ++++++++++++
12 web/index.php | 32 ++++++++++++++++++++++++++++++++
13 web/process.php | 17 ++++++++++-------
14 3 files changed, 54 insertions(+), 7 deletions(-)
15
16 diff --git a/web/config.php b/web/config.php
17 index 1d1cb2e..210d1db 100644
18 --- a/web/config.php
19 +++ b/web/config.php
20 @@ -11,6 +11,18 @@
21
22 // What should we set as the default list of packages?
23 define("DEFAULT_PACKAGES", "dhcpd");
24 +
25 + // What should we set as the default list of packages?
26 + define("DEFAULT_USE", "");
27 +
28 + // What should we set as the default list of packages?
29 + define("DEFAULT_PACKAGE_USE", "");
30 +
31 + // What should we set as the default list of packages?
32 + define("DEFAULT_FEATURES", "parallel-fetch userfetch userpriv getbinpkg");
33 +
34 + // What should we set as the default list of packages?
35 + define("DEFAULT_KEYWORDS", "");
36
37 // What should we limit the virtual machine disk size to?
38 define("MAX_DISK_SIZE", 16384);
39
40 diff --git a/web/index.php b/web/index.php
41 index 99b9cf0..e16bc42 100644
42 --- a/web/index.php
43 +++ b/web/index.php
44 @@ -190,6 +190,38 @@
45 ?></textarea>
46 <br>
47 </div>
48 + <div id="expert" class="step">
49 + <h1>Expert</h1>
50 +
51 + <label for="expert_use">USE flags</label>
52 + <br /><br />
53 + <textarea id="expert_use" name="use"
54 + style="width: 680px; height: 85px;"><?php
55 + echo DEFAULT_USE;
56 + ?></textarea>
57 + <br>
58 + <label for="expert_puse">Package USE</label>
59 + <br /><br />
60 + <textarea id="expert_puse" name="puse"
61 + style="width: 680px; height: 85px;"><?php
62 + echo DEFAULT_PACKAGE_USE;
63 + ?></textarea>
64 + <br>
65 + <label for="expert_features">Features</label>
66 + <br /><br />
67 + <textarea id="expert_features" name="features"
68 + style="width: 680px; height: 85px;"><?php
69 + echo DEFAULT_FEATURES;
70 + ?></textarea>
71 + <br>
72 + <label for="expert_keywords">Accept Keywords</label>
73 + <br /><br />
74 + <textarea id="expert_keywords" name="keywords"
75 + style="width: 680px; height: 85px;"><?php
76 + echo DEFAULT_KEYWORDS;
77 + ?></textarea>
78 + <br>
79 + </div>
80 <div id="format" class="step submit_step">
81 <h1>Image format</h1>
82
83
84 diff --git a/web/process.php b/web/process.php
85 index a005319..e0bf38a 100644
86 --- a/web/process.php
87 +++ b/web/process.php
88 @@ -40,6 +40,8 @@
89
90 function sanitize_shellarg($arg)
91 {
92 + $arg = str_replace("\r\n", " ", $arg);
93 + $arg = str_replace("\n", " ", $arg);
94 return escapeshellarg($arg);
95 }
96 $sfi = array("options" => "sanitize_shellarg");
97 @@ -54,11 +56,12 @@
98 $password = filter_input(INPUT_POST, "password", FILTER_CALLBACK, $sfi);
99 $rootPass = filter_input(INPUT_POST, "rootpassword", FILTER_CALLBACK, $sfi);
100 $packagesList = filter_input(INPUT_POST, "packages", FILTER_CALLBACK, $sfi);
101 + $use = filter_input(INPUT_POST, "use", FILTER_CALLBACK, $sfi);
102 + $puse = filter_input(INPUT_POST, "puse", FILTER_CALLBACK, $sfi);
103 + $features = filter_input(INPUT_POST, "features", FILTER_CALLBACK, $sfi);
104 + $keywords = filter_input(INPUT_POST, "keywords", FILTER_CALLBACK, $sfi);
105 $outputFormat = filter_input(INPUT_POST, "format", FILTER_CALLBACK, $sfi);
106
107 - $packagesList = str_replace("\r\n", " ", $packagesList);
108 - $packagesList = str_replace("\n", " ", $packagesList);
109 -
110 $iniString = "[vmconfig]
111
112 BUILD_ID='$buildID'
113 @@ -70,10 +73,10 @@ HOSTNAME=$hostname
114 ROOT_PASSWORD=$rootPass
115 DEFAULT_USERNAME=$username
116 DEFAULT_PASSWORD=$password
117 -USE_FLAGS=''
118 -PACKAGE_USE=''
119 -FEATURES='parallel-fetch userfetch userpriv getbinpkg'
120 -PACKAGE_ACCEPT_KEYWORDS=''
121 +USE_FLAGS='$use'
122 +PACKAGE_USE='$puse'
123 +FEATURES='$features'
124 +PACKAGE_ACCEPT_KEYWORDS='$keywords'
125 PACKAGES_LIST=$packagesList
126 OUTPUT_FORMAT=$outputFormat";