forked from WWBN/AVideo
-
Notifications
You must be signed in to change notification settings - Fork 0
/
save.php
34 lines (32 loc) · 1 KB
/
save.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
<?php
header('Content-Type: application/json');
if (empty($global['systemRootPath'])) {
$global['systemRootPath'] = "../";
}
require_once $global['systemRootPath'] . 'objects/user.php';
$obj = new stdClass();
$obj->status = "1";
$obj->error = "";
if (!User::isAdmin() || !empty($global['disableAdvancedConfigurations'])) {
$obj->status = 0;
$obj->error = __("Permission denied");
die(json_encode($obj));
}
$dir = "{$global['systemRootPath']}locale/";
if (!is_writable($dir)) {
$obj->status = 0;
$obj->error = sprintf(__("Your %slocale dir is not writable"), $global['systemRootPath']);
die(json_encode($obj));
}
$file = $dir.strtolower($_POST['flag']).".php";
$myfile = fopen($file, "w") or die("Unable to open file!");
if (!$myfile) {
$obj->status = 0;
$obj->error = __("Unable to open file!");
die(json_encode($obj));
}
$txt = "<?php\nglobal \$t;\n";
fwrite($myfile, $txt);
fwrite($myfile, $_POST['code']);
fclose($myfile);
echo json_encode($obj);