修复私有列表未生效的BUG
This commit is contained in:
@@ -1,4 +1,5 @@
|
|||||||
<html>
|
<html>
|
||||||
|
|
||||||
<head>
|
<head>
|
||||||
<meta http-equiv="Pragma" content="no-cache">
|
<meta http-equiv="Pragma" content="no-cache">
|
||||||
<meta http-equiv="Cache-Control" content="no-cache">
|
<meta http-equiv="Cache-Control" content="no-cache">
|
||||||
@@ -37,13 +38,6 @@ if(isset($_POST['startdate'])){
|
|||||||
$password = $_POST['password'];
|
$password = $_POST['password'];
|
||||||
$description = $_POST['description'];
|
$description = $_POST['description'];
|
||||||
|
|
||||||
if(false){
|
|
||||||
$title = stripslashes($title);
|
|
||||||
$private = stripslashes($private);
|
|
||||||
$password = stripslashes($password);
|
|
||||||
$description = stripslashes($description);
|
|
||||||
}
|
|
||||||
|
|
||||||
$lang = $_POST['lang'];
|
$lang = $_POST['lang'];
|
||||||
$langmask = 0;
|
$langmask = 0;
|
||||||
foreach ($lang as $t) {
|
foreach ($lang as $t) {
|
||||||
@@ -55,7 +49,8 @@ if(isset($_POST['startdate'])){
|
|||||||
|
|
||||||
$cid = intval($_POST['cid']);
|
$cid = intval($_POST['cid']);
|
||||||
|
|
||||||
if(!(isset($_SESSION[$OJ_NAME.'_'."m$cid"])||isset($_SESSION[$OJ_NAME.'_'.'administrator'])||isset($_SESSION[$OJ_NAME.'_'.'contest_creator']))) exit();
|
if (!(isset($_SESSION[$OJ_NAME . '_' . "m$cid"]) || isset($_SESSION[$OJ_NAME . '_' . 'administrator']) || isset($_SESSION[$OJ_NAME . '_' . 'contest_creator'])))
|
||||||
|
exit();
|
||||||
|
|
||||||
$description = str_replace("<p>", "", $description);
|
$description = str_replace("<p>", "", $description);
|
||||||
$description = str_replace("</p>", "<br />", $description);
|
$description = str_replace("</p>", "<br />", $description);
|
||||||
@@ -82,7 +77,8 @@ if(isset($_POST['startdate'])){
|
|||||||
$pid = intval($pieces[$i]);
|
$pid = intval($pieces[$i]);
|
||||||
$has = pdo_query($sql, $pid);
|
$has = pdo_query($sql, $pid);
|
||||||
if (count($has) > 0) {
|
if (count($has) > 0) {
|
||||||
if($plist) $plist.=",";
|
if ($plist)
|
||||||
|
$plist .= ",";
|
||||||
$plist .= intval($pieces[$i]);
|
$plist .= intval($pieces[$i]);
|
||||||
pdo_query($sql_1, $cid, $pieces[$i], $num);
|
pdo_query($sql_1, $cid, $pieces[$i], $num);
|
||||||
$sql = "UPDATE `contest_problem` SET `c_accepted`=(SELECT count(1) FROM `solution` WHERE `problem_id`=? and contest_id=? AND `result`=4) WHERE `problem_id`=? and contest_id=?";
|
$sql = "UPDATE `contest_problem` SET `c_accepted`=(SELECT count(1) FROM `solution` WHERE `problem_id`=? and contest_id=? AND `result`=4) WHERE `problem_id`=? and contest_id=?";
|
||||||
@@ -101,14 +97,14 @@ if(isset($_POST['startdate'])){
|
|||||||
pdo_query($sql);
|
pdo_query($sql);
|
||||||
}
|
}
|
||||||
|
|
||||||
$sql = "DELETE FROM `privilege` WHERE `rightstr`=?";
|
$sql = "DELETE FROM `testusers` WHERE `contest_id`=?";
|
||||||
pdo_query($sql,"c$cid");
|
pdo_query($sql, $cid);
|
||||||
$pieces = explode("\n", trim($_POST['ulist']));
|
$pieces = explode("\n", trim($_POST['ulist']));
|
||||||
$pieces = array_unique($pieces);
|
$pieces = array_unique($pieces);
|
||||||
if (count($pieces) > 0 && strlen($pieces[0]) > 0) {
|
if (count($pieces) > 0 && strlen($pieces[0]) > 0) {
|
||||||
$sql_1 = "INSERT INTO `privilege`(`user_id`,`rightstr`) VALUES (?,?)";
|
$sql_1 = "INSERT INTO `testusers`(`user_id`,`contest_id`) VALUES (?,?)";
|
||||||
for ($i = 0; $i < count($pieces); $i++) {
|
for ($i = 0; $i < count($pieces); $i++) {
|
||||||
pdo_query($sql_1,trim($pieces[$i]),"c$cid") ;
|
pdo_query($sql_1, trim($pieces[$i]), $cid);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -138,16 +134,18 @@ if(isset($_POST['startdate'])){
|
|||||||
$result = pdo_query($sql, $cid);
|
$result = pdo_query($sql, $cid);
|
||||||
|
|
||||||
foreach ($result as $row) {
|
foreach ($result as $row) {
|
||||||
if($plist) $plist .= ",";
|
if ($plist)
|
||||||
|
$plist .= ",";
|
||||||
$plist .= $row[0];
|
$plist .= $row[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
$ulist = "";
|
$ulist = "";
|
||||||
$sql = "SELECT `user_id` FROM `privilege` WHERE `rightstr`=? order by user_id";
|
$sql = "SELECT `user_id` FROM `testusers` WHERE `contest_id`=? order by user_id";
|
||||||
$result = pdo_query($sql,"c$cid");
|
$result = pdo_query($sql, $cid);
|
||||||
|
|
||||||
foreach ($result as $row) {
|
foreach ($result as $row) {
|
||||||
if($ulist) $ulist .= "\n";
|
if ($ulist)
|
||||||
|
$ulist .= "\n";
|
||||||
$ulist .= $row[0];
|
$ulist .= $row[0];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -177,7 +175,8 @@ if(isset($_POST['startdate'])){
|
|||||||
<p align=left>
|
<p align=left>
|
||||||
<?php echo $MSG_CONTEST . "-" . $MSG_PROBLEM_ID ?>
|
<?php echo $MSG_CONTEST . "-" . $MSG_PROBLEM_ID ?>
|
||||||
<?php echo "( Add problemIDs with coma , )" ?><br>
|
<?php echo "( Add problemIDs with coma , )" ?><br>
|
||||||
<input id="plist" onchange="showTitles()" class=input-xxlarge type=text style="width:100%" name=cproblem value='<?php echo $plist?>'>
|
<input id="plist" onchange="showTitles()" class=input-xxlarge type=text style="width:100%" name=cproblem
|
||||||
|
value='<?php echo $plist ?>'>
|
||||||
<div id="ptitles"></div>
|
<div id="ptitles"></div>
|
||||||
</p>
|
</p>
|
||||||
<br>
|
<br>
|
||||||
@@ -199,11 +198,14 @@ if(isset($_POST['startdate'])){
|
|||||||
$lang_count = count($language_ext);
|
$lang_count = count($language_ext);
|
||||||
$lang = (~((int) $langmask)) & ((1 << $lang_count) - 1);
|
$lang = (~((int) $langmask)) & ((1 << $lang_count) - 1);
|
||||||
|
|
||||||
if(isset($_COOKIE['lastlang'])) $lastlang=$_COOKIE['lastlang'];
|
if (isset($_COOKIE['lastlang']))
|
||||||
else $lastlang = 0;
|
$lastlang = $_COOKIE['lastlang'];
|
||||||
|
else
|
||||||
|
$lastlang = 0;
|
||||||
|
|
||||||
for ($i = 0; $i < $lang_count; $i++) {
|
for ($i = 0; $i < $lang_count; $i++) {
|
||||||
if( (1<<$i) & $OJ_LANGMASK ) continue;
|
if ((1 << $i) & $OJ_LANGMASK)
|
||||||
|
continue;
|
||||||
echo "<option value=$i " . ($lang & (1 << $i) ? "selected" : "") . ">" . $language_name[$i] . "</option>";
|
echo "<option value=$i " . ($lang & (1 << $i) ? "selected" : "") . ">" . $language_name[$i] . "</option>";
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
@@ -219,7 +221,8 @@ if(isset($_POST['startdate'])){
|
|||||||
<option value=1 <?php echo $private == '1' ? 'selected=selected' : '' ?>><?php echo $MSG_Private ?></option>
|
<option value=1 <?php echo $private == '1' ? 'selected=selected' : '' ?>><?php echo $MSG_Private ?></option>
|
||||||
</select>
|
</select>
|
||||||
<?php echo $MSG_CONTEST . "-" . $MSG_PASSWORD ?>:
|
<?php echo $MSG_CONTEST . "-" . $MSG_PASSWORD ?>:
|
||||||
<input type=text name=password style="width:150px;" value='<?php echo htmlentities($password,ENT_QUOTES,'utf-8')?>'>
|
<input type=text name=password style="width:150px;"
|
||||||
|
value='<?php echo htmlentities($password, ENT_QUOTES, 'utf-8') ?>'>
|
||||||
</p>
|
</p>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
@@ -230,7 +233,9 @@ if(isset($_POST['startdate'])){
|
|||||||
<?php echo "( Add private contest's userIDs with newline /n )" ?>
|
<?php echo "( Add private contest's userIDs with newline /n )" ?>
|
||||||
<br>
|
<br>
|
||||||
<textarea name='ulist' rows='10' style='width:100%;' placeholder='user1<?php echo "\n" ?>user2<?php echo "\n" ?>user3<?php echo "\n" ?>
|
<textarea name='ulist' rows='10' style='width:100%;' placeholder='user1<?php echo "\n" ?>user2<?php echo "\n" ?>user3<?php echo "\n" ?>
|
||||||
<?php echo $MSG_PRIVATE_USERS_ADD?><?php echo "\n"?>'><?php if(isset($ulist)){ echo $ulist;}?></textarea>
|
<?php echo $MSG_PRIVATE_USERS_ADD ?><?php echo "\n" ?>'><?php if (isset($ulist)) {
|
||||||
|
echo $ulist;
|
||||||
|
} ?></textarea>
|
||||||
</p>
|
</p>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
@@ -263,5 +268,5 @@ if(isset($_POST['startdate'])){
|
|||||||
|
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
|
||||||
|
|
||||||
|
</html>
|
||||||
Reference in New Issue
Block a user