Skip to content

Commit b884ba0

Browse files
authored
Add files via upload
fix additional_file image import
1 parent 32dd425 commit b884ba0

File tree

1 file changed

+5
-9
lines changed

1 file changed

+5
-9
lines changed

trunk/web/admin/problem_import_hydro.php

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,8 @@ function import_dir($json) {
140140
die("Could not open ZIP archive.");
141141
}
142142

143-
$save_path = "";
143+
$save_path=dirname(dirname(__FILE__))."/upload/$domain/".date("YmdHis")."/";
144+
$new_path="/upload/$domain/".date("YmdHis")."/";
144145
$i = 1;
145146
$pid = $title = $description = $input = $output = $sample_input = $sample_output = $hint = $source = $spj = "";
146147
$type = "normal";
@@ -181,7 +182,7 @@ function import_dir($json) {
181182
$description = preg_replace('/{{ select\(\d+\) }}/', "", $description);
182183

183184
if ($save_path) {
184-
$description = str_replace("file://", $save_path . "/", $description);
185+
$description = str_replace("file://", $new_path . "/", $description);
185186
}
186187

187188
$spj = 0;
@@ -277,17 +278,12 @@ function import_dir($json) {
277278
$new_file_name = basename($file_name);
278279
$newpath = $save_path . "/" . $new_file_name;
279280

280-
if ($OJ_SAE) {
281-
$newpath = "saestor://web" . $newpath;
282-
} else {
283-
$newpath = ".." . $newpath;
284-
}
285-
286281
if (!file_exists(dirname($newpath))) {
287282
mkdir(dirname($newpath), 0750, true);
288283
}
289-
284+
// echo "additional:$newpath <br>";
290285
file_put_contents($newpath, $file_content);
286+
291287
}
292288
}
293289

0 commit comments

Comments
 (0)