Skip to content

Commit 7164c72

Browse files
authored
Update problem_import_hydro.php
1 parent d8451a3 commit 7164c72

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

trunk/web/admin/problem_import_hydro.php

+7-1
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ function mkpta($pid,$prepends,$node) {
9191

9292

9393
function import_dir($json) {
94-
global $OJ_DATA,$OJ_SAE,$OJ_REDIS,$OJ_REDISSERVER,$OJ_REDISPORT,$OJ_REDISQNAME,$domain,$DOMAIN;
94+
global $OJ_DATA,$OJ_SAE,$OJ_REDIS,$OJ_REDISSERVER,$OJ_REDISPORT,$OJ_REDISQNAME,$domain,$DOMAIN,$_SESSION;
9595
$qduoj_problem=json_decode($json);
9696
echo( $qduoj_problem->{'problem'}->{'title'})."<br>";
9797

@@ -159,6 +159,9 @@ function import_dir($json) {
159159
$pid = addproblem($title,1,128, $description, $input, $output, $sample_input, $sample_output, $hint, $source, $spj, $OJ_DATA);
160160
mkdir($OJ_DATA."/$pid/");
161161
array_push($inserted,$title);
162+
$sql = "INSERT INTO `privilege` (`user_id`,`rightstr`) VALUES(?,?)";
163+
pdo_query($sql, $_SESSION[$OJ_NAME.'_'.'user_id'], "p$pid");
164+
$_SESSION[$OJ_NAME.'_'."p$pid"] = true;
162165
}
163166
}else if(basename($file_name)=="problem_zh.md"||basename($file_name)=="problem.md"){
164167

@@ -183,6 +186,9 @@ function import_dir($json) {
183186
echo htmlentities("$description");
184187
mkdir($OJ_DATA."/$pid/");
185188
array_push($inserted,$title);
189+
$sql = "INSERT INTO `privilege` (`user_id`,`rightstr`) VALUES(?,?)";
190+
pdo_query($sql, $_SESSION[$OJ_NAME.'_'.'user_id'], "p$pid");
191+
$_SESSION[$OJ_NAME.'_'."p$pid"] = true;
186192
}else{
187193
$sql="update problem set description=? where problem_id=?";
188194
pdo_query($sql,$description,$pid);

0 commit comments

Comments
 (0)