Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

R language #1002

Merged
merged 21 commits into from
Mar 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ Star us, please!

日期 | 类型 | 更新内容
------- | :--: | :-------
03-24 | 更新 | 增加R语言支持,仅限x64环境。
03-16 | 更新 | [@Tiang-88](https://github.com/Tiang-88) 改善MathJax渲染,补充了字体并修订了部分显示效果。
03-15 | 更新 | 代码提交页按Ctrl+双击鼠标整理C语言代码缩进,给比赛题目增加全局提交记录查询按钮。
03-06 | 更新 | 支持data目录为一级软连接,以满足nas共享测试数据分布式判题的需要。
Expand Down
26 changes: 17 additions & 9 deletions trunk/core/judge_client/judge_client.cc
Original file line number Diff line number Diff line change
Expand Up @@ -206,8 +206,8 @@ static int py2=1; // caution: py2=1 means default using py3
MYSQL *conn;
#endif
static char jresult[15][4]={"PD","PR","CI","RJ","AC","PE","WA","TLE","MLE","OLE","RE","CE","CO","TR","MC"};
static char lang_ext[22][8] = {"c", "cc", "pas", "java", "rb", "sh", "py",
"php", "pl", "cs", "m", "bas", "scm", "c", "cc", "lua", "js", "go","sql","f95","m","cob"};
static char lang_ext[23][8] = {"c", "cc", "pas", "java", "rb", "sh", "py",
"php", "pl", "cs", "m", "bas", "scm", "c", "cc", "lua", "js", "go","sql","f95","m","cob","R"};
//static char buf[BUFFER_SIZE];

int lockfile(int fd) {
Expand Down Expand Up @@ -434,14 +434,17 @@ void init_syscalls_limits(int lang) //白名单初始化
{ //cobol
for (i = 0; i == 0 || LANG_CBV[i]; i++)
call_counter[LANG_CBV[i]] = HOJ_MAX_LIMIT;
}
}else if(lang == LANG_R )
for (i = 0; i == 0 || LANG_RLV[i]; i++)
call_counter[LANG_RLV[i]] = HOJ_MAX_LIMIT;
#ifdef __aarch64__
if (lang==3)call_counter[220]= 100;
else call_counter[220]= 1;
#else
call_counter[SYS_execve % call_array_size ]= 1;
if(lang == LANG_R ) call_counter[SYS_execve % call_array_size ]= 8;
#endif
printf("SYS_execve:%d\n",SYS_execve % call_array_size );
printf("SYS_execve:%d [%d] \n",SYS_execve % call_array_size , call_counter[SYS_execve % call_array_size ]);
}

int after_equal(char *c)
Expand Down Expand Up @@ -1351,7 +1354,7 @@ int compile(int lang, char *work_dir)
LIM.rlim_cur = 500 * STD_MB;
setrlimit(RLIMIT_FSIZE, &LIM);

