Added support for public sample testcases.

Contestants can view testcases marked as sample as well as their
program output on these cases.

WARNING: this can and will leak information about the problem like
timelimit and more.

Cherry-picked from: 177a655d
Add option to enable teams to see sample testcase run output.
Also clean up rankcache_* tables when refreshing cache.
Update comments for support of HTTP methods, simplify code
and break up some long lines. No functional change.
Remove essentially duplicate argument 'callback' in
RestAPI.provideFunction().
Fix HTML validation issue.
Include 'sample' in SQL query and put it into a function for reuse.
Suppress notice of undefined index.
Happy new year
This just seams reasonable enough.
Fix PHP notice
If we're not going to display the rank, don't bother to calculate it.

This shaves off some queries and calculations on the team page
during a scoreboard freeze.
Two optimisations in putTeamRow() query behaviour.

Do not query categories, we're not using them later.
Do not requery the same team totals in the calcTeamRow function
we just queried before calling it, just pass them in.
Move updating of last_login to do_login function.

Otherwise it would be called on every page load which has shown to
be problematic in the past. The drawback to this change is that it
now only updates this info for auth methods that actually perform
a login operation. There is no real way around that unless we keep
a session for any login type, which is planned.
Add libextdir for judgehost and INSTALL_TREE helper command.
Add PHP Spyc YAML parser library.
Add script and Makefile rule to autogenerate rest API credentials.
Add option to import zip files to database.

These zip files can be used for compile, run, and compile
scripts/programs. Zip file must contain an executable file named 'build'
which is called prior to execution (once). Either another executable
file named 'run' already exists or it has to be created by running
'build'.
Add relation for new executable table.
Add API endpoint to download executable zip files.