-
-
Notifications
You must be signed in to change notification settings - Fork 3.4k
/
TriggersController.php
82 lines (74 loc) · 2.29 KB
/
TriggersController.php
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
<?php
/**
* Holds the PhpMyAdmin\Controllers\Database\TriggersController
*/
declare(strict_types=1);
namespace PhpMyAdmin\Controllers\Database;
use PhpMyAdmin\Common;
use PhpMyAdmin\Rte\Triggers;
use PhpMyAdmin\Url;
use PhpMyAdmin\Util;
use function in_array;
use function strlen;
/**
* Triggers management.
*/
class TriggersController extends AbstractController
{
public function index(): void
{
global $db, $table, $tables, $num_tables, $total_num_tables, $sub_part, $is_show_stats;
global $db_is_system_schema, $tooltip_truename, $tooltip_aliasname, $pos, $url_query;
global $errors, $titles;
if (! $this->response->isAjax()) {
/**
* Displays the header and tabs
*/
if (! empty($table) && in_array($table, $this->dbi->getTables($db))) {
Common::table();
} else {
$table = '';
Common::database();
list(
$tables,
$num_tables,
$total_num_tables,
$sub_part,
$is_show_stats,
$db_is_system_schema,
$tooltip_truename,
$tooltip_aliasname,
$pos
) = Util::getDbInfo($db, $sub_part ?? '');
}
} else {
/**
* Since we did not include some libraries, we need
* to manually select the required database and
* create the missing $url_query variable
*/
if (strlen($db) > 0) {
$this->dbi->selectDb($db);
if (! isset($url_query)) {
$url_query = Url::getCommon(
[
'db' => $db,
'table' => $table,
]
);
}
}
}
/**
* Create labels for the list
*/
$titles = Util::buildActionTitles();
/**
* Keep a list of errors that occurred while
* processing an 'Add' or 'Edit' operation.
*/
$errors = [];
$triggers = new Triggers($this->dbi, $this->template, $this->response);
$triggers->main();
}
}