@@ -91,7 +91,7 @@ function mkpta($pid,$prepends,$node) {
91
91
92
92
93
93
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 ;
95
95
$ qduoj_problem =json_decode ($ json );
96
96
echo ( $ qduoj_problem ->{'problem ' }->{'title ' })."<br> " ;
97
97
@@ -159,6 +159,9 @@ function import_dir($json) {
159
159
$ pid = addproblem ($ title ,1 ,128 , $ description , $ input , $ output , $ sample_input , $ sample_output , $ hint , $ source , $ spj , $ OJ_DATA );
160
160
mkdir ($ OJ_DATA ."/ $ pid/ " );
161
161
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 ;
162
165
}
163
166
}else if (basename ($ file_name )=="problem_zh.md " ||basename ($ file_name )=="problem.md " ){
164
167
@@ -183,6 +186,9 @@ function import_dir($json) {
183
186
echo htmlentities ("$ description " );
184
187
mkdir ($ OJ_DATA ."/ $ pid/ " );
185
188
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 ;
186
192
}else {
187
193
$ sql ="update problem set description=? where problem_id=? " ;
188
194
pdo_query ($ sql ,$ description ,$ pid );
0 commit comments