Translated using Weblate (Portuguese)
[phpmyadmin.git] / db_routines.php
blobb344d5e29e34e21237291b599f65d9832c4c22ec
1 <?php
2 /* vim: set expandtab sw=4 ts=4 sts=4: */
3 /**
4 * Routines management.
6 * @package PhpMyAdmin
7 */
8 declare(strict_types=1);
10 use PhpMyAdmin\CheckUserPrivileges;
11 use PhpMyAdmin\Controllers\Database\RoutinesController;
12 use PhpMyAdmin\DatabaseInterface;
13 use PhpMyAdmin\Response;
14 use PhpMyAdmin\Url;
15 use PhpMyAdmin\Util;
17 if (! defined('ROOT_PATH')) {
18 define('ROOT_PATH', __DIR__ . DIRECTORY_SEPARATOR);
21 require_once ROOT_PATH . 'libraries/common.inc.php';
23 /** @var Response $response */
24 $response = $containerBuilder->get(Response::class);
26 /** @var DatabaseInterface $dbi */
27 $dbi = $containerBuilder->get(DatabaseInterface::class);
29 /** @var string $db */
30 $db = $containerBuilder->getParameter('db');
32 /** @var string $table */
33 $table = $containerBuilder->getParameter('table');
35 /** @var CheckUserPrivileges $checkUserPrivileges */
36 $checkUserPrivileges = $containerBuilder->get('check_user_privileges');
37 $checkUserPrivileges->getPrivileges();
39 $_PMA_RTE = 'RTN';
41 /** @var RoutinesController $controller */
42 $controller = $containerBuilder->get(RoutinesController::class);
44 if (! $response->isAjax()) {
45 /**
46 * Displays the header and tabs
48 if (! empty($table) && in_array($table, $dbi->getTables($db))) {
49 include_once ROOT_PATH . 'libraries/tbl_common.inc.php';
50 } else {
51 $table = '';
52 include_once ROOT_PATH . 'libraries/db_common.inc.php';
54 list(
55 $tables,
56 $num_tables,
57 $total_num_tables,
58 $sub_part,
59 $is_show_stats,
60 $db_is_system_schema,
61 $tooltip_truename,
62 $tooltip_aliasname,
63 $pos
64 ) = Util::getDbInfo($db, isset($sub_part) ? $sub_part : '');
66 } else {
67 /**
68 * Since we did not include some libraries, we need
69 * to manually select the required database and
70 * create the missing $url_query variable
72 if (strlen($db) > 0) {
73 $dbi->selectDb($db);
74 if (! isset($url_query)) {
75 $url_query = Url::getCommon(
77 'db' => $db,
78 'table' => $table,
85 $controller->index([
86 'type' => $_REQUEST['type'] ?? null,
87 ]);