aboutsummaryrefslogtreecommitdiffstats
path: root/toj/php/square.php
diff options
context:
space:
mode:
authorpzread <netfirewall@gmail.com>2013-04-21 15:33:11 +0800
committerpzread <netfirewall@gmail.com>2013-04-21 15:33:11 +0800
commitd8ba93f32ca6bf5f412a07756b6443595c7bfda8 (patch)
tree113591dd33a88331eab038b76e05fee4cca804c7 /toj/php/square.php
parent567ecd63584b5fac473e23502f0747aa1f7e97d8 (diff)
downloadtaiwan-online-judge-d8ba93f32ca6bf5f412a07756b6443595c7bfda8.tar
taiwan-online-judge-d8ba93f32ca6bf5f412a07756b6443595c7bfda8.tar.gz
taiwan-online-judge-d8ba93f32ca6bf5f412a07756b6443595c7bfda8.tar.bz2
taiwan-online-judge-d8ba93f32ca6bf5f412a07756b6443595c7bfda8.tar.lz
taiwan-online-judge-d8ba93f32ca6bf5f412a07756b6443595c7bfda8.tar.xz
taiwan-online-judge-d8ba93f32ca6bf5f412a07756b6443595c7bfda8.tar.zst
taiwan-online-judge-d8ba93f32ca6bf5f412a07756b6443595c7bfda8.zip
Use php.ini define include path. Add base personal statistic. Fix some bugs. Improve square event. Add contest sqmod
Diffstat (limited to 'toj/php/square.php')
-rwxr-xr-xtoj/php/square.php24
1 files changed, 20 insertions, 4 deletions
diff --git a/toj/php/square.php b/toj/php/square.php
index c95c584..fb87741 100755
--- a/toj/php/square.php
+++ b/toj/php/square.php
@@ -2,6 +2,7 @@
//ini_set("display_errors", "On");
require_once('square.inc.php');
+require_once('event.inc.php');
$sqlc = db_connect();
@@ -44,6 +45,9 @@ if($action == 'add_sq')
if(!$res2)
die('Eadd_admin_failed');
+ if(event::exec_func('../sqmod/'.$sq->sqmodname.'/'.$sq->sqmodname.'.inc.php','event_create',[$res->sqid]) === false)
+ die('Eevent_error');
+
echo('S');
}
if($action == 'delete_sq')
@@ -59,13 +63,17 @@ if($action == 'delete_sq')
die('Epermission_denied');
$sqid = intval($sq->sqid);
- if(!square::get($sqlc, $sqid))
- die('Eno_such_sq');
+ $sq = square::get($sqlc, $sqid);
+ if(!$sq)
+ die('Ewrong_sqid');
$res = square::del($sqlc, $sqid);
if(!$res)
die('Edelete_failed');
+ if(event::exec_func('../sqmod/'.$sq->sqmodname.'/'.$sq->sqmodname.'.inc.php','event_destroy',[$sq->sqid]) === false)
+ die('Eevent_error');
+
echo('S');
}
if($action == 'edit_sq')
@@ -313,7 +321,8 @@ if($action == 'add_pro_into_sq')
if(!problem::is_available($sqlc, $dt->proid))
die('Ewrong_proid');
- if(!square::get($sqlc, $dt->sqid))
+ $sq = square::get($sqlc, $dt->sqid);
+ if(!$sq)
die('Ewrong_sqid');
$adm = sec_check_level($sqlc, USER_LEVEL_SUPERADMIN) || square::get_user_relationship($sqlc, $uid, $dt->sqid) >= SQUARE_USER_ADMIN;
@@ -328,6 +337,9 @@ if($action == 'add_pro_into_sq')
if(!$ret)
die('Eadd_problem_into_square_failed');
+ if(event::exec_func('../sqmod/'.$sq->sqmodname.'/'.$sq->sqmodname.'.inc.php','event_add_pro',[$sq->sqid, $dt->proid]) === false)
+ die('Eevent_error');
+
echo('S');
}
if($action == 'delete_pro_from_sq')
@@ -343,7 +355,8 @@ if($action == 'delete_pro_from_sq')
$dt = json_decode($data);
- if(!square::get($sqlc, $dt->sqid))
+ $sq = square::get($sqlc, $dt->sqid);
+ if(!$sq)
die('Ewrong_sqid');
$adm = sec_check_level($sqlc, USER_LEVEL_SUPERADMIN) || square::get_user_relationship($sqlc, $uid, $dt->sqid) >= SQUARE_USER_ADMIN;
@@ -358,6 +371,9 @@ if($action == 'delete_pro_from_sq')
if(!$ret)
die('Edelete_problem_from_square_failed');
+ if(event::exec_func('../sqmod/'.$sq->sqmodname.'/'.$sq->sqmodname.'.inc.php','event_del_pro',[$sq->sqid, $dt->proid]) === false)
+ die('Eevent_error');
+
echo('S');
}