if (lang == 2 || lang == 3 || lang == 17)
if (lang == 2 || lang == LANG_JAVA || lang == 17 || lang == LANG_R )
{
#ifdef __mips__
LIM.rlim_max = STD_MB << 12;
Expand Down Expand Up @@ -1389,7 +1392,7 @@ int compile(int lang, char *work_dir)
execute_cmd("/bin/chown judge %s ", work_dir);
execute_cmd("/bin/chmod 750 %s ", work_dir);

if (compile_chroot && lang != 3 && lang != 9 && lang != 6 && lang != 11 && lang != 5 )
if (compile_chroot && lang != 3 && lang != 9 && lang != 6 && lang != 11 && lang != 5 && lang != LANG_R )
{
if (access("usr", F_OK ) == -1){
execute_cmd("mkdir -p root/.cache/go-build usr etc/alternatives proc tmp dev");
Expand Down Expand Up @@ -1860,7 +1863,7 @@ char *escape(char s[], char t[])
}

void prepare_files(char *filename, int namelen, char *infile, int &p_id,
char *work_dir, char *outfile, char *userfile, int runner_id)
char *work_dir, char *outfile, char *userfile, int runner_id,int lang )
{
// printf("ACflg=%d %d check a file!\n",ACflg,solution_id);

Expand All @@ -1884,7 +1887,7 @@ void prepare_files(char *filename, int namelen, char *infile, int &p_id,
}
fclose(fpname);
}else{
if(copy_data) execute_cmd("/bin/cp '%s' %s/data.in", infile, work_dir); // 如果开启了COPY_DATA则复制测试数据
if(copy_data||lang == LANG_R) execute_cmd("/bin/cp '%s' %s/data.in", infile, work_dir); // 如果开启了COPY_DATA则复制测试数据
}
execute_cmd("/bin/cp %s/data/%d/*.dic %s/ 2>/dev/null", oj_home, p_id, work_dir);
execute_cmd("chown judge %s/*.dic ", work_dir);
Expand Down Expand Up @@ -2423,6 +2426,7 @@ void run_solution(int &lang, char *work_dir, double &time_lmt, int &usedtime,
&& lang != LANG_COBOL
&& lang != LANG_MATLAB
&& lang != LANG_CSHARP
&& lang != LANG_R
&& !(lang == LANG_PYTHON && python_free )
){

Expand Down Expand Up @@ -2471,6 +2475,7 @@ void run_solution(int &lang, char *work_dir, double &time_lmt, int &usedtime,
case LANG_GO:
case LANG_CSHARP: //C#
case LANG_JAVA: //java
case LANG_R:
LIM.rlim_cur = LIM.rlim_max = 880;
break;
case LANG_RUBY: //ruby
Expand Down Expand Up @@ -2561,6 +2566,9 @@ void run_solution(int &lang, char *work_dir, double &time_lmt, int &usedtime,
case LANG_MATLAB: //octave
execl("/usr/bin/octave-cli", "/usr/bin/octave-cli", "-W", "-q", "-H", "Main.m", (char *)NULL); //"--no-init-file", "--no-init-path", "--no-line-editing", "--no-site-file"
break;
case LANG_R:
execle("/usr/bin/Rscript", "/usr/bin/Rscript", "Main.R", (char *)NULL,envp);

}
//sleep(1);
printf("Execution error, USE_DOCKER:%d !\nYou need to install compiler VM or runtime for your language.",use_docker);
Expand Down Expand Up @@ -3604,7 +3612,7 @@ int main(int argc, char **argv)
continue;

prepare_files(dirp->d_name, namelen, infile, p_id, work_dir, outfile,
userfile, runner_id);
userfile, runner_id, lang );
if (access(outfile, R_OK ) == -1)
{
//out file does not exist
Expand Down
1 change: 1 addition & 0 deletions trunk/core/judge_client/okcalls.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
#define LANG_FORTRAN 19
#define LANG_MATLAB 20
#define LANG_COBOL 21
#define LANG_R 22

#ifdef __i386
#include "okcalls32.h"
Expand Down
2 changes: 2 additions & 0 deletions trunk/core/judge_client/okcalls32.h
Original file line number Diff line number Diff line change
Expand Up @@ -129,3 +129,5 @@ int LANG_FV[CALL_ARRAY_SIZE]={3,4,11,33,45,85,122,174,197,243,252,0};
int LANG_MV[CALL_ARRAY_SIZE]={3,4,6,11,20,33,45,54,78,85,91,102,122,125,140,146,168,174,175,183,191,192,195,196,197,199,220,221,240,242,243,252,258,295,311,355,0};
//Cobol
int LANG_CBV[CALL_ARRAY_SIZE]={3,4,6,11,20,33,45,54,78,85,91,102,122,125,140,146,168,174,175,183,191,192,195,196,197,199,220,221,240,242,243,252,258,295,311,355,0};
//R
int LANG_RLV[CALL_ARRAY_SIZE]={0,11,0};
5 changes: 5 additions & 0 deletions trunk/core/judge_client/okcalls64.h
Original file line number Diff line number Diff line change
Expand Up @@ -150,3 +150,8 @@ int LANG_MV[CALL_ARRAY_SIZE] = {
SYS_gettimeofday, 0 };
//Cobal
int LANG_CBV[CALL_ARRAY_SIZE]={0,1,3,4,5,8,9,10,11,12,13,14,17,21,41,42,59,89,158,202,218,231,257,273,302,0};

//R Lang
int LANG_RLV[CALL_ARRAY_SIZE]={0,1,3,8,9,10,11,12,13,14,16,17,21,33,39,41,42,56,59,61,63,72,79,83,89,98,99,102,104,107,
108,110,111,131,158,202,204,217,218,231,257,262,273,293,302,318,334,435,439,0};

2 changes: 2 additions & 0 deletions trunk/core/judge_client/okcalls_aarch64.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,3 +56,5 @@ int LANG_FV[CALL_ARRAY_SIZE] = {0,3,4,5,33,45,85,122,174,197,248,0};
int LANG_MV[CALL_ARRAY_SIZE] = {0,2,3,4,5,6,11,19,33,45,54,78,91,122,125,140,174,175,183,191,192,195,197,199,201,217,240,242,248,256,281,283,338,384,0};
//cobol
int LANG_CBV[CALL_ARRAY_SIZE] = {0,2,3,4,5,6,11,19,33,45,54,78,91,122,125,140,174,175,183,191,192,195,197,199,201,217,240,242,248,256,281,283,338,384,0};
//R
int LANG_RLV[CALL_ARRAY_SIZE]={0,11,0};
2 changes: 2 additions & 0 deletions trunk/core/judge_client/okcalls_arm.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ int LANG_GOV[CALL_ARRAY_SIZE]={0,0};
int LANG_SQLV[CALL_ARRAY_SIZE]={0,0};
//fortran
int LANG_FV[CALL_ARRAY_SIZE]={0,3,4,5,33,45,85,122,174,197,248,0};
//R
int LANG_RLV[CALL_ARRAY_SIZE]={0,11,0};
//matlib
int LANG_MV[CALL_ARRAY_SIZE]={0,2,3,4,5,6,11,19,33,45,54,78,91,122,125,140,174,175,183,191,192,195,197,199,201,217,240,242,248,256,281,283,338,384,0};
//Cobol
Expand Down
2 changes: 2 additions & 0 deletions trunk/core/judge_client/okcalls_mips.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,3 +57,5 @@ int LANG_FV[CALL_ARRAY_SIZE]={0,2,3,4,6,85,122,392,393,397,404,405,412,453,479,0
int LANG_MV[CALL_ARRAY_SIZE]={0,1,2,3,4,5,6,9,8,10,11,12,13,16,17,18,22,24,25,28,32,33,36,40,42,48,55,56,57,60,61,64,66,72,74,76,80,83,85,88,92,96,104,111,112,116,120,122,124,126,128,131,132,133,134,135,136,144,147,148,152,157,160,164,168,169,176,179,184,185,193,200,208,215,216,224,245,248,251,256,257,264,272,279,287,288,296,304,312,315,318,320,323,328,336,337,339,344,347,349,352,368,371,372,376,377,384,385,392,393,394,395,396,397,399,400,401,402,403,404,405,406,407,408,411,412,424,431,432,433,435,436,439,440,443,446,447,448,451,452,453,455,456,462,464,468,469,472,487,488,490,492,496,497,504,510,511,0};
//Cobol
int LANG_CBV[CALL_ARRAY_SIZE]={0,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,35,36,37,38,40,41,42,43,45,46,47,48,49,50,51,52,54,55,56,59,61,62,63,64,65,66,68,69,70,71,72,73,74,78,81,82,84,85,88,89,90,91,92,93,97,100,103,105,108,110,118,122,125,126,143,146,148,152,159,163,165,166,167,170,176,177,179,180,182,183,184,185,186,188,191,194,195,199,209,212,215,217,218,220,222,228,239,240,245,249,252,257,259,260,262,263,264,272,273,275,278,280,287,288,290,294,295,297,298,300,305,306,312,316,319,320,321,327,328,330,333,334,336,341,345,355,362,363,369,370,371,375,376,383,387,390,392,393,397,400,401,403,404,412,418,422,425,426,433,447,449,452,453,455,456,467,468,469,471,473,474,479,481,482,485,486,489,492,502,504,508,510,511,0};
//R
int LANG_RLV[CALL_ARRAY_SIZE]={0,11,0};
3 changes: 2 additions & 1 deletion trunk/install/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@ RUN cd /home/judge/src/core/ && bash make.sh
#RUN DEBIAN_FRONTEND=noninteractive apt-get -y install --no-install-recommends sqlite3
#RUN DEBIAN_FRONTEND=noninteractive apt-get -y install --no-install-recommends gfortran
#RUN DEBIAN_FRONTEND=noninteractive apt-get -y install --no-install-recommends octave
#RUN DEBIAN_FRONTEND=noninteractive apt-get -y install --no-install-recommends gnucobol
#RUN DEBIAN_FRONTEND=noninteractive apt-get -y install --no-install-recommends gnucobole
#RUN DEBIAN_FRONTEND=noninteractive apt-get -y install --no-install-recommends r-base

# install debian package of similarity-tester
RUN DEBIAN_FRONTEND=noninteractive apt-get -y install --no-install-recommends similarity-tester
Expand Down
3 changes: 2 additions & 1 deletion trunk/web/admin/contest_add.php
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,8 @@
else $lastlang = 0;

for($i=0; $i<$lang_count; $i++){
echo "<option value=$i ".( $lang&(1<<$i)?"selected":"").">".$language_name[$i]."</option>";
if( (1<<$i) & $OJ_LANGMASK ) continue;
echo "<option value=$i ".( $lang&(1<<$i)?"selected":"").">".$language_name[$i]."</option>";
}
?>
</select>
Expand Down
1 change: 1 addition & 0 deletions trunk/web/admin/contest_edit.php
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,7 @@
else $lastlang = 0;

for($i=0; $i<$lang_count; $i++){
if( (1<<$i) & $OJ_LANGMASK ) continue;
echo "<option value=$i ".( $lang&(1<<$i)?"selected":"").">".$language_name[$i]."</option>";
}
?>
Expand Down
4 changes: 2 additions & 2 deletions trunk/web/include/const.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
$judge_result=Array($MSG_Pending,$MSG_Pending_Rejudging,$MSG_Compiling,$MSG_Running_Judging,$MSG_Accepted,$MSG_Presentation_Error,$MSG_Wrong_Answer,$MSG_Time_Limit_Exceed,$MSG_Memory_Limit_Exceed,$MSG_Output_Limit_Exceed,$MSG_Runtime_Error,$MSG_Compile_Error,$MSG_Compile_OK,$MSG_TEST_RUN,$MSG_MANUAL_CONFIRMATION,$MSG_SUBMITTING,$MSG_REMOTE_PENDING,$MSG_REMOTE_JUDGING);
$jresult=Array($MSG_PD,$MSG_PR,$MSG_CI,$MSG_RJ,$MSG_AC,$MSG_PE,$MSG_WA,$MSG_TLE,$MSG_MLE,$MSG_OLE,$MSG_RE,$MSG_CE,$MSG_CO,$MSG_TR,$MSG_MC,$MSG_SUBMITTING,$MSG_RP,$MSG_RJ);
$judge_color = Array("label gray","label label-info","label label-warning","label label-warning","label label-success","label label-danger","label label-danger","label label-warning","label label-warning","label label-warning","label label-warning","label label-warning","label label-warning","label label-info","label label-success","label lable-gray","label label-info","label label-warning");
$language_name=Array("C","C++","Pascal","Java","Ruby","Bash","Python","PHP","Perl","C#","Obj-C","FreeBasic","Scheme","Clang","Clang++","Lua","JavaScript","Go","SQL","Fortran","Matlab","Cobol","UnknownLanguage");
$language_ext=Array( "c", "cc", "pas", "java", "rb", "sh", "py", "php","pl", "cs","m","bas","scm","c","cc","lua","js","go","sql","f95","m","cob" );
$language_name=Array("C","C++","Pascal","Java","Ruby","Bash","Python","PHP","Perl","C#","Obj-C","FreeBasic","Scheme","Clang","Clang++","Lua","JavaScript","Go","SQL","Fortran","Matlab","Cobol","R-Lang","UnknownLanguage");
$language_ext=Array( "c", "cc", "pas", "java", "rb", "sh", "py", "php","pl", "cs","m","bas","scm","c","cc","lua","js","go","sql","f95","m","cob","R" );
$PID=Array("A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","AA","AB","AC","AD","AE","AF","AG","AH","AI","AJ","AK","AL","AM","AN","AO","AP","AQ","AR","AS","AT","AU","AV","AW","AX","AY","AZ","BA","BB","BC","BD","BE","BF","BG","BH","BI","BJ","BK","BL","BM","BN","BO","BP","BQ","BR","BS","BT","BU","BV","BW","BX","BY","BZ","CA","CB","CC","CD","CE","CF","CG","CH","CI","CJ","CK","CL","CM","CN","CO","CP","CQ","CR","CS","CT","CU","CV","CW","CX","CY","CZ","DA","DB","DC","DD","DE","DF","DG","DH","DI","DJ","DK","DL","DM","DN","DO","DP","DQ","DR","DS","DT","DU","DV","DW","DX","DY","DZ","EA","EB","EC","ED","EE","EF","EG","EH","EI","EJ","EK","EL","EM","EN","EO","EP","EQ","ER","ES","ET","EU","EV","EW","EX","EY","EZ","FA","FB","FC","FD","FE","FF","FG","FH","FI","FJ","FK","FL","FM","FN","FO","FP","FQ","FR","FS","FT","FU","FV","FW","FX","FY","FZ","GA","GB","GC","GD","GE","GF","GG","GH","GI","GJ","GK","GL","GM","GN","GO","GP","GQ","GR","GS","GT","GU","GV","GW","GX","GY","GZ","HA","HB","HC","HD","HE","HF","HG","HH","HI","HJ","HK","HL","HM","HN","HO","HP","HQ","HR","HS","HT","HU","HV","HW","HX","HY","HZ","IA","IB","IC","ID","IE","IF","IG","IH","II","IJ","IK","IL","IM","IN","IO","IP","IQ","IR","IS","IT","IU","IV","IW","IX","IY","IZ","JA","JB","JC","JD","JE","JF","JG","JH","JI","JJ","JK","JL","JM","JN","JO","JP","JQ","JR","JS","JT","JU","JV","JW","JX","JY","JZ","KA","KB","KC","KD","KE","KF","KG","KH","KI","KJ","KK","KL","KM","KN","KO","KP","KQ","KR","KS","KT","KU","KV","KW","KX","KY","KZ","LA","LB","LC","LD","LE","LF","LG","LH","LI","LJ","LK","LL","LM","LN","LO","LP","LQ","LR","LS","LT","LU","LV","LW","LX","LY","LZ","MA","MB","MC","MD","ME","MF","MG","MH","MI","MJ","MK","ML","MM","MN","MO","MP","MQ","MR","MS","MT","MU","MV","MW","MX","MY","MZ","NA","NB","NC","ND","NE","NF","NG","NH","NI","NJ","NK","NL","NM","NN","NO","NP","NQ","NR","NS","NT","NU","NV","NW","NX","NY","NZ","OA","OB","OC","OD","OE","OF","OG","OH","OI","OJ","OK","OL","OM","ON","OO","OP","OQ","OR","OS","OT","OU","OV","OW","OX","OY","OZ","PA","PB","PC","PD","PE","PF","PG","PH","PI","PJ","PK","PL","PM","PN","PO","PP","PQ","PR","PS","PT","PU","PV","PW","PX","PY","PZ","QA","QB","QC","QD","QE","QF","QG","QH","QI","QJ","QK","QL","QM","QN","QO","QP","QQ","QR","QS","QT","QU","QV","QW","QX","QY","QZ","RA","RB","RC","RD","RE","RF","RG","RH","RI","RJ","RK","RL","RM","RN","RO","RP","RQ","RR","RS","RT","RU","RV","RW","RX","RY","RZ","SA","SB","SC","SD","SE","SF","SG","SH","SI","SJ","SK","SL","SM","SN","SO","SP","SQ","SR","SS","ST","SU","SV","SW","SX","SY","SZ","TA","TB","TC","TD","TE","TF","TG","TH","TI","TJ","TK","TL","TM","TN","TO","TP","TQ","TR","TS","TT","TU","TV","TW","TX","TY","TZ","UA","UB","UC","UD","UE","UF","UG","UH","UI","UJ","UK","UL","UM","UN","UO","UP","UQ","UR","US","UT","UU","UV","UW","UX","UY","UZ","VA","VB","VC","VD","VE","VF","VG","VH","VI","VJ","VK","VL","VM","VN","VO","VP","VQ","VR","VS","VT","VU","VV","VW","VX","VY","VZ","WA","WB","WC","WD","WE","WF","WG","WH","WI","WJ","WK","WL","WM","WN","WO","WP","WQ","WR","WS","WT","WU","WV","WW","WX","WY","WZ","XA","XB","XC","XD","XE","XF","XG","XH","XI","XJ","XK","XL","XM","XN","XO","XP","XQ","XR","XS","XT","XU","XV","XW","XX","XY","XZ","YA","YB","YC","YD","YE","YF","YG","YH","YI","YJ","YK","YL","YM","YN","YO","YP","YQ","YR","YS","YT","YU","YV","YW","YX","YY","YZ","ZA","ZB","ZC","ZD","ZE","ZF","ZG","ZH","ZI","ZJ","ZK","ZL","ZM","ZN","ZO","ZP","ZQ","ZR","ZS","ZT","ZU","ZV","ZW","ZX","ZY","ZZ");
$ball_color=Array('#66cccc','red','green','pink','yellow','violet','magenta','maroon','olive','chocolate');
$ball_name=Array('蒂芙妮蓝','红','green','pink','yellow','violet','magenta','maroon','olive','chocolate');
Expand Down
2 changes: 1 addition & 1 deletion trunk/web/include/db_info.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
static $OJ_LANG="en"; //默认语言
static $OJ_SIM=false; //显示相似度,注意只是显示,启动检测的开关在judge.conf,且自己抄自己不计为抄袭
static $OJ_DICT=false; //显示在线翻译
static $OJ_LANGMASK=4194224; //掩码计算器:https://pigeon-developer.github.io/hustoj-langmask/
static $OJ_LANGMASK=8388532; //掩码计算器:https://pigeon-developer.github.io/hustoj-langmask/
static $OJ_ACE_EDITOR=true; // 是否启用有高亮提示的提交代码输入框
static $OJ_AUTO_SHARE=false; //true: 设为true则通过的题目可在统计页查看其他人代码.
static $OJ_CSS="white.css"; // bing.css | kawai.css | black.css | blue.css | green.css | hznu.css
Expand Down
2 changes: 1 addition & 1 deletion trunk/web/remote.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
require_once "include/db_info.inc.php";
require_once "include/init.php";
$remote_ojs=array(
"pku","hdu" //使用一本通启蒙设为:"bas"
"bas" // "pku","hdu" //使用一本通启蒙设为:"bas"
);
$sites=array(
"pku" => "http://poj.org/",
Expand Down
2 changes: 1 addition & 1 deletion trunk/web/template/syzoj/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
/* 本月之星 */
$month_id=mysql_query_cache("select solution_id from solution where in_date<date_add(curdate(),interval -day(curdate())+1 DAY) order by solution_id desc limit 1;");
if(is_array( $month_id) && isset($month_id[0][0]) ) $month_id=$month_id[0][0];else $month_id=0;
if($NOIP_flag[0]==0)$view_month_rank=mysql_query_cache("select user_id,nick,count(distinct(problem_id)) ac from solution where solution_id>$month_id and problem_id>0 and result=4 group by user_id,nick order by ac desc limit 10");
if($NOIP_flag[0]==0)$view_month_rank=mysql_query_cache("select user_id,nick,count(distinct(problem_id)) ac from solution where solution_id>$month_id and problem_id>0 and user_id not in (".$OJ_RANK_HIDDEN.") and result=4 group by user_id,nick order by ac desc limit 10");
if ( is_array($view_month_rank) ) {
?>
<h4 class="ui top attached block header"><i class="ui star icon"></i><?php echo "本月之星"?></h4>
Expand Down
1 change: 1 addition & 0 deletions trunk/web/template/syzoj/showsource.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
if ($brush=='obj-c') $brush='c';
if ($brush=='python3') $brush='python';
if ($brush=='swift') $brush='csharp';
if ($brush=='r') $brush='delphi';
echo "<pre class=\"brush:".$brush.";\">";
ob_start();
echo "/**************************************************************\n";
Expand Down
2 changes: 1 addition & 1 deletion trunk/web/template/syzoj/submitpage.php
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@ function resume(){
}
}
function switchLang(lang){
var langnames=new Array("c_cpp","c_cpp","pascal","java","ruby","sh","python","php","perl","csharp","objectivec","vbscript","scheme","c_cpp","c_cpp","lua","javascript","golang");
var langnames=new Array("c_cpp","c_cpp","pascal","java","ruby","sh","python","php","perl","csharp","objectivec","vbscript","scheme","c_cpp","c_cpp","lua","javascript","golang","sql","fortran","matlab","cobol","r");
editor.getSession().setMode("ace/mode/"+langnames[lang]);

}
Expand Down
Loading