Commit Graph

12 Commits

Author SHA1 Message Date
Masco Skray
c1294121d3 fix(uoj/1/app/libs): fix no preview of text files in problem_data_manage
When managing data, there will be a preview of test data or validator binary file.
But in PHP7 the prefiew of test data text file or problem.conf text file is not shown.
After my test it is caused by file_get_contents() when passing offset with -1.
It is strange that the manual on php.net in Chinese the default of $offset is -1,
but in English the default of $offset is 0. Use -1 will get nothing, 0 instead is fine.
The commit also change uojFilePreview() that can also be used as viewing binary file.
For backwards compatibility, we just set text as the default file type and no need to specify.
2018-10-11 23:40:05 +08:00
Masco Skray
58e70164ba fix(uoj/1/app/controllers): fix Judgement Failed submissions table not shown for superuser
When printing the table of Judgement Failed items at super-manage, there is nothing shown.
It caused by using echoSubmissionsList(), arguments that 3 passed but exactly 4 expected.
So add the missing argument, and let the result hidden because we select an exact result.
Also, because of the typo of "Judgement", there will be nothing shown if
only fixed too few arguments. This commit changes it too.
2018-10-11 23:35:32 +08:00
Masco Skray
923e1e61f8 fix(uoj/1/app/models): session issue caused by wrong cookie domain
After we changed the detection of the real httpHost value, the token check will fail when register.
A long time ago we just simply added "Session_Start();" at the beginning of uoj/1/app/index.php.
It temporally solved the problem but caused another series of issues that we can't see outside.
There is also a session_start() when executing Session::init() at importing app/libs/uoj-lib.php.
So, when we add one more "Session_Start();" it will execute this one more time, just cause warning:
> session_name(): Cannot change session name when session is active
> PHP Warning:  ini_set(): A session is active. You cannot change the session module's ini settings at this time
And, the session name and session path, session domain will not be set so may cause other problems.
The reason is that using UOJContext::httpHost() as web hostname when default, it will add the port at the end.
When using IP the validateIP() will return false, or using domain with port the cookie domain will be set wrongly.
As a result the register process throws out the "Expired" error and refuses to register, and other uses token will fail too.
We made it cut out the port when setting cookie domain, and also changed the style of UOJContext::httpHost() to make it easier to read.
With this problem known and solved the "Session_Start();" in index.php will also say bye-bye, and there will be no multiple session_start()s.

NOTICE: If you have set all your information to yours in .config.php, and not using address with port other than 80, you may not face this problem.
But the warning of php will consistently shown in the error log file. So kick the annoying warning information out if you are angry with this ;-)
2018-10-11 18:46:58 +08:00
Billchenchina
de24c3c08b
fix(uoj/1/app/libs): fix compile error when hack enabled
Previous g++-4.8 version will cause compile error when hack enabled.
2018-10-03 00:40:49 +08:00
Masco Skray
1d72c5e914 fix(uoj/1/app/controllers): fix login failure loop when logout from user profile modify page
When logout by clicking logout button on the top of /user/modify-profile link, you will be redirected to the login page.
But if you login immediately then you will get the login page again and loop.
It is caused by an address checking error. Now try to fix.
2018-09-23 23:14:39 +08:00
Masco Skray
64683ad93f feat(install/bundle): install script adapt to Ubuntu 18.04
Update base system to Ubuntu 18.04.
.htaccess file's session path changed correctly.
Add gnupg install choice, due to base system has no gpg support.
Set DEBIAN_FRONTEND to noninteractive in order to prevent tzdata stuck.
Change Dockerfile's verion and buanch checkout method, in order to save space.
Fix mysql conf when not restart service and the database can't import judger info.
Change install.sh, support PHP7.2, update libv8 repo to artful, with missing php-mbstring.
The old JDK distfile mirrors are deprecated, changed to official.sed modded to get the latest jdk8.

BREAKING CHANGE: Ubuntu 14/16 users shouln't execute this script, due to config files and packages not the same.
2018-09-20 22:05:15 +08:00
Masco Skray
ce61130caf style(uoj/1/app/models): a little modify of db connection
Prevent too many information printed out, leak.
Modify it to make it looks simple and can output error correctly.
2018-09-20 19:49:26 +08:00
vfleaking
4d2b0735dc update: fetch commits from upstream
Update from vfleaking/uoj upstream, commit aa8a85c - 9f1302c.
Because of this repo's modify, also with the adaption of community version.
2018-09-20 19:34:38 +08:00
TRCYX
e9df8f54ab fix(uoj-form-lib.php): UniversalOJ/UOJ-System#13
From vfleaking/uoj@43280f92d6.
Fix wrongly written `isset`s.
2018-09-20 17:39:42 +08:00
ceabrobot
0ec962b4af feat(uoj/1/app): modify the DB operation to support PHP7
In order to support PHP7, change the way to operate database. PHP7
removed the mysql extension, so the old way to operate database is
not usable. This commit use a new way to operate database.

BREAKING CHANGE: the way to operate database has changed.
2018-09-20 17:38:21 +08:00
MascoSkray
babd30364e Initial commit for PHP7
This is the commit before changing environment to PHP7.
2018-09-20 17:38:09 +08:00
vfleaking
82ad3efce2 Initial commit 2018-09-20 17:21:40 +08:00