-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathaction.check_data.php
More file actions
45 lines (43 loc) · 1.21 KB
/
Copy pathaction.check_data.php
File metadata and controls
45 lines (43 loc) · 1.21 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
<?php
/*
This file is part of CMS Made Simple module: Tourney.
Copyright (C) 2014-2016 Tom Phane <tpgww@onepost.net>
Refer to licence and other details at the top of file Tourney.module.php
More info at http://dev.cmsmadesimple.org/projects/tourney
action for ajax-processing, after cancel-button click when editing a comp
new-bracket check is handled otherwise (see $data->added in tmtEditSetup::Setup)
*/
$ret = 0; //default clean
$bracket_id = (int)$params['bracket_id'];
$pref = cms_db_prefix();
$sql = 'SELECT match_id FROM '.$pref.'module_tmt_matches WHERE bracket_id=? AND flags!=0';
$rst = $db->Execute($sql, array($bracket_id));
if ($rst) {
if (!$rst->EOF) {
$ret = 1; //dirty
}
$rst->Close();
}
if ($ret == 0) {
$sql = 'SELECT team_id FROM '.$pref.'module_tmt_teams WHERE bracket_id=? AND flags!=0';
$rst = $db->Execute($sql, array($bracket_id));
if ($rst) {
if (!$rst->EOF) {
$ret = 1;
}
$rst->Close();
}
}
if ($ret == 0) {
$sql = 'SELECT id FROM '.$pref.'module_tmt_people WHERE id IN (SELECT team_id FROM '.
$pref.'module_tmt_teams WHERE bracket_id=?) AND flags!=0';
$rst = $db->Execute($sql, array($bracket_id));
if ($rst) {
if (!$rst->EOF) {
$ret = 1;
}
$rst->Close();
}
}
echo $ret;
?>