aboutsummaryrefslogtreecommitdiff
path: root/src/admin/problem.php
diff options
context:
space:
mode:
authorcassio <cassiopc@gmail.com>2015-08-08 21:11:58 +0000
committercassio <cassiopc@gmail.com>2015-08-08 21:11:58 +0000
commite80e0bbdb0b44f95caf6ee69456a05f1c4da65c3 (patch)
tree738656b816d38532b026af2cc66256517ebb415f /src/admin/problem.php
parente911c708e2e5d087480564fcfcccd269bc93db58 (diff)
downloadboca-e80e0bbdb0b44f95caf6ee69456a05f1c4da65c3.tar.gz
boca-e80e0bbdb0b44f95caf6ee69456a05f1c4da65c3.zip
updates to allow submissions by command-line
Diffstat (limited to 'src/admin/problem.php')
-rw-r--r--src/admin/problem.php11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/admin/problem.php b/src/admin/problem.php
index 6a894ba..4228d05 100644
--- a/src/admin/problem.php
+++ b/src/admin/problem.php
@@ -15,7 +15,7 @@
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
////////////////////////////////////////////////////////////////////////////////
-// Last modified 31/aug/2012 by cassio@ime.usp.br
+// Last modified 08/aug/2015 by cassio@ime.usp.br
if ($_POST["confirmation"] != "confirm")
unset($_POST['noflush']);
@@ -168,6 +168,10 @@ if(isset($_POST['Submit5']) && $_POST['Submit5']=='Send') {
if (isset($_POST["Submit3"]) && isset($_POST["problemnumber"]) && is_numeric($_POST["problemnumber"]) &&
isset($_POST["problemname"]) && $_POST["problemname"] != "") {
+ if(strpos(trim($_POST["problemname"]),' ')!==false) {
+ $_POST["confirmation"]='';
+ MSGError('Problem short name cannot have spaces');
+ } else {
if ($_POST["confirmation"] == "confirm") {
if ($_FILES["probleminput"]["name"] != "") {
$type=myhtmlspecialchars($_FILES["probleminput"]["type"]);
@@ -182,7 +186,7 @@ if (isset($_POST["Submit3"]) && isset($_POST["problemnumber"]) && is_numeric($_P
$param = array();
$param['number'] = $_POST["problemnumber"];
- $param['name'] = $_POST["problemname"];
+ $param['name'] = trim($_POST["problemname"]);
$param['inputfilename'] = $name;
$param['inputfilepath'] = $temp;
$param['fake'] = 'f';
@@ -190,6 +194,7 @@ if (isset($_POST["Submit3"]) && isset($_POST["problemnumber"]) && is_numeric($_P
$param['color'] = $_POST["color"];
DBNewProblem ($_SESSION["usertable"]["contestnumber"], $param);
}
+ }
ForceLoad("problem.php");
}
?>
@@ -340,7 +345,7 @@ To replace the data of a problem, proceed as if it did not exist (data will be r
</td>
</tr>
<tr>
- <td width="35%" align=right>Short Name (usually a letter):</td>
+ <td width="35%" align=right>Short Name (usually a letter, no spaces):</td>
<td width="65%">
<input type="text" name="problemname" value="" size="20" maxlength="20" />
</td>