diff --git a/uoj/1/app/controllers/problem_data_manage.php b/uoj/1/app/controllers/problem_data_manage.php index a714f64..860bb2f 100644 --- a/uoj/1/app/controllers/problem_data_manage.php +++ b/uoj/1/app/controllers/problem_data_manage.php @@ -74,21 +74,19 @@ EOD; //上传数据 if($_POST['problem_data_file_submit']=='submit'){ - if ($_FILES["problem_data_file"]["error"] > 0) - { + if ($_FILES["problem_data_file"]["error"] > 0){ $errmsg = "Error: ".$_FILES["problem_data_file"]["error"]; becomeMsgPage('
' . $errmsg . '
返回'); } - else - { + else{ //if($_FILES["problem_data_file"]["type"]=='application/zip'){ $up_filename="/tmp/".rand(0,100000000)."data.zip"; move_uploaded_file($_FILES["problem_data_file"]["tmp_name"], $up_filename); $zip = new ZipArchive; - if ($zip->open($up_filename) === TRUE) - { + if ($zip->open($up_filename) === TRUE){ $zip->extractTo("/var/svn/problem/{$problem['id']}/cur/{$problem['id']}/1"); $zip->close(); + svnCommitZipData($problem['id'], 'data'); echo ""; }else{ $errmsg = "解压失败!"; @@ -104,7 +102,6 @@ EOD; //添加配置文件 if($_POST['problem_settings_file_submit']=='submit'){ - if($_POST['use_builtin_checker'] and $_POST['n_tests'] and $_POST['input_pre'] and $_POST['input_suf'] and $_POST['output_pre'] and $_POST['output_suf'] and $_POST['time_limit'] and $_POST['memory_limit']){ if(!is_dir("/var/svn/problem/{$problem['id']}/cur/{$problem['id']}/1/")){ mkdir("/var/svn/problem/{$problem['id']}/cur/{$problem['id']}/1/"); @@ -138,12 +135,12 @@ EOD; fwrite($setfile, "time_limit ".$_POST['time_limit']."\n"); fwrite($setfile, "memory_limit ".$_POST['memory_limit']."\n"); fclose($setfile); + svnCommitZipData($problem['id'], 'conf'); if(!$has_legacy){ echo ""; }else{ echo ""; } - }else{ $errmsg = "添加配置文件失败,请检查是否所有输入框都已填写!"; becomeMsgPage('
' . $errmsg . '
返回'); @@ -167,7 +164,7 @@ EOD;

svn://{$http_host}/problem/{$problem['id']}

- +
@@ -771,16 +768,16 @@ EOD
@@ -863,10 +860,10 @@ EOD -
- diff --git a/uoj/1/app/libs/uoj-svn-lib.php b/uoj/1/app/libs/uoj-svn-lib.php index 1c68d96..cf141ea 100644 --- a/uoj/1/app/libs/uoj-svn-lib.php +++ b/uoj/1/app/libs/uoj-svn-lib.php @@ -362,4 +362,34 @@ EOD error_log('hack successfully but sync failed.'); } } + + function svnCommitZipData($problem, $type) { + $id = $problem['id']; + $cur_dir = "/var/svn/problem/$id/cur/$id"; + $svnusr = UOJConfig::$data['svn']['our-root']['username']; + $svnpwd = UOJConfig::$data['svn']['our-root']['password']; + + if($type=='conf'){ + exec( +<<