-
Notifications
You must be signed in to change notification settings - Fork 5
/
profile.php
46 lines (41 loc) · 1.65 KB
/
profile.php
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
<?php
require("config.php");
require("common.php");
$config = config();
$smarty = smarty_init();
$parameters = array(
"Clevels" => array("translate" => "Decomposition levels (Clevels)", "value" => "5"),
"Clayers" => array("translate" => "Quality layers (Clayers)", "value" => "5"),
"Corder" => array("translate" => "Progression order (Corder)", "value" => "RPCL"),
"Creversible" => array("translate" => "Compression (Creversible)", "value" => "yes"),
"Ckernels" => array("translate" => "Transformation (Ckernels)", "value" => "W9X7"),
"Cblk" => array("translate" => "Code block size (Cblk)", "value" => "256x256"),
"Cuse_precints" => array("translate" => "Regions of interests (Cuse_precints)", "value" => "true"),
"Cuse_sop" => array("translate" => "Start of packet header (Cuse_sop)", "value" => "yes"),
"Cuse_eph" => array("translate" => "End of packet header (Cuse_eph)", "value" => "yes"),
);
$op = $_REQUEST['op'];
if ($op == "create") {
$name = $_REQUEST['name'];
$out = "<profile>\n";
$out .= "<name>$name</name>\n";
foreach($parameters as $key => $value) {
if ($_REQUEST[$key]) {
$value=$_REQUEST[$key . "_value"];
$out .= "<metadata key='$key'>$value</metadata>\n";
}
}
$out .= "</profile>\n";
if (preg_match("/[A-Za-z]/", $name)) {
$file = $config['profiles'] . $name . ".xml";
$output = fopen($file, "w");
fwrite($output, $out);
fclose($output);
header("Location: index.php");
}
} else {
$smarty->assign('parameters', $parameters);
$smarty->assign('template', 'profile.tpl');
$smarty->assign('selected', 'profile');
$smarty->display('layout.tpl');
}