/** * Renders the navigation * * @return String HTML */ public function getDisplay() { if (empty($GLOBALS['url_query'])) { $GLOBALS['url_query'] = PMA_URL_getCommon(); } $link_url = PMA_URL_getCommon(array('ajax_request' => true)); $class = ' class="list_container'; if ($GLOBALS['cfg']['NavigationLinkWithMainPanel']) { $class .= ' synced'; } if ($GLOBALS['cfg']['NavigationTreePointerEnable']) { $class .= ' highlight'; } $class .= '"'; $buffer = '<div id="pma_navigation">'; $buffer .= '<div id="pma_navigation_resizer"></div>'; $buffer .= '<div id="pma_navigation_collapser"></div>'; $buffer .= '<div id="pma_navigation_content">'; $buffer .= '<div id="pma_navigation_header">'; $buffer .= sprintf('<a class="hide navigation_url" href="navigation.php%s"></a>', $link_url); $buffer .= $this->_logo(); $buffer .= $this->_links(); $buffer .= $this->_serverChoice(); $buffer .= PMA_Util::getImage('ajax_clock_small.gif', __('Loading…'), array('style' => 'visibility: hidden; display:none', 'class' => 'throbber')); $buffer .= '</div>'; // pma_navigation_header $buffer .= '<div id="pma_navigation_tree"' . $class . '>'; return $buffer; }
/** * 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'); $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'; }
/** * 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' . '&execute_dialog=1&token=' . $GLOBALS['token'], 'icon' => 'db_routines.php?server=' . $GLOBALS['server'] . '&db=%2$s&item_name=%1$s&item_type=PROCEDURE' . '&edit_item=1&token=' . $GLOBALS['token']); $this->classes = 'procedure'; }
/** * Returns the html for the sub-page heading * * @param string $type Sub page type * @param string $link Link to the official MySQL documentation * @param bool $is_image Display image or icon, true: image, false: icon * * @return string */ function PMA_getHtmlForSubPageHeader($type, $link = '', $is_image = true) { //array contains Sub page icon and text $header = array(); $header['variables']['image'] = 's_vars.png'; $header['variables']['text'] = __('Server variables and settings'); $header['engines']['image'] = 'b_engine.png'; $header['engines']['text'] = __('Storage Engines'); $header['plugins']['image'] = 'b_engine.png'; $header['plugins']['text'] = __('Plugins'); $header['binlog']['image'] = 's_tbl.png'; $header['binlog']['text'] = __('Binary log'); $header['collations']['image'] = 's_asci.png'; $header['collations']['text'] = __('Character Sets and Collations'); $header['replication']['image'] = 's_replication.png'; $header['replication']['text'] = __('Replication'); $header['database_statistics']['image'] = 's_db.png'; $header['database_statistics']['text'] = __('Databases statistics'); $header['databases']['image'] = 's_db.png'; $header['databases']['text'] = __('Databases'); $header['privileges']['image'] = 'b_usrlist.png'; $header['privileges']['text'] = __('Privileges'); if ($is_image) { $html = '<h2>' . "\n" . PMA_Util::getImage($header[$type]['image']) . ' ' . $header[$type]['text'] . "\n" . $link . '</h2>' . "\n"; } else { $html = '<h2>' . "\n" . PMA_Util::getIcon($header[$type]['image']) . ' ' . $header[$type]['text'] . "\n" . $link . '</h2>' . "\n"; } return $html; }
/** * 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 */ 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=' . $_SESSION[' PMA_token '], 'icon' => 'tbl_structure.php?server=' . $GLOBALS['server'] . '&db=%2$s&table=%1$s' . '&token=' . $_SESSION[' PMA_token ']); $this->classes = 'view'; }
/** * Returns the html for create table. * * @param string $db database name * * @return string */ function PMA_getHtmlForCreateTable($db) { $html = '<form id="create_table_form_minimal" method="post" ' . 'action="tbl_create.php">'; $html .= '<fieldset>'; $html .= '<legend>'; if (PMA_Util::showIcons('ActionLinksMode')) { $html .= PMA_Util::getImage('b_newtbl.png'); } $html .= __('Create table'); $html .= ' </legend>'; $html .= PMA_URL_getHiddenInputs($db); $html .= '<div class="formelement">'; $html .= __('Name') . ":"; $html .= ' <input type="text" name="table" maxlength="64" ' . 'size="30" required="required" />'; $html .= ' </div>'; $html .= ' <div class="formelement">'; $html .= __('Number of columns') . ":"; $html .= ' <input type="number" min="1" name="num_fields" value="4" required="required" />'; $html .= ' </div>'; $html .= ' <div class="clearfloat"></div>'; $html .= '</fieldset>'; $html .= '<fieldset class="tblFooters">'; $html .= ' <input type="submit" value="' . __('Go') . '" />'; $html .= '</fieldset>'; $html .= '</form>'; return $html; }
/** * 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=' . $_SESSION[' PMA_token '], 'icon' => 'tbl_indexes.php?server=' . $GLOBALS['server'] . '&db=%3$s&table=%2$s&index=%1$s' . '&token=' . $_SESSION[' PMA_token ']); $this->classes = 'index'; }
/** * 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'); $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'; }
/** * 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); $this->icon = PMA_Util::getImage('b_browse.png'); $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'; }
/** * 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); $new = PMA_NodeFactory::getInstance('Node', _pgettext('Create new database', 'New')); $new->isNew = $GLOBALS['is_create_db_priv']; $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); }
/** * 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.png', __('Hide')) . '</a></span>'; } return $ret; }
/** * 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=' . $_SESSION[' PMA_token '], 'icon' => 'db_events.php?server=' . $GLOBALS['server'] . '&db=%1$s&token=' . $_SESSION[' PMA_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=' . $_SESSION[' PMA_token '] . '&add_item=1', 'icon' => 'db_events.php?server=' . $GLOBALS['server'] . '&db=%2$s&token=' . $_SESSION[' PMA_token '] . '&add_item=1'); $new->classes = 'new_event italics'; $this->addChild($new); }
/** * Initialises the class * * @return Node_Column_Container */ public function __construct() { parent::__construct(__('Columns'), Node::CONTAINER); $this->icon = PMA_Util::getImage('pause.png', ''); $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 = PMA_NodeFactory::getInstance('Node', _pgettext('Create new column', 'New')); $new->isNew = true; $new->icon = PMA_Util::getImage('b_column_add.png', ''); $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); }
/** * Initialises the class * * @return Node_View_Container */ public function __construct() { parent::__construct(__('Views'), Node::CONTAINER); $this->icon = PMA_Util::getImage('b_views.png', ''); $this->links = array('text' => 'db_structure.php?server=' . $GLOBALS['server'] . '&db=%1$s&token=' . $GLOBALS['token'], 'icon' => 'db_structure.php?server=' . $GLOBALS['server'] . '&db=%1$s&token=' . $GLOBALS['token']); $this->real_name = 'views'; $new = PMA_NodeFactory::getInstance('Node', _pgettext('Create new view', 'New')); $new->isNew = true; $new->icon = PMA_Util::getImage('b_view_add.png', ''); $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); }
/** * Initialises the class * * @return Node_Column_Container */ public function __construct() { parent::__construct(__('Functions'), Node::CONTAINER); $this->icon = PMA_Util::getImage('b_routines.png'); $this->links = array('text' => 'db_routines.php?server=' . $GLOBALS['server'] . '&db=%1$s&token=' . $GLOBALS['token'], 'icon' => 'db_routines.php?server=' . $GLOBALS['server'] . '&db=%1$s&token=' . $GLOBALS['token']); $this->real_name = 'functions'; $new = PMA_NodeFactory::getInstance('Node', _pgettext('Create new function', 'New')); $new->isNew = true; $new->icon = PMA_Util::getImage('b_routine_add.png', ''); $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); }
/** * Initialises the class * * @return Node_Index_Container */ public function __construct() { parent::__construct(__('Indexes'), Node::CONTAINER); $this->icon = PMA_Util::getImage('b_index.png', ''); $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 = PMA_NodeFactory::getInstance('Node', _pgettext('Create new index', 'New')); $new->isNew = true; $new->icon = PMA_Util::getImage('b_index_add.png', ''); $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); }
/** * 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=' . $_SESSION[' PMA_token '] . '&type=PROCEDURE', 'icon' => 'db_routines.php?server=' . $GLOBALS['server'] . '&db=%1$s&token=' . $_SESSION[' PMA_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=' . $_SESSION[' PMA_token '] . '&add_item=1', 'icon' => 'db_routines.php?server=' . $GLOBALS['server'] . '&db=%2$s&token=' . $_SESSION[' PMA_token '] . '&add_item=1'); $new->classes = 'new_procedure italics'; $this->addChild($new); }
/** * Initialises the class */ 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=' . $_SESSION[' PMA_token '], 'icon' => 'db_structure.php?server=' . $GLOBALS['server'] . '&db=%1$s&tbl_type=table' . '&token=' . $_SESSION[' PMA_token ']); $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=' . $_SESSION[' PMA_token '], 'icon' => 'tbl_create.php?server=' . $GLOBALS['server'] . '&db=%2$s&token=' . $_SESSION[' PMA_token ']); $new->classes = 'new_table italics'; $this->addChild($new); }
/** * Initialises the class * * @return Node_Table_Container */ public function __construct() { parent::__construct(__('Tables'), Node::CONTAINER); $this->icon = PMA_Util::getImage('b_browse.png', ''); $this->links = array('text' => 'db_structure.php?server=' . $GLOBALS['server'] . '&db=%1$s&token=' . $GLOBALS['token'], 'icon' => 'db_structure.php?server=' . $GLOBALS['server'] . '&db=%1$s&token=' . $GLOBALS['token']); if ($GLOBALS['cfg']['NavigationTreeEnableGrouping']) { $this->separator = $GLOBALS['cfg']['NavigationTreeTableSeparator']; $this->separator_depth = (int) $GLOBALS['cfg']['NavigationTreeTableLevel']; } $this->real_name = 'tables'; $new = PMA_NodeFactory::getInstance('Node', _pgettext('Create new table', 'New')); $new->isNew = true; $new->icon = PMA_Util::getImage('b_table_add.png', ''); $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); }
/** * Test for PMA_getHtmlForCreateTable * * @return void */ public function testPMAGetHtmlForCreateTable() { $db = "pma_db"; //Call the test function $html = PMA_getHtmlForCreateTable($db); //getImage $this->assertContains(PMA_Util::getImage('b_table_add.png'), $html); //__('Create table') $this->assertContains(__('Create table'), $html); //PMA_URL_getHiddenInputs $this->assertContains(PMA_URL_getHiddenInputs($db), $html); //label $this->assertContains(__('Name'), $html); $this->assertContains(__('Number of columns'), $html); //button $this->assertContains(__('Go'), $html); }
/** * 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=' . $_SESSION[' PMA_token '], 'icon' => 'db_structure.php?server=' . $GLOBALS['server'] . '&db=%1$s&tbl_type=view' . '&token=' . $_SESSION[' PMA_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=' . $_SESSION[' PMA_token '], 'icon' => 'view_create.php?server=' . $GLOBALS['server'] . '&db=%2$s&token=' . $_SESSION[' PMA_token ']); $new->classes = 'new_view italics'; $this->addChild($new); }
/** * Returns the html for plugin Tab. * * @param Array $plugins list * * @return string */ function PMA_getPluginTab($plugins) { $html = '<div id="plugins_plugins">'; $html .= '<div id="sectionlinks">'; /** @var PMA_String $pmaString */ $pmaString = $GLOBALS['PMA_String']; foreach ($plugins as $plugin_type => $plugin_list) { $key = 'plugins-' . preg_replace('/[^a-z]/', '', $pmaString->strtolower($plugin_type)); $html .= '<a href="#' . $key . '">' . htmlspecialchars($plugin_type) . '</a>' . "\n"; } $html .= '</div>'; $html .= '<br />'; foreach ($plugins as $plugin_type => $plugin_list) { $key = 'plugins-' . preg_replace('/[^a-z]/', '', $pmaString->strtolower($plugin_type)); sort($plugin_list); $html .= '<table class="data_full_width" id="' . $key . '">'; $html .= '<caption class="tblHeaders">'; $html .= '<a class="top" href="#serverinfo">'; $html .= __('Begin'); $html .= PMA_Util::getImage('s_asc.png'); $html .= '</a>'; $html .= htmlspecialchars($plugin_type); $html .= '</caption>'; $html .= '<thead>'; $html .= '<tr>'; $html .= '<th>' . __('Plugin') . '</th>'; $html .= '<th>' . __('Module') . '</th>'; $html .= '<th>' . __('Library') . '</th>'; $html .= '<th>' . __('Version') . '</th>'; $html .= '<th>' . __('Author') . '</th>'; $html .= '<th>' . __('License') . '</th>'; $html .= '</tr>'; $html .= '</thead>'; $html .= '<tbody>'; $html .= PMA_getPluginList($plugin_list); $html .= '</tbody>'; $html .= '</table>'; } $html .= '</div>'; return $html; }
/** * 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; } switch ($GLOBALS['cfg']['DefaultTabTable']) { case 'tbl_structure.php': $this->title = __('Structure'); break; case 'tbl_select.php': $this->title = __('Search'); break; case 'tbl_change.php': $this->title = __('Insert'); break; case 'tbl_sql.php': $this->title = __('SQL'); break; case 'sql.php': $this->title = __('Browse'); break; } $this->links = array('text' => $GLOBALS['cfg']['DefaultTabTable'] . '?server=' . $GLOBALS['server'] . '&db=%2$s&table=%1$s' . '&pos=0&token=' . $_SESSION[' PMA_token '], 'icon' => $GLOBALS['cfg']['NavigationTreeDefaultTabTable'] . '?server=' . $GLOBALS['server'] . '&db=%2$s&table=%1$s&token=' . $_SESSION[' PMA_token '], 'title' => $this->title); $this->classes = 'table'; }
/** * setup HTML for a given Storage Engine * * @return string */ function PMA_getHtmlForSpecifiedServerEngines() { /** * Displays details about a given Storage Engine */ $html = ''; $engine_plugin = PMA_StorageEngine::getEngine($_REQUEST['engine']); $html .= '<h2>' . "\n" . PMA_Util::getImage('b_engine.png') . ' ' . htmlspecialchars($engine_plugin->getTitle()) . "\n" . ' ' . PMA_Util::showMySQLDocu($engine_plugin->getMysqlHelpPage()) . "\n" . '</h2>' . "\n\n"; $html .= '<p>' . "\n" . ' <em>' . "\n" . ' ' . htmlspecialchars($engine_plugin->getComment()) . "\n" . ' </em>' . "\n" . '</p>' . "\n\n"; $infoPages = $engine_plugin->getInfoPages(); if (!empty($infoPages) && is_array($infoPages)) { $html .= '<p>' . "\n" . ' <strong>[</strong>' . "\n"; if (empty($_REQUEST['page'])) { $html .= ' <strong>' . __('Variables') . '</strong>' . "\n"; } else { $html .= ' <a href="server_engines.php' . PMA_URL_getCommon(array('engine' => $_REQUEST['engine'])) . '">' . __('Variables') . '</a>' . "\n"; } foreach ($infoPages as $current => $label) { $html .= ' <strong>|</strong>' . "\n"; if (isset($_REQUEST['page']) && $_REQUEST['page'] == $current) { $html .= ' <strong>' . $label . '</strong>' . "\n"; } else { $html .= ' <a href="server_engines.php' . PMA_URL_getCommon(array('engine' => $_REQUEST['engine'], 'page' => $current)) . '">' . htmlspecialchars($label) . '</a>' . "\n"; } } unset($current, $label); $html .= ' <strong>]</strong>' . "\n" . '</p>' . "\n\n"; } unset($infoPages, $page_output); if (!empty($_REQUEST['page'])) { $page_output = $engine_plugin->getPage($_REQUEST['page']); } if (!empty($page_output)) { $html .= $page_output; } else { $html .= '<p> ' . $engine_plugin->getSupportInformationMessage() . "\n" . '</p>' . "\n" . $engine_plugin->getHtmlVariables(); } return $html; }
/** * Generates the header * * @return string The header */ public function getDisplay() { $retval = ''; if (!$this->_headerIsSent) { if (!$this->_isAjax && $this->_isEnabled) { $this->sendHttpHeaders(); $retval .= $this->_getHtmlStart(); $retval .= $this->_getMetaTags(); $retval .= $this->_getLinkTags(); $retval .= $this->getTitleTag(); // The user preferences have been merged at this point // so we can conditionally add CodeMirror if ($GLOBALS['cfg']['CodemirrorEnable']) { $this->_scripts->addFile('codemirror/lib/codemirror.js'); $this->_scripts->addFile('codemirror/mode/sql/sql.js'); $this->_scripts->addFile('codemirror/addon/runmode/runmode.js'); $this->_scripts->addFile('codemirror/addon/hint/show-hint.js'); $this->_scripts->addFile('codemirror/addon/hint/sql-hint.js'); } if ($this->_userprefsOfferImport) { $this->_scripts->addFile('config.js'); } $retval .= $this->_scripts->getDisplay(); $retval .= '<noscript>'; $retval .= '<style>html{display:block}</style>'; $retval .= '</noscript>'; $retval .= $this->_getBodyStart(); if ($this->_menuEnabled && $GLOBALS['server'] > 0) { $nav = new PMA_Navigation(); $retval .= $nav->getDisplay(); } // Include possible custom headers if (file_exists(CUSTOM_HEADER_FILE)) { $retval .= '<div id="pma_header">'; ob_start(); include CUSTOM_HEADER_FILE; $retval .= ob_get_contents(); ob_end_clean(); $retval .= '</div>'; } // offer to load user preferences from localStorage if ($this->_userprefsOfferImport) { include_once './libraries/user_preferences.lib.php'; $retval .= PMA_userprefsAutoloadGetHeader(); } // pass configuration for hint tooltip display // (to be used by PMA_tooltip() in js/functions.js) if (!$GLOBALS['cfg']['ShowHint']) { $retval .= '<span id="no_hint" class="hide"></span>'; } $retval .= $this->_getWarnings(); if ($this->_menuEnabled && $GLOBALS['server'] > 0) { $retval .= $this->_menu->getDisplay(); $retval .= '<span id="lock_page_icon"></span>'; $retval .= sprintf('<a id="goto_pagetop" href="#" title="%s">%s</a>', __('Click on the bar to scroll to top of page'), PMA_Util::getImage('s_top.png')); } $retval .= $this->_console->getDisplay(); $retval .= '<div id="page_content">'; $retval .= $this->getMessage(); } if ($this->_isEnabled && empty($_REQUEST['recent_table'])) { $retval .= $this->_addRecentTable($GLOBALS['db'], $GLOBALS['table']); } } return $retval; }
/** * Creates one row for the parameter table used in the routine editor. * * @param array $routine Data for the routine returned by * PMA_RTN_getDataFromRequest() or * PMA_RTN_getDataFromName() * @param mixed $index Either a numeric index of the row being processed * or NULL to create a template row for AJAX request * @param string $class Class used to hide the direction column, if the * row is for a stored function. * * @return string HTML code of one row of parameter table for the editor. */ function PMA_RTN_getParameterRow($routine = array(), $index = null, $class = '') { global $param_directions, $param_opts_num, $titles; if ($index === null) { // template row for AJAX request $i = 0; $index = '%s'; $drop_class = ''; $routine = array('item_param_dir' => array(0 => ''), 'item_param_name' => array(0 => ''), 'item_param_type' => array(0 => ''), 'item_param_length' => array(0 => ''), 'item_param_opts_num' => array(0 => ''), 'item_param_opts_text' => array(0 => '')); } else { if (!empty($routine)) { // regular row for routine editor $drop_class = ' hide'; $i = $index; } else { // No input data. This shouldn't happen, // but better be safe than sorry. return ''; } } // Create the output $retval = ""; $retval .= " <tr>\n"; $retval .= " <td class='routine_direction_cell{$class}'>\n"; $retval .= " <select name='item_param_dir[{$index}]'>\n"; foreach ($param_directions as $key => $value) { $selected = ""; if (!empty($routine['item_param_dir'][$i]) && $routine['item_param_dir'][$i] == $value) { $selected = " selected='selected'"; } $retval .= " <option{$selected}>{$value}</option>\n"; } $retval .= " </select>\n"; $retval .= " </td>\n"; $retval .= " <td><input name='item_param_name[{$index}]' type='text'\n"; $retval .= " value='{$routine['item_param_name'][$i]}' /></td>\n"; $retval .= " <td><select name='item_param_type[{$index}]'>"; $retval .= PMA_Util::getSupportedDatatypes(true, $routine['item_param_type'][$i]) . "\n"; $retval .= " </select></td>\n"; $retval .= " <td>\n"; $retval .= " <input id='item_param_length_{$index}'\n"; $retval .= " name='item_param_length[{$index}]' type='text'\n"; $retval .= " value='{$routine['item_param_length'][$i]}' />\n"; $retval .= " <div class='enum_hint'>\n"; $retval .= " <a href='#' class='open_enum_editor'>\n"; $retval .= " " . PMA_Util::getImage('b_edit', '', array('title' => __('ENUM/SET editor'))) . "\n"; $retval .= " </a>\n"; $retval .= " </div>\n"; $retval .= " </td>\n"; $retval .= " <td class='hide no_len'>---</td>\n"; $retval .= " <td class='routine_param_opts_text'>\n"; $retval .= PMA_generateCharsetDropdownBox(PMA_CSDROPDOWN_CHARSET, "item_param_opts_text[{$index}]", null, $routine['item_param_opts_text'][$i]); $retval .= " </td>\n"; $retval .= " <td class='hide no_opts'>---</td>\n"; $retval .= " <td class='routine_param_opts_num'>\n"; $retval .= " <select name='item_param_opts_num[{$index}]'>\n"; $retval .= " <option value=''></option>"; foreach ($param_opts_num as $key => $value) { $selected = ""; if (!empty($routine['item_param_opts_num'][$i]) && $routine['item_param_opts_num'][$i] == $value) { $selected = " selected='selected'"; } $retval .= "<option{$selected}>{$value}</option>"; } $retval .= "\n </select>\n"; $retval .= " </td>\n"; $retval .= " <td class='routine_param_remove{$drop_class}'>\n"; $retval .= " <a href='#' class='routine_param_remove_anchor'>\n"; $retval .= " {$titles['Drop']}\n"; $retval .= " </a>\n"; $retval .= " </td>\n"; $retval .= " </tr>\n"; 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; }
} } else { $row['Default'] = htmlspecialchars($row['Default']); } $field_encoded = urlencode($row['Field']); $field_name = htmlspecialchars($row['Field']); $displayed_field_name = $field_name; // underline commented fields and display a hover-title (CSS only) if (isset($comments_map[$row['Field']])) { $displayed_field_name = '<span class="commented_column" title="' . htmlspecialchars($comments_map[$row['Field']]) . '">' . $field_name . '</span>'; } if ($primary && $primary->hasColumn($field_name)) { $displayed_field_name .= PMA_Util::getImage('b_primary.png', __('Primary')); } if (in_array($field_name, $columns_with_index)) { $displayed_field_name .= PMA_Util::getImage('bd_primary.png', __('Index')); } $response->addHTML('<tr class="' . ($odd_row ? 'odd' : 'even') . '">'); $odd_row = !$odd_row; $isInCentralColumns = in_array($row['Field'], $central_list) ? true : false; $response->addHTML(PMA_getHtmlTableStructureRow($row, $rownum, $displayed_field_name, $type_nowrap, $extracted_columnspec, $type_mime, $field_charset, $attribute, $tbl_is_view, $db_is_system_schema, $url_query, $field_encoded, $titles, $table)); if (!$tbl_is_view && !$db_is_system_schema) { $response->addHTML(PMA_getHtmlForActionsInTableStructure($type, $tbl_storage_engine, $primary, $field_name, $url_query, $titles, $row, $rownum, $columns_with_unique_index, $isInCentralColumns)); } // end if (! $tbl_is_view && ! $db_is_system_schema) $response->addHTML('</tr>'); unset($field_charset); } // end foreach $response->addHTML('</tbody></table>'); $response->addHTML(PMA_getHtmlForCheckAllTableColumn($pmaThemeImage, $text_dir, $tbl_is_view, $db_is_system_schema, $tbl_storage_engine));
/** * Get content inside the table row action links (Edit/Copy/Delete) * * @param string $icon The name of the file to get * @param string $display_text The text displaying after the image icon * * @return string * * @access private * * @see _getModifiedLinks(), _getDeleteAndKillLinks() */ private function _getActionLinkContent($icon, $display_text) { $linkContent = ''; if (isset($GLOBALS['cfg']['RowActionType']) && $GLOBALS['cfg']['RowActionType'] == self::ACTION_LINK_CONTENT_ICONS) { $linkContent .= '<span class="nowrap">' . PMA_Util::getImage($icon, $display_text) . '</span>'; } else { if (isset($GLOBALS['cfg']['RowActionType']) && $GLOBALS['cfg']['RowActionType'] == self::ACTION_LINK_CONTENT_TEXT) { $linkContent .= '<span class="nowrap">' . $display_text . '</span>'; } else { $linkContent .= PMA_Util::getIcon($icon, $display_text); } } return $linkContent; }
/** * Renders the link to open a new page * * @param string $url The url of the page * * @return string */ private function _getSelfLink($url) { $retval = ''; $retval .= '<div id="selflink" class="print_ignore">'; $retval .= '<a href="' . $url . '"' . ' title="' . __('Open new phpMyAdmin window') . '" target="_blank">'; if (PMA_Util::showIcons('TabsMode')) { $retval .= PMA_Util::getImage('window-new.png', __('Open new phpMyAdmin window')); } else { $retval .= __('Open new phpMyAdmin window'); } $retval .= '</a>'; $retval .= '</div>'; return $retval; }