forked from LightsOnHudson/FPP-Plugin-RadioStation
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathplugin_setup.php
executable file
·105 lines (91 loc) · 2.63 KB
/
plugin_setup.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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
<?php
include_once 'funcs.inc.php';
// Nav
include_once "pages/header.php";
echo "pluginConfigFile: $pluginConfigFile<br>";
echo "log_file: $logFile<br>";
$my_settings = parse_ini_file($pluginConfigFile, True)
// LoadPluginSettings($pluginName); # doesn't get headings/sections :-(
get_config();
// Debug info
?>
<pre>
<?php
echo print_r($my_settings, TRUE);
?>
</pre>
POSTED
<pre>
<?php
echo print_r($_POST, TRUE);
?>
</pre>
<?php
echo ("plugin update file: ".$pluginUpdateFile);
// END Debug info
if(isset($_POST['submit']))
{
if ($_GET["opt"]){
echo "<br>opt: ".$_GET["opt"];
// add new to configs
$post_arr = add_new($_POST, $my_settings);
}else{
$post_arr = post_to_array($_POST);
}
// update my_settings, based on post info
echo "<br>submitted: ".print_r($post_arr, TRUE);
if (write_ini_file($pluginConfigFile, $post_arr)){
echo "<br>[Success!] settings written to $pluginConfigFile";
} else {
echo "<br>[Failed!] failed to write to $pluginConfigFile";
}
// re-read
$my_settings = parse_ini_file($pluginConfigFile, True);
?>
<pre>
<?php
echo print_r($my_settings, TRUE);
?>
</pre>
<?php
}
?>
<div id="RadioStation" class="settings">
<fieldset>
<legend><?php echo $pluginName." Version: ".$pluginVersion;?> Support Instructions</legend>
<form method="post" action="http://<?php echo $_SERVER['SERVER_NAME']?>/plugin.php?plugin=<?echo $pluginName;?>&page=plugin_setup.php">
<!-- Global settings -->
<?php
foreach ( $my_settings["GLOBAL"] as $key => $values ){
// echo "???? $key => $values";
echo checkbox("GLOBAL", $key, $key, $values);
}
?>
<h2>Existing</h2>
<ul>
<?php
foreach ($my_settings as $key => $values) {
if(substr( $key, 0, 2 ) === "PL") {
echo "<li>".edit_config_group($key, $values["PLAYLIST_NAME"], $values["PREFIX"])."</li>";
}
}
?>
</ul>
<input id="submit_button" name="submit" type="submit" class="buttons" value="update config">
</form>
<h2>New</h2>
<form method="post" action="http://<?php echo $_SERVER['SERVER_NAME']?>/plugin.php?plugin=<?echo $pluginName;?>&page=plugin_setup.php&opt=new">
<ul>
<?php
echo "<li>".edit_config_group(0, "new", "new_prefix")."</li>";
?>
</ul>
<input id="submit_button" name="submit" type="submit" class="buttons" value="create new">
</form>
<h2></h2>
<form method="post" action="http://<?php echo $_SERVER['SERVER_NAME']?>/plugin.php?plugin=<?echo $pluginName;?>&page=generate.php">
<input id="submit_button" name="submit" type="submit" class="buttons" value="Generate playlist(s)!">
</form>
<p>To report a bug, please file it against the sms Control plugin project on Git: <?php echo $gitURL;?>
</fieldset>
</div>