Дозаливка
This commit is contained in:
@@ -0,0 +1,441 @@
|
||||
<?php
|
||||
/* vim: set expandtab sw=4 ts=4 sts=4: */
|
||||
/**
|
||||
* Functionality for the navigation tree in the left frame
|
||||
*
|
||||
* @package PhpMyAdmin-Navigation
|
||||
*/
|
||||
if (! defined('PHPMYADMIN')) {
|
||||
exit;
|
||||
}
|
||||
|
||||
/**
|
||||
* The Node is the building block for the collapsible navigation tree
|
||||
*
|
||||
* @package PhpMyAdmin-Navigation
|
||||
*/
|
||||
class Node
|
||||
{
|
||||
/**
|
||||
* @var int Defines a possible node type
|
||||
*/
|
||||
const CONTAINER = 0;
|
||||
|
||||
/**
|
||||
* @var int Defines a possible node type
|
||||
*/
|
||||
const OBJECT = 1;
|
||||
|
||||
/**
|
||||
* @var string A non-unique identifier for the node
|
||||
* This may be trimmed when grouping nodes
|
||||
*/
|
||||
public $name = "";
|
||||
|
||||
/**
|
||||
* @var string A non-unique identifier for the node
|
||||
* This will never change after being assigned
|
||||
*/
|
||||
public $real_name = "";
|
||||
|
||||
/**
|
||||
* @var int May be one of CONTAINER or OBJECT
|
||||
*/
|
||||
public $type = Node::OBJECT;
|
||||
|
||||
/**
|
||||
* @var bool Whether this object has been created while grouping nodes
|
||||
* Only relevant if the node is of type CONTAINER
|
||||
*/
|
||||
public $is_group;
|
||||
|
||||
/**
|
||||
* @var bool Whether to add a "display: none;" CSS
|
||||
* rule to the node when rendering it
|
||||
*/
|
||||
public $visible = false;
|
||||
|
||||
/**
|
||||
* @var Node A reference to the parent object of
|
||||
* this node, NULL for the root node.
|
||||
*/
|
||||
public $parent;
|
||||
|
||||
/**
|
||||
* @var array An array of Node objects that are
|
||||
* direct children of this node
|
||||
*/
|
||||
public $children = array();
|
||||
|
||||
/**
|
||||
* @var Mixed A string used to group nodes, or an array of strings
|
||||
* Only relevant if the node is of type CONTAINER
|
||||
*/
|
||||
public $separator = '';
|
||||
|
||||
/**
|
||||
* @var int How many time to recursively apply the grouping function
|
||||
* Only relevant if the node is of type CONTAINER
|
||||
*/
|
||||
public $separator_depth = 1;
|
||||
|
||||
/**
|
||||
* @var string An IMG tag, used when rendering the node
|
||||
*/
|
||||
public $icon;
|
||||
|
||||
/**
|
||||
* @var Array An array of A tags, used when rendering the node
|
||||
* The indexes in the array may be 'icon' and 'text'
|
||||
*/
|
||||
public $links;
|
||||
|
||||
/**
|
||||
* @var string Extra CSS classes for the node
|
||||
*/
|
||||
public $classes = '';
|
||||
|
||||
/**
|
||||
* @var string Whether this node is a link for creating new objects
|
||||
*/
|
||||
public $isNew = false;
|
||||
|
||||
/**
|
||||
* @var int The position for the pagination of
|
||||
* the branch at the second level of the tree
|
||||
*/
|
||||
public $pos2 = 0;
|
||||
|
||||
/**
|
||||
* @var int The position for the pagination of
|
||||
* the branch at the third level of the tree
|
||||
*/
|
||||
public $pos3 = 0;
|
||||
|
||||
/**
|
||||
* Initialises the class by setting the mandatory variables
|
||||
*
|
||||
* @param string $name An identifier for the new node
|
||||
* @param int $type Type of node, may be one of CONTAINER or OBJECT
|
||||
* @param bool $is_group Whether this object has been created
|
||||
* while grouping nodes
|
||||
*
|
||||
* @return Node
|
||||
*/
|
||||
public function __construct($name, $type = Node::OBJECT, $is_group = false)
|
||||
{
|
||||
if (! empty($name)) {
|
||||
$this->name = $name;
|
||||
$this->real_name = $name;
|
||||
}
|
||||
if ($type === Node::CONTAINER) {
|
||||
$this->type = Node::CONTAINER;
|
||||
}
|
||||
$this->is_group = (bool)$is_group;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a child node to this node
|
||||
*
|
||||
* @param Node $child A child node
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function addChild($child)
|
||||
{
|
||||
$this->children[] = $child;
|
||||
$child->parent = $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a child node given it's name
|
||||
*
|
||||
* @param string $name The name of requested child
|
||||
* @param bool $real_name Whether to use the "real_name"
|
||||
* instead of "name" in comparisons
|
||||
*
|
||||
* @return false|Node The requested child node or false,
|
||||
* if the requested node cannot be found
|
||||
*/
|
||||
public function getChild($name, $real_name = false)
|
||||
{
|
||||
if ($real_name) {
|
||||
foreach ($this->children as $child) {
|
||||
if ($child->real_name == $name) {
|
||||
return $child;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
foreach ($this->children as $child) {
|
||||
if ($child->name == $name) {
|
||||
return $child;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes a child node from this node
|
||||
*
|
||||
* @param string $name The name of child to be removed
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function removeChild($name)
|
||||
{
|
||||
foreach ($this->children as $key => $child) {
|
||||
if ($child->name == $name) {
|
||||
unset($this->children[$key]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Retreives the parents for a node
|
||||
*
|
||||
* @param bool $self Whether to include the Node itself in the results
|
||||
* @param bool $containers Whether to include nodes of type CONTAINER
|
||||
* @param bool $groups Whether to include nodes which have $group == true
|
||||
*
|
||||
* @return array An array of parent Nodes
|
||||
*/
|
||||
public function parents($self = false, $containers = false, $groups = false)
|
||||
{
|
||||
$parents = array();
|
||||
if ($self
|
||||
&& ($this->type != Node::CONTAINER || $containers)
|
||||
&& ($this->is_group != true || $groups)
|
||||
) {
|
||||
$parents[] = $this;
|
||||
$self = false;
|
||||
}
|
||||
$parent = $this->parent;
|
||||
while (isset($parent)) {
|
||||
if ( ($parent->type != Node::CONTAINER || $containers)
|
||||
&& ($parent->is_group != true || $groups)
|
||||
) {
|
||||
$parents[] = $parent;
|
||||
}
|
||||
$parent = $parent->parent;
|
||||
}
|
||||
return $parents;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the actual parent of a node. If used twice on an index or columns
|
||||
* node, it will return the table and database nodes. The names of the returned
|
||||
* nodes can be used in SQL queries, etc...
|
||||
*
|
||||
* @return Node
|
||||
*/
|
||||
public function realParent()
|
||||
{
|
||||
$retval = $this->parents();
|
||||
if (count($retval) > 0) {
|
||||
return $retval[0];
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* This function checks if the node has children nodes associated with it
|
||||
*
|
||||
* @param bool $count_empty_containers Whether to count empty child
|
||||
* containers as valid children
|
||||
*
|
||||
* @return bool Whether the node has child nodes
|
||||
*/
|
||||
public function hasChildren($count_empty_containers = true)
|
||||
{
|
||||
$retval = false;
|
||||
if ($count_empty_containers) {
|
||||
if (count($this->children)) {
|
||||
$retval = true;
|
||||
}
|
||||
} else {
|
||||
foreach ($this->children as $child) {
|
||||
if ($child->type == Node::OBJECT || $child->hasChildren(false)) {
|
||||
$retval = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return $retval;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true the node has some siblings (other nodes on the same tree level,
|
||||
* in the same branch), false otherwise. The only exception is for nodes on
|
||||
* the third level of the tree (columns and indexes), for which the function
|
||||
* always returns true. This is because we want to render the containers
|
||||
* for these nodes
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function hasSiblings()
|
||||
{
|
||||
$retval = false;
|
||||
$paths = $this->getPaths();
|
||||
if (count($paths['aPath_clean']) > 3) {
|
||||
$retval = true;
|
||||
} else {
|
||||
foreach ($this->parent->children as $child) {
|
||||
if ($child !== $this
|
||||
&& ($child->type == Node::OBJECT || $child->hasChildren(false))
|
||||
) {
|
||||
$retval = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return $retval;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the number of child nodes that a node has associated with it
|
||||
*
|
||||
* @return int The number of children nodes
|
||||
*/
|
||||
public function numChildren()
|
||||
{
|
||||
$retval = 0;
|
||||
foreach ($this->children as $child) {
|
||||
if ($child->type == Node::OBJECT) {
|
||||
$retval++;
|
||||
} else {
|
||||
$retval += $child->numChildren();
|
||||
}
|
||||
}
|
||||
return $retval;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the actual path and the virtual paths for a node
|
||||
* both as clean arrays and base64 encoded strings
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getPaths()
|
||||
{
|
||||
$aPath = array();
|
||||
$aPath_clean = array();
|
||||
foreach ($this->parents(true, true, false) as $parent) {
|
||||
$aPath[] = base64_encode($parent->real_name);
|
||||
$aPath_clean[] = $parent->real_name;
|
||||
}
|
||||
$aPath = implode('.', array_reverse($aPath));
|
||||
$aPath_clean = array_reverse($aPath_clean);
|
||||
|
||||
$vPath = array();
|
||||
$vPath_clean = array();
|
||||
foreach ($this->parents(true, true, true) as $parent) {
|
||||
$vPath[] = base64_encode($parent->name);
|
||||
$vPath_clean[] = $parent->name;
|
||||
}
|
||||
$vPath = implode('.', array_reverse($vPath));
|
||||
$vPath_clean = array_reverse($vPath_clean);
|
||||
|
||||
return array(
|
||||
'aPath' => $aPath,
|
||||
'aPath_clean' => $aPath_clean,
|
||||
'vPath' => $vPath,
|
||||
'vPath_clean' => $vPath_clean
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the names of children of type $type present inside this container
|
||||
* This method is overridden by the Node_Database and Node_Table classes
|
||||
*
|
||||
* @param string $type The type of item we are looking for
|
||||
* ('tables', 'views', etc)
|
||||
* @param int $pos The offset of the list within the results
|
||||
* @param string $searchClause A string used to filter the results of the query
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getData($type, $pos, $searchClause = '')
|
||||
{
|
||||
$query = "SELECT `SCHEMA_NAME` ";
|
||||
$query .= "FROM `INFORMATION_SCHEMA`.`SCHEMATA` ";
|
||||
$query .= $this->_getWhereClause($searchClause);
|
||||
$query .= "ORDER BY `SCHEMA_NAME` ASC ";
|
||||
$query .= "LIMIT $pos, {$GLOBALS['cfg']['MaxNavigationItems']}";
|
||||
return $GLOBALS['dbi']->fetchResult($query);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the number of children of type $type present inside this container
|
||||
* This method is overridden by the Node_Database and Node_Table classes
|
||||
*
|
||||
* @param string $type The type of item we are looking for
|
||||
* ('tables', 'views', etc)
|
||||
* @param string $searchClause A string used to filter the results of the query
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getPresence($type = '', $searchClause = '')
|
||||
{
|
||||
$query = "SELECT COUNT(*) ";
|
||||
$query .= "FROM `INFORMATION_SCHEMA`.`SCHEMATA` ";
|
||||
$query .= $this->_getWhereClause($searchClause);
|
||||
$retval = (int)$GLOBALS['dbi']->fetchValue($query);
|
||||
return $retval;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the WHERE clause depending on the $searchClause parameter
|
||||
* and the hide_db directive
|
||||
*
|
||||
* @param string $searchClause A string used to filter the results of the query
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
private function _getWhereClause($searchClause = '')
|
||||
{
|
||||
$whereClause = "WHERE TRUE ";
|
||||
if (! empty($searchClause)) {
|
||||
$whereClause .= "AND `SCHEMA_NAME` LIKE '%";
|
||||
$whereClause .= PMA_Util::sqlAddSlashes(
|
||||
$searchClause, true
|
||||
);
|
||||
$whereClause .= "%' ";
|
||||
}
|
||||
|
||||
if (! empty($GLOBALS['cfg']['Server']['hide_db'])) {
|
||||
$whereClause .= "AND `SCHEMA_NAME` NOT REGEXP '"
|
||||
. $GLOBALS['cfg']['Server']['hide_db'] . "' ";
|
||||
}
|
||||
|
||||
if (! empty($GLOBALS['cfg']['Server']['only_db'])) {
|
||||
if (is_string($GLOBALS['cfg']['Server']['only_db'])) {
|
||||
$GLOBALS['cfg']['Server']['only_db'] = array(
|
||||
$GLOBALS['cfg']['Server']['only_db']
|
||||
);
|
||||
}
|
||||
$whereClause .= "AND (";
|
||||
$subClauses = array();
|
||||
foreach ($GLOBALS['cfg']['Server']['only_db'] as $each_only_db) {
|
||||
$subClauses[] = " `SCHEMA_NAME` LIKE '"
|
||||
. $each_only_db . "' ";
|
||||
}
|
||||
$whereClause .= implode("OR", $subClauses) . ")";
|
||||
}
|
||||
return $whereClause;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns HTML for control buttons displayed infront of a node
|
||||
*
|
||||
* @return String HTML for control buttons
|
||||
*/
|
||||
public function getHtmlForControlButtons()
|
||||
{
|
||||
return '';
|
||||
}
|
||||
}
|
||||
?>
|
||||
@@ -0,0 +1,46 @@
|
||||
<?php
|
||||
/* vim: set expandtab sw=4 ts=4 sts=4: */
|
||||
/**
|
||||
* Functionality for the navigation tree
|
||||
*
|
||||
* @package PhpMyAdmin-Navigation
|
||||
*/
|
||||
if (! defined('PHPMYADMIN')) {
|
||||
exit;
|
||||
}
|
||||
|
||||
/**
|
||||
* Represents a columns node in the navigation tree
|
||||
*
|
||||
* @package PhpMyAdmin-Navigation
|
||||
*/
|
||||
class Node_Column extends Node
|
||||
{
|
||||
/**
|
||||
* Initialises the class
|
||||
*
|
||||
* @param string $name An identifier for the new node
|
||||
* @param int $type Type of node, may be one of CONTAINER or OBJECT
|
||||
* @param bool $is_group Whether this object has been created
|
||||
* while grouping nodes
|
||||
*
|
||||
* @return Node_Column
|
||||
*/
|
||||
public function __construct($name, $type = Node::OBJECT, $is_group = false)
|
||||
{
|
||||
parent::__construct($name, $type, $is_group);
|
||||
$this->icon = PMA_Util::getImage('pause.png', __('Column'));
|
||||
$this->links = array(
|
||||
'text' => 'tbl_structure.php?server=' . $GLOBALS['server']
|
||||
. '&db=%3$s&table=%2$s&field=%1$s'
|
||||
. '&change_column=1'
|
||||
. '&token=' . $GLOBALS['token'],
|
||||
'icon' => 'tbl_structure.php?server=' . $GLOBALS['server']
|
||||
. '&db=%3$s&table=%2$s&field=%1$s'
|
||||
. '&change_column=1'
|
||||
. '&token=' . $GLOBALS['token']
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,57 @@
|
||||
<?php
|
||||
/* vim: set expandtab sw=4 ts=4 sts=4: */
|
||||
/**
|
||||
* Functionality for the navigation tree
|
||||
*
|
||||
* @package PhpMyAdmin-Navigation
|
||||
*/
|
||||
if (! defined('PHPMYADMIN')) {
|
||||
exit;
|
||||
}
|
||||
|
||||
/**
|
||||
* Represents a container for column nodes in the navigation tree
|
||||
*
|
||||
* @package PhpMyAdmin-Navigation
|
||||
*/
|
||||
class Node_Column_Container extends Node
|
||||
{
|
||||
/**
|
||||
* Initialises the class
|
||||
*
|
||||
* @return Node_Column_Container
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct(__('Columns'), Node::CONTAINER);
|
||||
$this->icon = PMA_Util::getImage('pause.png', __('Columns'));
|
||||
$this->links = array(
|
||||
'text' => 'tbl_structure.php?server=' . $GLOBALS['server']
|
||||
. '&db=%2$s&table=%1$s'
|
||||
. '&token=' . $GLOBALS['token'],
|
||||
'icon' => 'tbl_structure.php?server=' . $GLOBALS['server']
|
||||
. '&db=%2$s&table=%1$s'
|
||||
. '&token=' . $GLOBALS['token'],
|
||||
);
|
||||
$this->real_name = 'columns';
|
||||
|
||||
$new_label = _pgettext('Create new column', 'New');
|
||||
$new = PMA_NodeFactory::getInstance('Node', $new_label);
|
||||
$new->isNew = true;
|
||||
$new->icon = PMA_Util::getImage('b_column_add.png', $new_label);
|
||||
$new->links = array(
|
||||
'text' => 'tbl_addfield.php?server=' . $GLOBALS['server']
|
||||
. '&db=%3$s&table=%2$s'
|
||||
. '&field_where=last&after_field='
|
||||
. '&token=' . $GLOBALS['token'],
|
||||
'icon' => 'tbl_addfield.php?server=' . $GLOBALS['server']
|
||||
. '&db=%3$s&table=%2$s'
|
||||
. '&field_where=last&after_field='
|
||||
. '&token=' . $GLOBALS['token'],
|
||||
);
|
||||
$new->classes = 'new_column italics';
|
||||
$this->addChild($new);
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,327 @@
|
||||
<?php
|
||||
/* vim: set expandtab sw=4 ts=4 sts=4: */
|
||||
/**
|
||||
* Functionality for the navigation tree
|
||||
*
|
||||
* @package PhpMyAdmin-Navigation
|
||||
*/
|
||||
if (! defined('PHPMYADMIN')) {
|
||||
exit;
|
||||
}
|
||||
|
||||
/**
|
||||
* Represents a database node in the navigation tree
|
||||
*
|
||||
* @package PhpMyAdmin-Navigation
|
||||
*/
|
||||
class Node_Database extends Node
|
||||
{
|
||||
/**
|
||||
* Initialises the class
|
||||
*
|
||||
* @param string $name An identifier for the new node
|
||||
* @param int $type Type of node, may be one of CONTAINER or OBJECT
|
||||
* @param bool $is_group Whether this object has been created
|
||||
* while grouping nodes
|
||||
*
|
||||
* @return Node_Database
|
||||
*/
|
||||
public function __construct($name, $type = Node::OBJECT, $is_group = false)
|
||||
{
|
||||
parent::__construct($name, $type, $is_group);
|
||||
$this->icon = PMA_Util::getImage(
|
||||
's_db.png',
|
||||
__('Database operations')
|
||||
);
|
||||
$this->links = array(
|
||||
'text' => $GLOBALS['cfg']['DefaultTabDatabase']
|
||||
. '?server=' . $GLOBALS['server']
|
||||
. '&db=%1$s&token=' . $GLOBALS['token'],
|
||||
'icon' => 'db_operations.php?server=' . $GLOBALS['server']
|
||||
. '&db=%1$s&token=' . $GLOBALS['token']
|
||||
);
|
||||
$this->classes = 'database';
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the number of children of type $type present inside this container
|
||||
* This method is overridden by the Node_Database and Node_Table classes
|
||||
*
|
||||
* @param string $type The type of item we are looking for
|
||||
* ('tables', 'views', etc)
|
||||
* @param string $searchClause A string used to filter the results of the query
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getPresence($type = '', $searchClause = '')
|
||||
{
|
||||
$retval = 0;
|
||||
$db = $this->real_name;
|
||||
switch ($type) {
|
||||
case 'tables':
|
||||
$db = PMA_Util::sqlAddSlashes($db);
|
||||
$query = "SELECT COUNT(*) ";
|
||||
$query .= "FROM `INFORMATION_SCHEMA`.`TABLES` ";
|
||||
$query .= "WHERE `TABLE_SCHEMA`='$db' ";
|
||||
if (PMA_DRIZZLE) {
|
||||
$query .= "AND `TABLE_TYPE`='BASE' ";
|
||||
} else {
|
||||
$query .= "AND `TABLE_TYPE`='BASE TABLE' ";
|
||||
}
|
||||
if (! empty($searchClause)) {
|
||||
$query .= "AND `TABLE_NAME` LIKE '%";
|
||||
$query .= PMA_Util::sqlAddSlashes(
|
||||
$searchClause, true
|
||||
);
|
||||
$query .= "%'";
|
||||
}
|
||||
$retval = (int)$GLOBALS['dbi']->fetchValue($query);
|
||||
break;
|
||||
case 'views':
|
||||
$db = PMA_Util::sqlAddSlashes($db);
|
||||
$query = "SELECT COUNT(*) ";
|
||||
$query .= "FROM `INFORMATION_SCHEMA`.`TABLES` ";
|
||||
$query .= "WHERE `TABLE_SCHEMA`='$db' ";
|
||||
if (PMA_DRIZZLE) {
|
||||
$query .= "AND `TABLE_TYPE`!='BASE' ";
|
||||
} else {
|
||||
$query .= "AND `TABLE_TYPE`!='BASE TABLE' ";
|
||||
}
|
||||
if (! empty($searchClause)) {
|
||||
$query .= "AND `TABLE_NAME` LIKE '%";
|
||||
$query .= PMA_Util::sqlAddSlashes(
|
||||
$searchClause, true
|
||||
);
|
||||
$query .= "%'";
|
||||
}
|
||||
$retval = (int)$GLOBALS['dbi']->fetchValue($query);
|
||||
break;
|
||||
case 'procedures':
|
||||
$db = PMA_Util::sqlAddSlashes($db);
|
||||
$query = "SELECT COUNT(*) ";
|
||||
$query .= "FROM `INFORMATION_SCHEMA`.`ROUTINES` ";
|
||||
$query .= "WHERE `ROUTINE_SCHEMA`='$db'";
|
||||
$query .= "AND `ROUTINE_TYPE`='PROCEDURE' ";
|
||||
if (! empty($searchClause)) {
|
||||
$query .= "AND `ROUTINE_NAME` LIKE '%";
|
||||
$query .= PMA_Util::sqlAddSlashes(
|
||||
$searchClause, true
|
||||
);
|
||||
$query .= "%'";
|
||||
}
|
||||
$retval = (int)$GLOBALS['dbi']->fetchValue($query);
|
||||
break;
|
||||
case 'functions':
|
||||
$db = PMA_Util::sqlAddSlashes($db);
|
||||
$query = "SELECT COUNT(*) ";
|
||||
$query .= "FROM `INFORMATION_SCHEMA`.`ROUTINES` ";
|
||||
$query .= "WHERE `ROUTINE_SCHEMA`='$db' ";
|
||||
$query .= "AND `ROUTINE_TYPE`='FUNCTION' ";
|
||||
if (! empty($searchClause)) {
|
||||
$query .= "AND `ROUTINE_NAME` LIKE '%";
|
||||
$query .= PMA_Util::sqlAddSlashes(
|
||||
$searchClause, true
|
||||
);
|
||||
$query .= "%'";
|
||||
}
|
||||
$retval = (int)$GLOBALS['dbi']->fetchValue($query);
|
||||
break;
|
||||
case 'events':
|
||||
$db = PMA_Util::sqlAddSlashes($db);
|
||||
$query = "SELECT COUNT(*) ";
|
||||
$query .= "FROM `INFORMATION_SCHEMA`.`EVENTS` ";
|
||||
$query .= "WHERE `EVENT_SCHEMA`='$db' ";
|
||||
if (! empty($searchClause)) {
|
||||
$query .= "AND `EVENT_NAME` LIKE '%";
|
||||
$query .= PMA_Util::sqlAddSlashes(
|
||||
$searchClause, true
|
||||
);
|
||||
$query .= "%'";
|
||||
}
|
||||
$retval = (int)$GLOBALS['dbi']->fetchValue($query);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return $retval;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the names of children of type $type present inside this container
|
||||
* This method is overridden by the Node_Database and Node_Table classes
|
||||
*
|
||||
* @param string $type The type of item we are looking for
|
||||
* ('tables', 'views', etc)
|
||||
* @param int $pos The offset of the list within the results
|
||||
* @param string $searchClause A string used to filter the results of the query
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getData($type, $pos, $searchClause = '')
|
||||
{
|
||||
$maxItems = $GLOBALS['cfg']['MaxNavigationItems'];
|
||||
$retval = array();
|
||||
$db = $this->real_name;
|
||||
switch ($type) {
|
||||
case 'tables':
|
||||
$escdDb = PMA_Util::sqlAddSlashes($db);
|
||||
$query = "SELECT `TABLE_NAME` AS `name` ";
|
||||
$query .= "FROM `INFORMATION_SCHEMA`.`TABLES` ";
|
||||
$query .= "WHERE `TABLE_SCHEMA`='$escdDb' ";
|
||||
if (PMA_DRIZZLE) {
|
||||
$query .= "AND `TABLE_TYPE`='BASE' ";
|
||||
} else {
|
||||
$query .= "AND `TABLE_TYPE`='BASE TABLE' ";
|
||||
}
|
||||
if (! empty($searchClause)) {
|
||||
$query .= "AND `TABLE_NAME` LIKE '%";
|
||||
$query .= PMA_Util::sqlAddSlashes(
|
||||
$searchClause, true
|
||||
);
|
||||
$query .= "%'";
|
||||
}
|
||||
$query .= "ORDER BY `TABLE_NAME` ASC ";
|
||||
$query .= "LIMIT " . intval($pos) . ", $maxItems";
|
||||
$retval = $GLOBALS['dbi']->fetchResult($query);
|
||||
break;
|
||||
case 'views':
|
||||
$escdDb = PMA_Util::sqlAddSlashes($db);
|
||||
$query = "SELECT `TABLE_NAME` AS `name` ";
|
||||
$query .= "FROM `INFORMATION_SCHEMA`.`TABLES` ";
|
||||
$query .= "WHERE `TABLE_SCHEMA`='$escdDb' ";
|
||||
if (PMA_DRIZZLE) {
|
||||
$query .= "AND `TABLE_TYPE`!='BASE' ";
|
||||
} else {
|
||||
$query .= "AND `TABLE_TYPE`!='BASE TABLE' ";
|
||||
}
|
||||
if (! empty($searchClause)) {
|
||||
$query .= "AND `TABLE_NAME` LIKE '%";
|
||||
$query .= PMA_Util::sqlAddSlashes(
|
||||
$searchClause, true
|
||||
);
|
||||
$query .= "%'";
|
||||
}
|
||||
$query .= "ORDER BY `TABLE_NAME` ASC ";
|
||||
$query .= "LIMIT " . intval($pos) . ", $maxItems";
|
||||
$retval = $GLOBALS['dbi']->fetchResult($query);
|
||||
break;
|
||||
case 'procedures':
|
||||
$escdDb = PMA_Util::sqlAddSlashes($db);
|
||||
$query = "SELECT `ROUTINE_NAME` AS `name` ";
|
||||
$query .= "FROM `INFORMATION_SCHEMA`.`ROUTINES` ";
|
||||
$query .= "WHERE `ROUTINE_SCHEMA`='$escdDb'";
|
||||
$query .= "AND `ROUTINE_TYPE`='PROCEDURE' ";
|
||||
if (! empty($searchClause)) {
|
||||
$query .= "AND `ROUTINE_NAME` LIKE '%";
|
||||
$query .= PMA_Util::sqlAddSlashes(
|
||||
$searchClause, true
|
||||
);
|
||||
$query .= "%'";
|
||||
}
|
||||
$query .= "ORDER BY `ROUTINE_NAME` ASC ";
|
||||
$query .= "LIMIT " . intval($pos) . ", $maxItems";
|
||||
$retval = $GLOBALS['dbi']->fetchResult($query);
|
||||
break;
|
||||
case 'functions':
|
||||
$escdDb = PMA_Util::sqlAddSlashes($db);
|
||||
$query = "SELECT `ROUTINE_NAME` AS `name` ";
|
||||
$query .= "FROM `INFORMATION_SCHEMA`.`ROUTINES` ";
|
||||
$query .= "WHERE `ROUTINE_SCHEMA`='$escdDb' ";
|
||||
$query .= "AND `ROUTINE_TYPE`='FUNCTION' ";
|
||||
if (! empty($searchClause)) {
|
||||
$query .= "AND `ROUTINE_NAME` LIKE '%";
|
||||
$query .= PMA_Util::sqlAddSlashes(
|
||||
$searchClause, true
|
||||
);
|
||||
$query .= "%'";
|
||||
}
|
||||
$query .= "ORDER BY `ROUTINE_NAME` ASC ";
|
||||
$query .= "LIMIT " . intval($pos) . ", $maxItems";
|
||||
$retval = $GLOBALS['dbi']->fetchResult($query);
|
||||
break;
|
||||
case 'events':
|
||||
$escdDb = PMA_Util::sqlAddSlashes($db);
|
||||
$query = "SELECT `EVENT_NAME` AS `name` ";
|
||||
$query .= "FROM `INFORMATION_SCHEMA`.`EVENTS` ";
|
||||
$query .= "WHERE `EVENT_SCHEMA`='$escdDb' ";
|
||||
if (! empty($searchClause)) {
|
||||
$query .= "AND `EVENT_NAME` LIKE '%";
|
||||
$query .= PMA_Util::sqlAddSlashes(
|
||||
$searchClause, true
|
||||
);
|
||||
$query .= "%'";
|
||||
}
|
||||
$query .= "ORDER BY `EVENT_NAME` ASC ";
|
||||
$query .= "LIMIT " . intval($pos) . ", $maxItems";
|
||||
$retval = $GLOBALS['dbi']->fetchResult($query);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
// Remove hidden items so that they are not displayed in navigation tree
|
||||
$cfgRelation = PMA_getRelationsParam();
|
||||
if ($cfgRelation['navwork']) {
|
||||
$navTable = PMA_Util::backquote($cfgRelation['db'])
|
||||
. "." . PMA_Util::backquote($cfgRelation['navigationhiding']);
|
||||
$sqlQuery = "SELECT `item_name` FROM " . $navTable
|
||||
. " WHERE `username`='" . $cfgRelation['user'] . "'"
|
||||
. " AND `item_type`='" . substr($type, 0, -1) . "'"
|
||||
. " AND `db_name`='" . PMA_Util::sqlAddSlashes($db) . "'";
|
||||
$result = PMA_queryAsControlUser($sqlQuery, false);
|
||||
if ($result) {
|
||||
$hiddenItems = array();
|
||||
while ($row = $GLOBALS['dbi']->fetchArray($result)) {
|
||||
$hiddenItems[] = $row[0];
|
||||
}
|
||||
foreach ($retval as $key => $item) {
|
||||
if (in_array($item, $hiddenItems)) {
|
||||
unset($retval[$key]);
|
||||
}
|
||||
}
|
||||
}
|
||||
$GLOBALS['dbi']->freeResult($result);
|
||||
}
|
||||
|
||||
return $retval;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns HTML for show hidden button displayed infront of database node
|
||||
*
|
||||
* @return String HTML for show hidden button
|
||||
*/
|
||||
public function getHtmlForControlButtons()
|
||||
{
|
||||
$ret = '';
|
||||
$db = $this->real_name;
|
||||
|
||||
$cfgRelation = PMA_getRelationsParam();
|
||||
if ($cfgRelation['navwork']) {
|
||||
$navTable = PMA_Util::backquote($cfgRelation['db'])
|
||||
. "." . PMA_Util::backquote($cfgRelation['navigationhiding']);
|
||||
$sqlQuery = "SELECT COUNT(*) FROM " . $navTable
|
||||
. " WHERE `username`='"
|
||||
. PMA_Util::sqlAddSlashes($GLOBALS['cfg']['Server']['user']) ."'"
|
||||
. " AND `db_name`='" . PMA_Util::sqlAddSlashes($db) . "'";
|
||||
$count = $GLOBALS['dbi']->fetchValue(
|
||||
$sqlQuery, 0, 0, $GLOBALS['controllink']
|
||||
);
|
||||
if ($count > 0) {
|
||||
$ret = '<span class="dbItemControls">'
|
||||
. '<a href="navigation.php?'
|
||||
. PMA_URL_getCommon()
|
||||
. '&showUnhideDialog=true'
|
||||
. '&dbName=' . urldecode($db) . '"'
|
||||
. ' class="showUnhide ajax">'
|
||||
. PMA_Util::getImage(
|
||||
'lightbulb.png', __('Show hidden items')
|
||||
)
|
||||
. '</a></span>';
|
||||
}
|
||||
}
|
||||
return $ret;
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,52 @@
|
||||
<?php
|
||||
/* vim: set expandtab sw=4 ts=4 sts=4: */
|
||||
/**
|
||||
* Functionality for the navigation tree
|
||||
*
|
||||
* @package PhpMyAdmin-Navigation
|
||||
*/
|
||||
if (! defined('PHPMYADMIN')) {
|
||||
exit;
|
||||
}
|
||||
|
||||
/**
|
||||
* Represents a node that is a concrete child of a database node
|
||||
*
|
||||
* @package PhpMyAdmin-Navigation
|
||||
*/
|
||||
abstract class Node_DatabaseChild extends Node
|
||||
{
|
||||
/**
|
||||
* Returns HTML for hide button displayed infront of the database child node
|
||||
*
|
||||
* @return String HTML for hide button
|
||||
*/
|
||||
public function getHtmlForControlButtons()
|
||||
{
|
||||
$ret = '';
|
||||
$cfgRelation = PMA_getRelationsParam();
|
||||
if ($cfgRelation['navwork']) {
|
||||
$db = $this->realParent()->real_name;
|
||||
$item = $this->real_name;
|
||||
$ret = '<span class="navItemControls">'
|
||||
. '<a href="navigation.php?'
|
||||
. PMA_URL_getCommon()
|
||||
. '&hideNavItem=true'
|
||||
. '&itemType=' . urlencode($this->getItemType())
|
||||
. '&itemName=' . urlencode($item)
|
||||
. '&dbName=' . urlencode($db) . '"'
|
||||
. ' class="hideNavItem ajax">'
|
||||
. PMA_Util::getImage('lightbulb_off', __('Hide'))
|
||||
. '</a></span>';
|
||||
}
|
||||
return $ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the type of the item reprsented by the node.
|
||||
*
|
||||
* @return string type of the item
|
||||
*/
|
||||
protected abstract function getItemType();
|
||||
}
|
||||
?>
|
||||
@@ -0,0 +1,49 @@
|
||||
<?php
|
||||
/* vim: set expandtab sw=4 ts=4 sts=4: */
|
||||
/**
|
||||
* Functionality for the navigation tree
|
||||
*
|
||||
* @package PhpMyAdmin-Navigation
|
||||
*/
|
||||
if (! defined('PHPMYADMIN')) {
|
||||
exit;
|
||||
}
|
||||
|
||||
require_once './libraries/check_user_privileges.lib.php';
|
||||
|
||||
/**
|
||||
* Represents a container for database nodes in the navigation tree
|
||||
*
|
||||
* @package PhpMyAdmin-Navigation
|
||||
*/
|
||||
class Node_Database_Container extends Node
|
||||
{
|
||||
/**
|
||||
* Initialises the class
|
||||
*
|
||||
* @param string $name An identifier for the new node
|
||||
*
|
||||
* @return Node_Database_Container
|
||||
*/
|
||||
public function __construct($name)
|
||||
{
|
||||
parent::__construct($name, Node::CONTAINER);
|
||||
|
||||
if ($GLOBALS['is_create_db_priv']) {
|
||||
$new = PMA_NodeFactory::getInstance(
|
||||
'Node', _pgettext('Create new database', 'New')
|
||||
);
|
||||
$new->isNew = true;
|
||||
$new->icon = PMA_Util::getImage('b_newdb.png', '');
|
||||
$new->links = array(
|
||||
'text' => 'server_databases.php?server=' . $GLOBALS['server']
|
||||
. '&token=' . $GLOBALS['token'],
|
||||
'icon' => 'server_databases.php?server=' . $GLOBALS['server']
|
||||
. '&token=' . $GLOBALS['token'],
|
||||
);
|
||||
$new->classes = 'new_database italics';
|
||||
$this->addChild($new);
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
||||
@@ -0,0 +1,57 @@
|
||||
<?php
|
||||
/* vim: set expandtab sw=4 ts=4 sts=4: */
|
||||
/**
|
||||
* Functionality for the navigation tree
|
||||
*
|
||||
* @package PhpMyAdmin-Navigation
|
||||
*/
|
||||
if (! defined('PHPMYADMIN')) {
|
||||
exit;
|
||||
}
|
||||
|
||||
require_once 'libraries/navigation/Nodes/Node_DatabaseChild.class.php';
|
||||
|
||||
/**
|
||||
* Represents a event node in the navigation tree
|
||||
*
|
||||
* @package PhpMyAdmin-Navigation
|
||||
*/
|
||||
class Node_Event extends Node_DatabaseChild
|
||||
{
|
||||
/**
|
||||
* Initialises the class
|
||||
*
|
||||
* @param string $name An identifier for the new node
|
||||
* @param int $type Type of node, may be one of CONTAINER or OBJECT
|
||||
* @param bool $is_group Whether this object has been created
|
||||
* while grouping nodes
|
||||
*
|
||||
* @return Node_Event
|
||||
*/
|
||||
public function __construct($name, $type = Node::OBJECT, $is_group = false)
|
||||
{
|
||||
parent::__construct($name, $type, $is_group);
|
||||
$this->icon = PMA_Util::getImage('b_events.png');
|
||||
$this->links = array(
|
||||
'text' => 'db_events.php?server=' . $GLOBALS['server']
|
||||
. '&db=%2$s&item_name=%1$s&edit_item=1'
|
||||
. '&token=' . $GLOBALS['token'],
|
||||
'icon' => 'db_events.php?server=' . $GLOBALS['server']
|
||||
. '&db=%2$s&item_name=%1$s&export_item=1'
|
||||
. '&token=' . $GLOBALS['token']
|
||||
);
|
||||
$this->classes = 'event';
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the type of the item represented by the node.
|
||||
*
|
||||
* @return string type of the item
|
||||
*/
|
||||
protected function getItemType()
|
||||
{
|
||||
return 'event';
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,54 @@
|
||||
<?php
|
||||
/* vim: set expandtab sw=4 ts=4 sts=4: */
|
||||
/**
|
||||
* Functionality for the navigation tree
|
||||
*
|
||||
* @package PhpMyAdmin-Navigation
|
||||
*/
|
||||
if (! defined('PHPMYADMIN')) {
|
||||
exit;
|
||||
}
|
||||
|
||||
/**
|
||||
* Represents a container for events nodes in the navigation tree
|
||||
*
|
||||
* @package PhpMyAdmin-Navigation
|
||||
*/
|
||||
class Node_Event_Container extends Node
|
||||
{
|
||||
/**
|
||||
* Initialises the class
|
||||
*
|
||||
* @return Node_Event_Container
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct(__('Events'), Node::CONTAINER);
|
||||
$this->icon = PMA_Util::getImage('b_events.png', '');
|
||||
$this->links = array(
|
||||
'text' => 'db_events.php?server=' . $GLOBALS['server']
|
||||
. '&db=%1$s&token=' . $GLOBALS['token'],
|
||||
'icon' => 'db_events.php?server=' . $GLOBALS['server']
|
||||
. '&db=%1$s&token=' . $GLOBALS['token'],
|
||||
);
|
||||
$this->real_name = 'events';
|
||||
|
||||
$new = PMA_NodeFactory::getInstance(
|
||||
'Node', _pgettext('Create new event', 'New')
|
||||
);
|
||||
$new->isNew = true;
|
||||
$new->icon = PMA_Util::getImage('b_event_add.png', '');
|
||||
$new->links = array(
|
||||
'text' => 'db_events.php?server=' . $GLOBALS['server']
|
||||
. '&db=%2$s&token=' . $GLOBALS['token']
|
||||
. '&add_item=1',
|
||||
'icon' => 'db_events.php?server=' . $GLOBALS['server']
|
||||
. '&db=%2$s&token=' . $GLOBALS['token']
|
||||
. '&add_item=1',
|
||||
);
|
||||
$new->classes = 'new_event italics';
|
||||
$this->addChild($new);
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,57 @@
|
||||
<?php
|
||||
/* vim: set expandtab sw=4 ts=4 sts=4: */
|
||||
/**
|
||||
* Functionality for the navigation tree
|
||||
*
|
||||
* @package PhpMyAdmin-Navigation
|
||||
*/
|
||||
if (! defined('PHPMYADMIN')) {
|
||||
exit;
|
||||
}
|
||||
|
||||
require_once 'libraries/navigation/Nodes/Node_DatabaseChild.class.php';
|
||||
|
||||
/**
|
||||
* Represents a function node in the navigation tree
|
||||
*
|
||||
* @package PhpMyAdmin-Navigation
|
||||
*/
|
||||
class Node_Function extends Node_DatabaseChild
|
||||
{
|
||||
/**
|
||||
* Initialises the class
|
||||
*
|
||||
* @param string $name An identifier for the new node
|
||||
* @param int $type Type of node, may be one of CONTAINER or OBJECT
|
||||
* @param bool $is_group Whether this object has been created
|
||||
* while grouping nodes
|
||||
*
|
||||
* @return Node_Function
|
||||
*/
|
||||
public function __construct($name, $type = Node::OBJECT, $is_group = false)
|
||||
{
|
||||
parent::__construct($name, $type, $is_group);
|
||||
$this->icon = PMA_Util::getImage('b_routines.png', __('Function'));
|
||||
$this->links = array(
|
||||
'text' => 'db_routines.php?server=' . $GLOBALS['server']
|
||||
. '&db=%2$s&item_name=%1$s&item_type=FUNCTION'
|
||||
. '&edit_item=1&token=' . $GLOBALS['token'],
|
||||
'icon' => 'db_routines.php?server=' . $GLOBALS['server']
|
||||
. '&db=%2$s&item_name=%1$s&item_type=FUNCTION'
|
||||
. '&export_item=1&token=' . $GLOBALS['token']
|
||||
);
|
||||
$this->classes = 'function';
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the type of the item represented by the node.
|
||||
*
|
||||
* @return string type of the item
|
||||
*/
|
||||
protected function getItemType()
|
||||
{
|
||||
return 'function';
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,53 @@
|
||||
<?php
|
||||
/* vim: set expandtab sw=4 ts=4 sts=4: */
|
||||
/**
|
||||
* Functionality for the navigation tree
|
||||
*
|
||||
* @package PhpMyAdmin-Navigation
|
||||
*/
|
||||
if (! defined('PHPMYADMIN')) {
|
||||
exit;
|
||||
}
|
||||
|
||||
/**
|
||||
* Represents a container for functions nodes in the navigation tree
|
||||
*
|
||||
* @package PhpMyAdmin-Navigation
|
||||
*/
|
||||
class Node_Function_Container extends Node
|
||||
{
|
||||
/**
|
||||
* Initialises the class
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct(__('Functions'), Node::CONTAINER);
|
||||
$this->icon = PMA_Util::getImage('b_routines.png', __('Functions'));
|
||||
$this->links = array(
|
||||
'text' => 'db_routines.php?server=' . $GLOBALS['server']
|
||||
. '&db=%1$s&token=' . $GLOBALS['token']
|
||||
. '&type=FUNCTION',
|
||||
'icon' => 'db_routines.php?server=' . $GLOBALS['server']
|
||||
. '&db=%1$s&token=' . $GLOBALS['token']
|
||||
. '&type=FUNCTION',
|
||||
);
|
||||
$this->real_name = 'functions';
|
||||
|
||||
$new_label = _pgettext('Create new function', 'New');
|
||||
$new = PMA_NodeFactory::getInstance('Node', $new_label);
|
||||
$new->isNew = true;
|
||||
$new->icon = PMA_Util::getImage('b_routine_add.png', $new_label);
|
||||
$new->links = array(
|
||||
'text' => 'db_routines.php?server=' . $GLOBALS['server']
|
||||
. '&db=%2$s&token=' . $GLOBALS['token']
|
||||
. '&add_item=1&item_type=FUNCTION',
|
||||
'icon' => 'db_routines.php?server=' . $GLOBALS['server']
|
||||
. '&db=%2$s&token=' . $GLOBALS['token']
|
||||
. '&add_item=1&item_type=FUNCTION',
|
||||
);
|
||||
$new->classes = 'new_function italics';
|
||||
$this->addChild($new);
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
/* vim: set expandtab sw=4 ts=4 sts=4: */
|
||||
/**
|
||||
* Functionality for the navigation tree
|
||||
*
|
||||
* @package PhpMyAdmin-Navigation
|
||||
*/
|
||||
if (! defined('PHPMYADMIN')) {
|
||||
exit;
|
||||
}
|
||||
|
||||
/**
|
||||
* Represents a index node in the navigation tree
|
||||
*
|
||||
* @package PhpMyAdmin-Navigation
|
||||
*/
|
||||
class Node_Index extends Node
|
||||
{
|
||||
/**
|
||||
* Initialises the class
|
||||
*
|
||||
* @param string $name An identifier for the new node
|
||||
* @param int $type Type of node, may be one of CONTAINER or OBJECT
|
||||
* @param bool $is_group Whether this object has been created
|
||||
* while grouping nodes
|
||||
*
|
||||
* @return Node_Index
|
||||
*/
|
||||
public function __construct($name, $type = Node::OBJECT, $is_group = false)
|
||||
{
|
||||
parent::__construct($name, $type, $is_group);
|
||||
$this->icon = PMA_Util::getImage('b_index.png', __('Index'));
|
||||
$this->links = array(
|
||||
'text' => 'tbl_indexes.php?server=' . $GLOBALS['server']
|
||||
. '&db=%3$s&table=%2$s&index=%1$s'
|
||||
. '&token=' . $GLOBALS['token'],
|
||||
'icon' => 'tbl_indexes.php?server=' . $GLOBALS['server']
|
||||
. '&db=%3$s&table=%2$s&index=%1$s'
|
||||
. '&token=' . $GLOBALS['token']
|
||||
);
|
||||
$this->classes = 'index';
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,55 @@
|
||||
<?php
|
||||
/* vim: set expandtab sw=4 ts=4 sts=4: */
|
||||
/**
|
||||
* Functionality for the navigation tree
|
||||
*
|
||||
* @package PhpMyAdmin-Navigation
|
||||
*/
|
||||
if (! defined('PHPMYADMIN')) {
|
||||
exit;
|
||||
}
|
||||
|
||||
/**
|
||||
* Represents a container for index nodes in the navigation tree
|
||||
*
|
||||
* @package PhpMyAdmin-Navigation
|
||||
*/
|
||||
class Node_Index_Container extends Node
|
||||
{
|
||||
/**
|
||||
* Initialises the class
|
||||
*
|
||||
* @return Node_Index_Container
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct(__('Indexes'), Node::CONTAINER);
|
||||
$this->icon = PMA_Util::getImage('b_index.png', __('Indexes'));
|
||||
$this->links = array(
|
||||
'text' => 'tbl_structure.php?server=' . $GLOBALS['server']
|
||||
. '&db=%2$s&table=%1$s'
|
||||
. '&token=' . $GLOBALS['token'],
|
||||
'icon' => 'tbl_structure.php?server=' . $GLOBALS['server']
|
||||
. '&db=%2$s&table=%1$s'
|
||||
. '&token=' . $GLOBALS['token'],
|
||||
);
|
||||
$this->real_name = 'indexes';
|
||||
|
||||
$new_label = _pgettext('Create new index', 'New');
|
||||
$new = PMA_NodeFactory::getInstance('Node', $new_label);
|
||||
$new->isNew = true;
|
||||
$new->icon = PMA_Util::getImage('b_index_add.png', $new_label);
|
||||
$new->links = array(
|
||||
'text' => 'tbl_indexes.php?server=' . $GLOBALS['server']
|
||||
. '&create_index=1&added_fields=2'
|
||||
. '&db=%3$s&table=%2$s&token=' . $GLOBALS['token'],
|
||||
'icon' => 'tbl_indexes.php?server=' . $GLOBALS['server']
|
||||
. '&create_index=1&added_fields=2'
|
||||
. '&db=%3$s&table=%2$s&token=' . $GLOBALS['token'],
|
||||
);
|
||||
$new->classes = 'new_index italics';
|
||||
$this->addChild($new);
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,57 @@
|
||||
<?php
|
||||
/* vim: set expandtab sw=4 ts=4 sts=4: */
|
||||
/**
|
||||
* Functionality for the navigation tree
|
||||
*
|
||||
* @package PhpMyAdmin-Navigation
|
||||
*/
|
||||
if (! defined('PHPMYADMIN')) {
|
||||
exit;
|
||||
}
|
||||
|
||||
require_once 'libraries/navigation/Nodes/Node_DatabaseChild.class.php';
|
||||
|
||||
/**
|
||||
* Represents a procedure node in the navigation tree
|
||||
*
|
||||
* @package PhpMyAdmin-Navigation
|
||||
*/
|
||||
class Node_Procedure extends Node_DatabaseChild
|
||||
{
|
||||
/**
|
||||
* Initialises the class
|
||||
*
|
||||
* @param string $name An identifier for the new node
|
||||
* @param int $type Type of node, may be one of CONTAINER or OBJECT
|
||||
* @param bool $is_group Whether this object has been created
|
||||
* while grouping nodes
|
||||
*
|
||||
* @return Node_Procedure
|
||||
*/
|
||||
public function __construct($name, $type = Node::OBJECT, $is_group = false)
|
||||
{
|
||||
parent::__construct($name, $type, $is_group);
|
||||
$this->icon = PMA_Util::getImage('b_routines.png', __('Procedure'));
|
||||
$this->links = array(
|
||||
'text' => 'db_routines.php?server=' . $GLOBALS['server']
|
||||
. '&db=%2$s&item_name=%1$s&item_type=PROCEDURE'
|
||||
. '&edit_item=1&token=' . $GLOBALS['token'],
|
||||
'icon' => 'db_routines.php?server=' . $GLOBALS['server']
|
||||
. '&db=%2$s&item_name=%1$s&item_type=PROCEDURE'
|
||||
. '&export_item=1&token=' . $GLOBALS['token']
|
||||
);
|
||||
$this->classes = 'procedure';
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the type of the item represented by the node.
|
||||
*
|
||||
* @return string type of the item
|
||||
*/
|
||||
protected function getItemType()
|
||||
{
|
||||
return 'procedure';
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,55 @@
|
||||
<?php
|
||||
/* vim: set expandtab sw=4 ts=4 sts=4: */
|
||||
/**
|
||||
* Functionality for the navigation tree
|
||||
*
|
||||
* @package PhpMyAdmin-Navigation
|
||||
*/
|
||||
if (! defined('PHPMYADMIN')) {
|
||||
exit;
|
||||
}
|
||||
|
||||
/**
|
||||
* Represents a container for procedure nodes in the navigation tree
|
||||
*
|
||||
* @package PhpMyAdmin-Navigation
|
||||
*/
|
||||
class Node_Procedure_Container extends Node
|
||||
{
|
||||
/**
|
||||
* Initialises the class
|
||||
*
|
||||
* @return Node_Procedure_Container
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct(__('Procedures'), Node::CONTAINER);
|
||||
$this->icon = PMA_Util::getImage('b_routines.png', __('Procedures'));
|
||||
$this->links = array(
|
||||
'text' => 'db_routines.php?server=' . $GLOBALS['server']
|
||||
. '&db=%1$s&token=' . $GLOBALS['token']
|
||||
. '&type=PROCEDURE',
|
||||
'icon' => 'db_routines.php?server=' . $GLOBALS['server']
|
||||
. '&db=%1$s&token=' . $GLOBALS['token']
|
||||
. '&type=PROCEDURE',
|
||||
);
|
||||
$this->real_name = 'procedures';
|
||||
|
||||
$new_label = _pgettext('Create new procedure', 'New');
|
||||
$new = PMA_NodeFactory::getInstance('Node', $new_label);
|
||||
$new->isNew = true;
|
||||
$new->icon = PMA_Util::getImage('b_routine_add.png', $new_label);
|
||||
$new->links = array(
|
||||
'text' => 'db_routines.php?server=' . $GLOBALS['server']
|
||||
. '&db=%2$s&token=' . $GLOBALS['token']
|
||||
. '&add_item=1',
|
||||
'icon' => 'db_routines.php?server=' . $GLOBALS['server']
|
||||
. '&db=%2$s&token=' . $GLOBALS['token']
|
||||
. '&add_item=1',
|
||||
);
|
||||
$new->classes = 'new_procedure italics';
|
||||
$this->addChild($new);
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,186 @@
|
||||
<?php
|
||||
/* vim: set expandtab sw=4 ts=4 sts=4: */
|
||||
/**
|
||||
* Functionality for the navigation tree
|
||||
*
|
||||
* @package PhpMyAdmin-Navigation
|
||||
*/
|
||||
if (! defined('PHPMYADMIN')) {
|
||||
exit;
|
||||
}
|
||||
|
||||
require_once 'libraries/navigation/Nodes/Node_DatabaseChild.class.php';
|
||||
|
||||
/**
|
||||
* Represents a columns node in the navigation tree
|
||||
*
|
||||
* @package PhpMyAdmin-Navigation
|
||||
*/
|
||||
class Node_Table extends Node_DatabaseChild
|
||||
{
|
||||
/**
|
||||
* Initialises the class
|
||||
*
|
||||
* @param string $name An identifier for the new node
|
||||
* @param int $type Type of node, may be one of CONTAINER or OBJECT
|
||||
* @param bool $is_group Whether this object has been created
|
||||
* while grouping nodes
|
||||
*
|
||||
* @return Node_Table
|
||||
*/
|
||||
public function __construct($name, $type = Node::OBJECT, $is_group = false)
|
||||
{
|
||||
parent::__construct($name, $type, $is_group);
|
||||
switch($GLOBALS['cfg']['NavigationTreeDefaultTabTable']) {
|
||||
case 'tbl_structure.php':
|
||||
$this->icon = PMA_Util::getImage('b_props.png', __('Structure'));
|
||||
break;
|
||||
case 'tbl_select.php':
|
||||
$this->icon = PMA_Util::getImage('b_search.png', __('Search'));
|
||||
break;
|
||||
case 'tbl_change.php':
|
||||
$this->icon = PMA_Util::getImage('b_insrow.png', __('Insert'));
|
||||
break;
|
||||
case 'tbl_sql.php':
|
||||
$this->icon = PMA_Util::getImage('b_sql.png', __('SQL'));
|
||||
break;
|
||||
case 'sql.php':
|
||||
$this->icon = PMA_Util::getImage('b_browse.png', __('Browse'));
|
||||
break;
|
||||
}
|
||||
$this->links = array(
|
||||
'text' => $GLOBALS['cfg']['DefaultTabTable']
|
||||
. '?server=' . $GLOBALS['server']
|
||||
. '&db=%2$s&table=%1$s'
|
||||
. '&pos=0&token=' . $GLOBALS['token'],
|
||||
'icon' => $GLOBALS['cfg']['NavigationTreeDefaultTabTable']
|
||||
. '?server=' . $GLOBALS['server']
|
||||
. '&db=%2$s&table=%1$s&token=' . $GLOBALS['token']
|
||||
);
|
||||
$this->classes = 'table';
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the number of children of type $type present inside this container
|
||||
* This method is overridden by the Node_Database and Node_Table classes
|
||||
*
|
||||
* @param string $type The type of item we are looking for
|
||||
* ('columns' or 'indexes')
|
||||
* @param string $searchClause A string used to filter the results of the query
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getPresence($type = '', $searchClause = '')
|
||||
{
|
||||
$retval = 0;
|
||||
$db = $this->realParent()->real_name;
|
||||
$table = $this->real_name;
|
||||
switch ($type) {
|
||||
case 'columns':
|
||||
$db = PMA_Util::sqlAddSlashes($db);
|
||||
$table = PMA_Util::sqlAddSlashes($table);
|
||||
$query = "SELECT COUNT(*) ";
|
||||
$query .= "FROM `INFORMATION_SCHEMA`.`COLUMNS` ";
|
||||
$query .= "WHERE `TABLE_NAME`='$table' ";
|
||||
$query .= "AND `TABLE_SCHEMA`='$db'";
|
||||
$retval = (int)$GLOBALS['dbi']->fetchValue($query);
|
||||
break;
|
||||
case 'indexes':
|
||||
$db = PMA_Util::backquote($db);
|
||||
$table = PMA_Util::backquote($table);
|
||||
$query = "SHOW INDEXES FROM $table FROM $db";
|
||||
$retval = (int)$GLOBALS['dbi']->numRows(
|
||||
$GLOBALS['dbi']->tryQuery($query)
|
||||
);
|
||||
break;
|
||||
case 'triggers':
|
||||
$db = PMA_Util::sqlAddSlashes($db);
|
||||
$table = PMA_Util::sqlAddSlashes($table);
|
||||
$query = "SELECT COUNT(*) ";
|
||||
$query .= "FROM `INFORMATION_SCHEMA`.`TRIGGERS` ";
|
||||
$query .= "WHERE `EVENT_OBJECT_SCHEMA`='$db' ";
|
||||
$query .= "AND `EVENT_OBJECT_TABLE`='$table'";
|
||||
$retval = (int)$GLOBALS['dbi']->fetchValue($query);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return $retval;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the names of children of type $type present inside this container
|
||||
* This method is overridden by the Node_Database and Node_Table classes
|
||||
*
|
||||
* @param string $type The type of item we are looking for
|
||||
* ('tables', 'views', etc)
|
||||
* @param int $pos The offset of the list within the results
|
||||
* @param string $searchClause A string used to filter the results of the query
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getData($type, $pos, $searchClause = '')
|
||||
{
|
||||
$maxItems = $GLOBALS['cfg']['MaxNavigationItems'];
|
||||
$retval = array();
|
||||
$db = $this->realParent()->real_name;
|
||||
$table = $this->real_name;
|
||||
switch ($type) {
|
||||
case 'columns':
|
||||
$db = PMA_Util::sqlAddSlashes($db);
|
||||
$table = PMA_Util::sqlAddSlashes($table);
|
||||
$query = "SELECT `COLUMN_NAME` AS `name` ";
|
||||
$query .= "FROM `INFORMATION_SCHEMA`.`COLUMNS` ";
|
||||
$query .= "WHERE `TABLE_NAME`='$table' ";
|
||||
$query .= "AND `TABLE_SCHEMA`='$db' ";
|
||||
$query .= "ORDER BY `COLUMN_NAME` ASC ";
|
||||
$query .= "LIMIT " . intval($pos) . ", $maxItems";
|
||||
$retval = $GLOBALS['dbi']->fetchResult($query);
|
||||
break;
|
||||
case 'indexes':
|
||||
$db = PMA_Util::backquote($db);
|
||||
$table = PMA_Util::backquote($table);
|
||||
$query = "SHOW INDEXES FROM $table FROM $db";
|
||||
$handle = $GLOBALS['dbi']->tryQuery($query);
|
||||
if ($handle !== false) {
|
||||
$count = 0;
|
||||
while ($arr = $GLOBALS['dbi']->fetchArray($handle)) {
|
||||
if (! in_array($arr['Key_name'], $retval)) {
|
||||
if ($pos <= 0 && $count < $maxItems) {
|
||||
$retval[] = $arr['Key_name'];
|
||||
$count++;
|
||||
}
|
||||
$pos--;
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 'triggers':
|
||||
$db = PMA_Util::sqlAddSlashes($db);
|
||||
$table = PMA_Util::sqlAddSlashes($table);
|
||||
$query = "SELECT `TRIGGER_NAME` AS `name` ";
|
||||
$query .= "FROM `INFORMATION_SCHEMA`.`TRIGGERS` ";
|
||||
$query .= "WHERE `EVENT_OBJECT_SCHEMA`='$db' ";
|
||||
$query .= "AND `EVENT_OBJECT_TABLE`='$table' ";
|
||||
$query .= "ORDER BY `TRIGGER_NAME` ASC ";
|
||||
$query .= "LIMIT " . intval($pos) . ", $maxItems";
|
||||
$retval = $GLOBALS['dbi']->fetchResult($query);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return $retval;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the type of the item represented by the node.
|
||||
*
|
||||
* @return string type of the item
|
||||
*/
|
||||
protected function getItemType()
|
||||
{
|
||||
return 'table';
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,60 @@
|
||||
<?php
|
||||
/* vim: set expandtab sw=4 ts=4 sts=4: */
|
||||
/**
|
||||
* Functionality for the navigation tree
|
||||
*
|
||||
* @package PhpMyAdmin-Navigation
|
||||
*/
|
||||
if (! defined('PHPMYADMIN')) {
|
||||
exit;
|
||||
}
|
||||
|
||||
/**
|
||||
* Represents a container for table nodes in the navigation tree
|
||||
*
|
||||
* @package PhpMyAdmin-Navigation
|
||||
*/
|
||||
class Node_Table_Container extends Node
|
||||
{
|
||||
/**
|
||||
* Initialises the class
|
||||
*
|
||||
* @return Node_Table_Container
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct(__('Tables'), Node::CONTAINER);
|
||||
$this->icon = PMA_Util::getImage('b_browse.png', __('Tables'));
|
||||
$this->links = array(
|
||||
'text' => 'db_structure.php?server=' . $GLOBALS['server']
|
||||
. '&db=%1$s&tbl_type=table'
|
||||
. '&token=' . $GLOBALS['token'],
|
||||
'icon' => 'db_structure.php?server=' . $GLOBALS['server']
|
||||
. '&db=%1$s&tbl_type=table'
|
||||
. '&token=' . $GLOBALS['token'],
|
||||
);
|
||||
if ($GLOBALS['cfg']['NavigationTreeEnableGrouping']) {
|
||||
$this->separator = $GLOBALS['cfg']['NavigationTreeTableSeparator'];
|
||||
$this->separator_depth = (int)(
|
||||
$GLOBALS['cfg']['NavigationTreeTableLevel']
|
||||
);
|
||||
}
|
||||
$this->real_name = 'tables';
|
||||
$this->classes = 'tableContainer subContainer';
|
||||
|
||||
$new_label = _pgettext('Create new table', 'New');
|
||||
$new = PMA_NodeFactory::getInstance('Node', $new_label);
|
||||
$new->isNew = true;
|
||||
$new->icon = PMA_Util::getImage('b_table_add.png', $new_label);
|
||||
$new->links = array(
|
||||
'text' => 'tbl_create.php?server=' . $GLOBALS['server']
|
||||
. '&db=%2$s&token=' . $GLOBALS['token'],
|
||||
'icon' => 'tbl_create.php?server=' . $GLOBALS['server']
|
||||
. '&db=%2$s&token=' . $GLOBALS['token'],
|
||||
);
|
||||
$new->classes = 'new_table italics';
|
||||
$this->addChild($new);
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
/* vim: set expandtab sw=4 ts=4 sts=4: */
|
||||
/**
|
||||
* Functionality for the navigation tree
|
||||
*
|
||||
* @package PhpMyAdmin-Navigation
|
||||
*/
|
||||
if (! defined('PHPMYADMIN')) {
|
||||
exit;
|
||||
}
|
||||
|
||||
/**
|
||||
* Represents a trigger node in the navigation tree
|
||||
*
|
||||
* @package PhpMyAdmin-Navigation
|
||||
*/
|
||||
class Node_Trigger extends Node
|
||||
{
|
||||
/**
|
||||
* Initialises the class
|
||||
*
|
||||
* @param string $name An identifier for the new node
|
||||
* @param int $type Type of node, may be one of CONTAINER or OBJECT
|
||||
* @param bool $is_group Whether this object has been created
|
||||
* while grouping nodes
|
||||
*
|
||||
* @return Node_Trigger
|
||||
*/
|
||||
public function __construct($name, $type = Node::OBJECT, $is_group = false)
|
||||
{
|
||||
parent::__construct($name, $type, $is_group);
|
||||
$this->icon = PMA_Util::getImage('b_triggers.png');
|
||||
$this->links = array(
|
||||
'text' => 'db_triggers.php?server=' . $GLOBALS['server']
|
||||
. '&db=%3$s&item_name=%1$s&edit_item=1'
|
||||
. '&token=' . $GLOBALS['token'],
|
||||
'icon' => 'db_triggers.php?server=' . $GLOBALS['server']
|
||||
. '&db=%3$s&item_name=%1$s&export_item=1'
|
||||
. '&token=' . $GLOBALS['token']
|
||||
);
|
||||
$this->classes = 'trigger';
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,55 @@
|
||||
<?php
|
||||
/* vim: set expandtab sw=4 ts=4 sts=4: */
|
||||
/**
|
||||
* Functionality for the navigation tree
|
||||
*
|
||||
* @package PhpMyAdmin-Navigation
|
||||
*/
|
||||
if (! defined('PHPMYADMIN')) {
|
||||
exit;
|
||||
}
|
||||
|
||||
/**
|
||||
* Represents a container for trigger nodes in the navigation tree
|
||||
*
|
||||
* @package PhpMyAdmin-Navigation
|
||||
*/
|
||||
class Node_Trigger_Container extends Node
|
||||
{
|
||||
/**
|
||||
* Initialises the class
|
||||
*
|
||||
* @return Node_Trigger_Container
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct(__('Triggers'), Node::CONTAINER);
|
||||
$this->icon = PMA_Util::getImage('b_triggers.png');
|
||||
$this->links = array(
|
||||
'text' => 'db_triggers.php?server=' . $GLOBALS['server']
|
||||
. '&db=%2$s&table=%1$s&token=' . $GLOBALS['token'],
|
||||
'icon' => 'db_triggers.php?server=' . $GLOBALS['server']
|
||||
. '&db=%2$s&table=%1$s&token=' . $GLOBALS['token']
|
||||
);
|
||||
$this->real_name = 'triggers';
|
||||
|
||||
$new = PMA_NodeFactory::getInstance(
|
||||
'Node', _pgettext('Create new trigger', 'New')
|
||||
);
|
||||
$new->isNew = true;
|
||||
$new->icon = PMA_Util::getImage('b_trigger_add.png', '');
|
||||
$new->links = array(
|
||||
'text' => 'db_triggers.php?server=' . $GLOBALS['server']
|
||||
. '&db=%3$s&token=' . $GLOBALS['token']
|
||||
. '&add_item=1',
|
||||
'icon' => 'db_triggers.php?server=' . $GLOBALS['server']
|
||||
. '&db=%3$s&token=' . $GLOBALS['token']
|
||||
. '&add_item=1',
|
||||
);
|
||||
$new->classes = 'new_trigger italics';
|
||||
$this->addChild($new);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,57 @@
|
||||
<?php
|
||||
/* vim: set expandtab sw=4 ts=4 sts=4: */
|
||||
/**
|
||||
* Functionality for the navigation tree
|
||||
*
|
||||
* @package PhpMyAdmin-Navigation
|
||||
*/
|
||||
if (! defined('PHPMYADMIN')) {
|
||||
exit;
|
||||
}
|
||||
|
||||
require_once 'libraries/navigation/Nodes/Node_DatabaseChild.class.php';
|
||||
|
||||
/**
|
||||
* Represents a view node in the navigation tree
|
||||
*
|
||||
* @package PhpMyAdmin-Navigation
|
||||
*/
|
||||
class Node_View extends Node_DatabaseChild
|
||||
{
|
||||
/**
|
||||
* Initialises the class
|
||||
*
|
||||
* @param string $name An identifier for the new node
|
||||
* @param int $type Type of node, may be one of CONTAINER or OBJECT
|
||||
* @param bool $is_group Whether this object has been created
|
||||
* while grouping nodes
|
||||
*
|
||||
* @return Node_View
|
||||
*/
|
||||
public function __construct($name, $type = Node::OBJECT, $is_group = false)
|
||||
{
|
||||
parent::__construct($name, $type, $is_group);
|
||||
$this->icon = PMA_Util::getImage('b_props.png', __('View'));
|
||||
$this->links = array(
|
||||
'text' => 'sql.php?server=' . $GLOBALS['server']
|
||||
. '&db=%2$s&table=%1$s&pos=0'
|
||||
. '&token=' . $GLOBALS['token'],
|
||||
'icon' => 'tbl_structure.php?server=' . $GLOBALS['server']
|
||||
. '&db=%2$s&table=%1$s'
|
||||
. '&token=' . $GLOBALS['token']
|
||||
);
|
||||
$this->classes = 'view';
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the type of the item represented by the node.
|
||||
*
|
||||
* @return string type of the item
|
||||
*/
|
||||
protected function getItemType()
|
||||
{
|
||||
return 'view';
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,60 @@
|
||||
<?php
|
||||
/* vim: set expandtab sw=4 ts=4 sts=4: */
|
||||
/**
|
||||
* Functionality for the navigation tree
|
||||
*
|
||||
* @package PhpMyAdmin-Navigation
|
||||
*/
|
||||
if (! defined('PHPMYADMIN')) {
|
||||
exit;
|
||||
}
|
||||
|
||||
/**
|
||||
* Represents a container for view nodes in the navigation tree
|
||||
*
|
||||
* @package PhpMyAdmin-Navigation
|
||||
*/
|
||||
class Node_View_Container extends Node
|
||||
{
|
||||
/**
|
||||
* Initialises the class
|
||||
*
|
||||
* @return Node_View_Container
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct(__('Views'), Node::CONTAINER);
|
||||
$this->icon = PMA_Util::getImage('b_views.png', __('Views'));
|
||||
$this->links = array(
|
||||
'text' => 'db_structure.php?server=' . $GLOBALS['server']
|
||||
. '&db=%1$s&tbl_type=view'
|
||||
. '&token=' . $GLOBALS['token'],
|
||||
'icon' => 'db_structure.php?server=' . $GLOBALS['server']
|
||||
. '&db=%1$s&tbl_type=view'
|
||||
. '&token=' . $GLOBALS['token'],
|
||||
);
|
||||
if ($GLOBALS['cfg']['NavigationTreeEnableGrouping']) {
|
||||
$this->separator = $GLOBALS['cfg']['NavigationTreeTableSeparator'];
|
||||
$this->separator_depth = (int)(
|
||||
$GLOBALS['cfg']['NavigationTreeTableLevel']
|
||||
);
|
||||
}
|
||||
$this->classes = 'viewContainer subContainer';
|
||||
$this->real_name = 'views';
|
||||
|
||||
$new_label = _pgettext('Create new view', 'New');
|
||||
$new = PMA_NodeFactory::getInstance('Node', $new_label);
|
||||
$new->isNew = true;
|
||||
$new->icon = PMA_Util::getImage('b_view_add.png', $new_label);
|
||||
$new->links = array(
|
||||
'text' => 'view_create.php?server=' . $GLOBALS['server']
|
||||
. '&db=%2$s&token=' . $GLOBALS['token'],
|
||||
'icon' => 'view_create.php?server=' . $GLOBALS['server']
|
||||
. '&db=%2$s&token=' . $GLOBALS['token'],
|
||||
);
|
||||
$new->classes = 'new_view italics';
|
||||
$this->addChild($new);
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
Reference in New Issue
Block a user