| 91 | | </form><? |
|---|
| 92 | | break; |
|---|
| 93 | | case "save_system_settings": |
|---|
| 94 | | echo "<h5>Saving System settings...</h5><ul>"; |
|---|
| 95 | | |
|---|
| 96 | | if(isset($_GET["hostname"])) { |
|---|
| 97 | | $hostname = escapeshellarg($_GET["hostname"]); |
|---|
| 98 | | if($hostname != "'".chostname()."'") { |
|---|
| 99 | | set_hostname($hostname); |
|---|
| 100 | | echo "<li>Hostname set to <b>".$hostname."</b>.</li>"; |
|---|
| 101 | | } |
|---|
| 102 | | } |
|---|
| 103 | | |
|---|
| 104 | | if(isset($_GET["domain"])) { |
|---|
| 105 | | $domain = $_GET["domain"]; |
|---|
| 106 | | if($domain != get_domain()) { |
|---|
| 107 | | set_domain($domain); |
|---|
| 108 | | echo "<li>Domain set to <b>".$domain."</b>.</li>"; |
|---|
| 109 | | } |
|---|
| 110 | | } |
|---|
| 111 | | |
|---|
| 112 | | if(isset($_GET["ntpd"])) { |
|---|
| 113 | | if(!get_rc("S15ntpd")) { |
|---|
| 114 | | echo "<li>Enabling NTP daemon.</li>"; |
|---|
| 115 | | set_rc("ntpd",15); |
|---|
| 116 | | } |
|---|
| | 93 | </form><? |
|---|
| | 94 | break; |
|---|
| | 95 | case "save_system_settings": |
|---|
| | 96 | echo "<h5>Saving System settings...</h5><ul>"; |
|---|
| | 97 | |
|---|
| | 98 | if(isset($_GET["hostname"])) { |
|---|
| | 99 | $hostname = escapeshellarg($_GET["hostname"]); |
|---|
| | 100 | if($hostname != "'".chostname()."'") { |
|---|
| | 101 | set_hostname($hostname); |
|---|
| | 102 | echo "<li>Hostname set to <b>".$hostname."</b>.</li>"; |
|---|
| | 103 | } |
|---|
| | 104 | } |
|---|
| | 105 | |
|---|
| | 106 | if(isset($_GET["domain"])) { |
|---|
| | 107 | $domain = $_GET["domain"]; |
|---|
| | 108 | if($domain != get_domain()) { |
|---|
| | 109 | set_domain($domain); |
|---|
| | 110 | echo "<li>Domain set to <b>".$domain."</b>.</li>"; |
|---|
| | 111 | } |
|---|
| | 112 | } |
|---|
| | 113 | |
|---|
| | 114 | if(isset($_GET["ntpd"])) { |
|---|
| | 115 | if(!get_rc("S15ntpd")) { |
|---|
| | 116 | echo "<li>Enabling NTP daemon.</li>"; |
|---|
| | 117 | set_rc("ntpd",15); |
|---|
| | 118 | } |
|---|
| | 119 | } |
|---|
| | 120 | else { |
|---|
| | 121 | if(get_rc("S15ntpd")) { |
|---|
| | 122 | echo "<li>Disabling NTP daemon.</li>"; |
|---|
| | 123 | set_rc("ntpd",0); |
|---|
| | 124 | } |
|---|
| | 125 | } |
|---|
| | 126 | |
|---|
| | 127 | if(isset($_GET["sshd"])) { |
|---|
| | 128 | if(!get_rc("S20ssh")) { |
|---|
| | 129 | echo "<li>Enabling SSH daemon.</li>"; |
|---|
| | 130 | set_rc("ssh",20); |
|---|
| | 131 | } |
|---|
| | 132 | } |
|---|
| | 133 | else { |
|---|
| | 134 | if(get_rc("S20ssh")) { |
|---|
| | 135 | echo "<li>Disabling SSH daemon.</li>"; |
|---|
| | 136 | set_rc("ssh",0); |
|---|
| | 137 | } |
|---|
| | 138 | } |
|---|
| | 139 | |
|---|
| | 140 | /* if(isset($_GET["dhcpd"])) { |
|---|
| | 141 | if(!get_rc("S20dhcp")) { |
|---|
| | 142 | echo "<li>Enabling dhcp server.</li>"; |
|---|
| | 143 | set_rc("dhcp",20); |
|---|
| | 144 | } |
|---|
| | 145 | } |
|---|
| | 146 | else { |
|---|
| | 147 | if(get_rc("S20dhcp")) { |
|---|
| | 148 | echo "<li>Disabling dhcp server.</li>"; |
|---|
| | 149 | set_rc("dhcp",0); |
|---|
| | 150 | } |
|---|
| | 151 | } |
|---|
| | 152 | */ |
|---|
| | 153 | if(isset($_GET["bind"])) { |
|---|
| | 154 | if(!get_rc("S12bind")) { |
|---|
| | 155 | echo "<li>Enabling caching DNS server.</li>"; |
|---|
| | 156 | set_rc("bind",12); |
|---|
| | 157 | } |
|---|
| | 158 | } |
|---|
| | 159 | else { |
|---|
| | 160 | if(get_rc("S12bind")) { |
|---|
| | 161 | echo "<li>Disabling caching DNS server.</li>"; |
|---|
| | 162 | set_rc("bind",0); |
|---|
| | 163 | } |
|---|
| | 164 | } |
|---|
| | 165 | |
|---|
| | 166 | if(isset($_GET["cellmodemservice"])) { |
|---|
| | 167 | if(!get_rc("S14cellular-modules")) { |
|---|
| | 168 | echo "<li>Enabling cellmodem drivers.</li>"; |
|---|
| | 169 | set_rc_no_start("cellular-modules",14); |
|---|
| | 170 | } |
|---|
| | 171 | if(!get_rc("S15cellular")) { |
|---|
| | 172 | echo "<li>Enabling cellmodem init script.</li>"; |
|---|
| | 173 | echo "<li><a href=\"/admin/reboot.php\">Reboot</a> required for changes to take effect.</li>"; |
|---|
| | 174 | set_rc_no_start("cellular",15); |
|---|
| | 175 | // rebootsys(); |
|---|
| | 176 | } |
|---|
| | 177 | } |
|---|
| | 178 | else { |
|---|
| | 179 | if(get_rc("S14cellular-modules")) { |
|---|
| | 180 | echo "<li>Disabling cellmodem drivers.</li>"; |
|---|
| | 181 | echo "<li><a href=\"/admin/reboot.php\">Reboot</a> required for changes to take effect.</li>"; |
|---|
| | 182 | set_rc_no_start("cellular-modules",0); |
|---|
| | 183 | } |
|---|
| | 184 | if(get_rc("S15cellular")) { |
|---|
| | 185 | echo "<li>Disabling cellmodem init scripts.</li>"; |
|---|
| | 186 | set_rc_no_start("cellular",0); |
|---|
| | 187 | } |
|---|
| | 188 | } |
|---|
| | 189 | |
|---|
| | 190 | |
|---|
| | 191 | if(isset($_GET["modem"])) { |
|---|
| | 192 | if($_GET["modem"] != get_modem()) { |
|---|
| | 193 | // Only accept zones that are in the array |
|---|
| | 194 | foreach($modems as $modem) { |
|---|
| | 195 | if($modem == $_GET["modem"]) { |
|---|
| | 196 | if($modem == "None") { |
|---|
| | 197 | echo "<li>Disabling cellular modem support.</li>"; |
|---|
| 125 | | if(isset($_GET["sshd"])) { |
|---|
| 126 | | if(!get_rc("S20ssh")) { |
|---|
| 127 | | echo "<li>Enabling SSH daemon.</li>"; |
|---|
| 128 | | set_rc("ssh",20); |
|---|
| 129 | | } |
|---|
| 130 | | } |
|---|
| 131 | | else { |
|---|
| 132 | | if(get_rc("S20ssh")) { |
|---|
| 133 | | echo "<li>Disabling SSH daemon.</li>"; |
|---|
| 134 | | set_rc("ssh",0); |
|---|
| 135 | | } |
|---|
| 136 | | } |
|---|
| | 208 | if(isset($_GET["dyndns"]) && ($_GET["dyndns"] != "")) { |
|---|
| | 209 | if(get_dyndns() != $_GET["dyndns"]) { |
|---|
| | 210 | echo "<li>Setting up dyndns</li>"; |
|---|
| | 211 | set_dyndns($_GET["dyndns"]); |
|---|
| | 212 | } |
|---|
| | 213 | } |
|---|
| | 214 | |
|---|
| | 215 | if(isset($_GET["dyndnsupdate"]) && ($_GET["dyndnsupdate"] != "")) { |
|---|
| | 216 | echo "<li>Sending dyndns update</li>"; |
|---|
| | 217 | update_dyndns(); |
|---|
| | 218 | } |
|---|
| | 219 | |
|---|
| | 220 | if(isset($_GET["timezone"])) { |
|---|
| | 221 | if($_GET["timezone"] != get_zone()) { |
|---|
| | 222 | // Only accept zones that are in the array |
|---|
| | 223 | foreach($zones as $zone) { |
|---|
| | 224 | if($zone == $_GET["timezone"]) { |
|---|
| | 225 | set_zone($zone); |
|---|
| | 226 | echo "<li>Setting timezone to <b>".$zone."</b>.</li>"; |
|---|
| | 227 | } |
|---|
| | 228 | } |
|---|
| | 229 | } |
|---|
| | 230 | } |
|---|
| 138 | | /* if(isset($_GET["dhcpd"])) { |
|---|
| 139 | | if(!get_rc("S20dhcp")) { |
|---|
| 140 | | echo "<li>Enabling dhcp server.</li>"; |
|---|
| 141 | | set_rc("dhcp",20); |
|---|
| 142 | | } |
|---|
| 143 | | } |
|---|
| 144 | | else { |
|---|
| 145 | | if(get_rc("S20dhcp")) { |
|---|
| 146 | | echo "<li>Disabling dhcp server.</li>"; |
|---|
| 147 | | set_rc("dhcp",0); |
|---|
| 148 | | } |
|---|
| 149 | | } |
|---|
| 150 | | */ |
|---|
| 151 | | if(isset($_GET["bind"])) { |
|---|
| 152 | | if(!get_rc("S12bind")) { |
|---|
| 153 | | echo "<li>Enabling caching DNS server.</li>"; |
|---|
| 154 | | set_rc("bind",12); |
|---|
| 155 | | } |
|---|
| 156 | | } |
|---|
| 157 | | else { |
|---|
| 158 | | if(get_rc("S12bind")) { |
|---|
| 159 | | echo "<li>Disabling caching DNS server.</li>"; |
|---|
| 160 | | set_rc("bind",0); |
|---|
| 161 | | } |
|---|
| 162 | | } |
|---|
| 163 | | |
|---|
| 164 | | if(isset($_GET["modem"])) { |
|---|
| 165 | | if($_GET["modem"] != get_modem()) { |
|---|
| 166 | | // Only accept zones that are in the array |
|---|
| 167 | | foreach($modems as $modem) { |
|---|
| 168 | | if($modem == $_GET["modem"]) { |
|---|
| 169 | | if($modem == "None") { |
|---|
| 170 | | echo "<li>Disabling cellular modem support.</li>"; |
|---|
| 171 | | } |
|---|
| 172 | | else { |
|---|
| 173 | | echo "<li>Enabling <b>".$modem."</b> cellular modem support.</li>"; |
|---|
| 174 | | } |
|---|
| 175 | | set_modem($modem); |
|---|
| 176 | | } |
|---|
| 177 | | } |
|---|
| 178 | | } |
|---|
| 179 | | } |
|---|
| 180 | | |
|---|
| 181 | | if(isset($_GET["dyndns"]) && ($_GET["dyndns"] != "")) { |
|---|
| 182 | | if(get_dyndns() != $_GET["dyndns"]) { |
|---|
| 183 | | echo "<li>Setting up dyndns</li>"; |
|---|
| 184 | | set_dyndns($_GET["dyndns"]); |
|---|
| 185 | | } |
|---|
| 186 | | } |
|---|
| 187 | | |
|---|
| 188 | | if(isset($_GET["dyndnsupdate"]) && ($_GET["dyndnsupdate"] != "")) { |
|---|
| 189 | | echo "<li>Sending dyndns update</li>"; |
|---|
| 190 | | update_dyndns(); |
|---|
| 191 | | } |
|---|
| 192 | | |
|---|
| 193 | | if(isset($_GET["timezone"])) { |
|---|
| 194 | | if($_GET["timezone"] != get_zone()) { |
|---|
| 195 | | // Only accept zones that are in the array |
|---|
| 196 | | foreach($zones as $zone) { |
|---|
| 197 | | if($zone == $_GET["timezone"]) { |
|---|
| 198 | | set_zone($zone); |
|---|
| 199 | | echo "<li>Setting timezone to <b>".$zone."</b>.</li>"; |
|---|
| 200 | | } |
|---|
| 201 | | } |
|---|
| 202 | | } |
|---|
| 203 | | } |
|---|
| 204 | | |
|---|
| 205 | | if(isset($_GET["sshkeys"])) { |
|---|
| 206 | | if(set_sshkeys($_GET["sshkeys"])) { |
|---|
| 207 | | echo "<li>Installing new SSH keys for <b>root</b></li>"; |
|---|
| 208 | | } |
|---|
| 209 | | } |
|---|
| 210 | | |
|---|
| 211 | | echo '</ul><p><a href="'.$_SERVER['PHP_SELF'].'">Back to System Settings</a>'; |
|---|
| 212 | | break; |
|---|
| | 232 | if(isset($_GET["sshkeys"])) { |
|---|
| | 233 | if(set_sshkeys($_GET["sshkeys"])) { |
|---|
| | 234 | echo "<li>Installing new SSH keys for <b>root</b></li>"; |
|---|
| | 235 | } |
|---|
| | 236 | } |
|---|
| | 237 | |
|---|
| | 238 | |
|---|
| | 239 | echo '</ul><p><a href="'.$_SERVER['PHP_SELF'].'">Back to System Settings</a>'; |
|---|
| | 240 | break; |
|---|