-
Notifications
You must be signed in to change notification settings - Fork 19
/
settings.php
44 lines (35 loc) · 1.14 KB
/
settings.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
<?php
include('config.php');
logincheck();
$message = [];
$setting = Setting::first();
if (isset($_POST['submit'])) {
$port = false;
$setting->ffmpeg_path = $_POST['ffmpeg_path'];
$setting->ffprobe_path = $_POST['ffprobe_path'];
if ($setting->webport != $_POST['webport']) {
$setting->webport = $_POST['webport'];
if (is_null($_POST['webport'])) {
$setting->webport = 8000;
}
generatEginxConfPort($_POST['webport']);
$port = true;
}
$setting->webip = $_POST['webip'];
$setting->logourl = $_POST['logourl'];
$setting->hlsfolder = $_POST['hlsfolder'];
mkdir($_POST['hlsfolder'], 0777);
$setting->user_agent = $_POST['user_agent'];
$message['type'] = "success";
$message['message'] = "Setting saved";
$setting->save();
if ($port) {
die("Restart nginx and go to the following url: http://" . $_SERVER['SERVER_ADDR'] . ":" . $_POST['webport'] . "/settings.php");
} else {
redirect("settings.php", 1000);
}
}
echo $template->view()->make('manage_settings')
->with('setting', $setting)
->with('message', $message)
->render();