forked from BludotOS/BludotOS
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathupdateconf.php
60 lines (56 loc) · 1.65 KB
/
updateconf.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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
<?
function load($path)
{
return require $path;
}
# Now we can use our configuration as an array ...
$myConf = load('users/'.$_GET['user'].'/config/config.php');
if($_GET['array']) {
$changeit = explode(",", $_GET['array']);
$countit = count($changeit);
$countit2 = count($myConf["$_GET[name]"]);
echo $_GET['array'];
echo $changeit;
echo $countit;
echo $countit2;
if($countit < $countit2) {
$myConf["$_GET[name]"] = array(
);
};
for($i = 0; $i < ($countit); $i++) {
$myConf["$_GET[name]"][$i] = "$changeit[$i]";
};
} else if(!$_GET['array']) {
$myConf["$_GET[name]"] = $_GET['change'];
};
$array = array(
'trash'=> $myConf['trash'],
'homepage'=> $myConf['homepage'],
'theme'=> $myConf['theme'],
'Dockapps' => $myConf['Dockapps'],
'Dockfunc' => $myConf['Dockfunc'],
'Dockmag' => $myConf['Dockmag'],
'Dockmin' => $myConf['Dockmin'],
'Dockmax' => $myConf['Dockmax'],
'wallpaper'=> $myConf['wallpaper'],
'version'=> $myConf['version'],
'dock' => $myConf['dock'],
'taskbar' => $myConf['taskbar'],
'windows' => $myConf['windows']);
function save($path, $array)
{
$content = '<?php '.PHP_EOL.'return ' . var_export($array, true) . ';';
return is_numeric(file_put_contents($path, $content));
//return file_put_contents($path, $content);
}
function save2($path, $array)
{
$content = '<?php '.PHP_EOL.'$array = ' . var_export($array, true) . ';'.PHP_EOL.'echo json_encode($array);';
//return is_numeric(file_put_contents($path, $content));
return file_put_contents($path, $content);
}
# Saving configuration
save('users/'.$_GET['user'].'/config/config.php', $array);
save2('users/'.$_GET['user'].'/config/configB.php', $array);
//echo $myConf['Dockapps'][1];
?>