Returns an HTML IMG tag for a particular image from a theme,
which may be an actual file or an icon from a sprite
public static getImage ( string $image, string $alternate = '', array $attributes = [] ) : string | ||
$image | string | The name of the file to get |
$alternate | string | Used to set 'alt' and 'title' attributes of the image |
$attributes | array | An associative array of other attributes |
return | string | an html IMG tag |
/** * 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\libraries\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', 'icon' => 'db_events.php?server=' . $GLOBALS['server'] . '&db=%2$s&item_name=%1$s&export_item=1'); $this->classes = 'event'; }
/** * Renders the navigation * * @return String HTML */ public function getDisplay() { if (empty($GLOBALS['url_query'])) { $GLOBALS['url_query'] = URL::getCommon(); } $link_url = 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\libraries\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 */ public function __construct($name, $type = Node::OBJECT, $is_group = false) { parent::__construct($name, $type, $is_group); $this->icon = PMA\libraries\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 */ public function __construct($name, $type = Node::OBJECT, $is_group = false) { parent::__construct($name, $type, $is_group); $this->icon = PMA\libraries\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=' . $_SESSION[' PMA_token '], 'icon' => 'db_routines.php?server=' . $GLOBALS['server'] . '&db=%2$s&item_name=%1$s&item_type=FUNCTION' . '&execute_dialog=1&token=' . $_SESSION[' PMA_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 */ public function __construct($name, $type = Node::OBJECT, $is_group = false) { parent::__construct($name, $type, $is_group); $this->icon = PMA\libraries\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', 'icon' => 'db_routines.php?server=' . $GLOBALS['server'] . '&db=%2$s&item_name=%1$s&item_type=PROCEDURE' . '&execute_dialog=1'); $this->classes = 'procedure'; }
/** * 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\libraries\Util::getImage('b_props.png', __('View')); $this->links = array('text' => 'sql.php?server=' . $GLOBALS['server'] . '&db=%2$s&table=%1$s&pos=0', 'icon' => 'tbl_structure.php?server=' . $GLOBALS['server'] . '&db=%2$s&table=%1$s'); $this->classes = 'view'; }
/** * 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\libraries\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=' . $_SESSION[' PMA_token '], 'icon' => 'db_triggers.php?server=' . $GLOBALS['server'] . '&db=%3$s&item_name=%1$s&export_item=1' . '&token=' . $_SESSION[' PMA_token ']); $this->classes = 'trigger'; }
/** * Returns HTML for control buttons displayed infront of a node * * @return String HTML for control buttons */ 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\libraries\Util::getImage('lightbulb_off.png', __('Hide')) . '</a></span>'; } return $ret; }
/** * Initialises the class * * @param string $name An identifier for the new node */ public function __construct($name) { parent::__construct($name, Node::CONTAINER); if ($GLOBALS['is_create_db_priv'] && $GLOBALS['cfg']['ShowCreateDb'] !== false) { $new = NodeFactory::getInstance('Node', _pgettext('Create new database', 'New')); $new->isNew = true; $new->icon = PMA\libraries\Util::getImage('b_newdb.png', ''); $new->links = array('text' => 'server_databases.php?server=' . $GLOBALS['server'], 'icon' => 'server_databases.php?server=' . $GLOBALS['server']); $new->classes = 'new_database italics'; $this->addChild($new); } }
/** * Returns HTML for control buttons displayed infront of a node * * @return String HTML for control buttons */ public function getHtmlForControlButtons() { $ret = ''; $cfgRelation = PMA_getRelationsParam(); if ($cfgRelation['navwork']) { $db = $this->realParent()->real_name; $item = $this->real_name; $params = array('hideNavItem' => true, 'itemType' => $this->getItemType(), 'itemName' => $item, 'dbName' => $db); $ret = '<span class="navItemControls">' . '<a href="navigation.php' . URL::getCommon($params) . '"' . ' class="hideNavItem ajax">' . PMA\libraries\Util::getImage('hide.png', __('Hide')) . '</a></span>'; } return $ret; }
/** * Initialises the class */ public function __construct() { parent::__construct(__('Events'), Node::CONTAINER); $this->icon = PMA\libraries\Util::getImage('b_events.png', ''); $this->links = array('text' => 'db_events.php?server=' . $GLOBALS['server'] . '&db=%1$s', 'icon' => 'db_events.php?server=' . $GLOBALS['server'] . '&db=%1$s'); $this->real_name = 'events'; $new = NodeFactory::getInstance('Node', _pgettext('Create new event', 'New')); $new->isNew = true; $new->icon = PMA\libraries\Util::getImage('b_event_add.png', ''); $new->links = array('text' => 'db_events.php?server=' . $GLOBALS['server'] . '&db=%2$s&add_item=1', 'icon' => 'db_events.php?server=' . $GLOBALS['server'] . '&db=%2$s&add_item=1'); $new->classes = 'new_event italics'; $this->addChild($new); }
/** * Initialises the class */ public function __construct() { parent::__construct(__('Triggers'), Node::CONTAINER); $this->icon = PMA\libraries\Util::getImage('b_triggers.png'); $this->links = array('text' => 'db_triggers.php?server=' . $GLOBALS['server'] . '&db=%2$s&table=%1$s&token=' . $_SESSION[' PMA_token '], 'icon' => 'db_triggers.php?server=' . $GLOBALS['server'] . '&db=%2$s&table=%1$s&token=' . $_SESSION[' PMA_token ']); $this->real_name = 'triggers'; $new = NodeFactory::getInstance('Node', _pgettext('Create new trigger', 'New')); $new->isNew = true; $new->icon = PMA\libraries\Util::getImage('b_trigger_add.png', ''); $new->links = array('text' => 'db_triggers.php?server=' . $GLOBALS['server'] . '&db=%3$s&token=' . $_SESSION[' PMA_token '] . '&add_item=1', 'icon' => 'db_triggers.php?server=' . $GLOBALS['server'] . '&db=%3$s&token=' . $_SESSION[' PMA_token '] . '&add_item=1'); $new->classes = 'new_trigger italics'; $this->addChild($new); }
/** * Initialises the class */ public function __construct() { parent::__construct(__('Columns'), Node::CONTAINER); $this->icon = Util::getImage('pause.png', __('Columns')); $this->links = array('text' => 'tbl_structure.php?server=' . $GLOBALS['server'] . '&db=%2$s&table=%1$s' . '&token=' . $_SESSION[' PMA_token '], 'icon' => 'tbl_structure.php?server=' . $GLOBALS['server'] . '&db=%2$s&table=%1$s' . '&token=' . $_SESSION[' PMA_token ']); $this->real_name = 'columns'; $new_label = _pgettext('Create new column', 'New'); $new = NodeFactory::getInstance('Node', $new_label); $new->isNew = true; $new->icon = 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=' . $_SESSION[' PMA_token '], 'icon' => 'tbl_addfield.php?server=' . $GLOBALS['server'] . '&db=%3$s&table=%2$s' . '&field_where=last&after_field=' . '&token=' . $_SESSION[' PMA_token ']); $new->classes = 'new_column italics'; $this->addChild($new); }
/** * Initialises the class */ public function __construct() { parent::__construct(__('Procedures'), Node::CONTAINER); $this->icon = PMA\libraries\Util::getImage('b_routines.png', __('Procedures')); $this->links = array('text' => 'db_routines.php?server=' . $GLOBALS['server'] . '&db=%1$s&type=PROCEDURE', 'icon' => 'db_routines.php?server=' . $GLOBALS['server'] . '&db=%1$s&type=PROCEDURE'); $this->real_name = 'procedures'; $new_label = _pgettext('Create new procedure', 'New'); $new = NodeFactory::getInstance('Node', $new_label); $new->isNew = true; $new->icon = PMA\libraries\Util::getImage('b_routine_add.png', $new_label); $new->links = array('text' => 'db_routines.php?server=' . $GLOBALS['server'] . '&db=%2$s&add_item=1', 'icon' => 'db_routines.php?server=' . $GLOBALS['server'] . '&db=%2$s&add_item=1'); $new->classes = 'new_procedure italics'; $this->addChild($new); }
/** * Initialises the class */ public function __construct() { parent::__construct(__('Indexes'), Node::CONTAINER); $this->icon = PMA\libraries\Util::getImage('b_index.png', __('Indexes')); $this->links = array('text' => 'tbl_structure.php?server=' . $GLOBALS['server'] . '&db=%2$s&table=%1$s' . '&token=' . $_SESSION[' PMA_token '], 'icon' => 'tbl_structure.php?server=' . $GLOBALS['server'] . '&db=%2$s&table=%1$s' . '&token=' . $_SESSION[' PMA_token ']); $this->real_name = 'indexes'; $new_label = _pgettext('Create new index', 'New'); $new = NodeFactory::getInstance('Node', $new_label); $new->isNew = true; $new->icon = PMA\libraries\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=' . $_SESSION[' PMA_token '], 'icon' => 'tbl_indexes.php?server=' . $GLOBALS['server'] . '&create_index=1&added_fields=2' . '&db=%3$s&table=%2$s&token=' . $_SESSION[' PMA_token ']); $new->classes = 'new_index italics'; $this->addChild($new); }
/** * Initialises the class */ public function __construct() { parent::__construct(__('Functions'), Node::CONTAINER); $this->icon = PMA\libraries\Util::getImage('b_routines.png', __('Functions')); $this->links = array('text' => 'db_routines.php?server=' . $GLOBALS['server'] . '&db=%1$s&token=' . $_SESSION[' PMA_token '] . '&type=FUNCTION', 'icon' => 'db_routines.php?server=' . $GLOBALS['server'] . '&db=%1$s&token=' . $_SESSION[' PMA_token '] . '&type=FUNCTION'); $this->real_name = 'functions'; $new_label = _pgettext('Create new function', 'New'); $new = NodeFactory::getInstance('Node', $new_label); $new->isNew = true; $new->icon = PMA\libraries\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&item_type=FUNCTION', 'icon' => 'db_routines.php?server=' . $GLOBALS['server'] . '&db=%2$s&token=' . $_SESSION[' PMA_token '] . '&add_item=1&item_type=FUNCTION'); $new->classes = 'new_function italics'; $this->addChild($new); }
/** * Initialises the class */ public function __construct() { parent::__construct(__('Tables'), Node::CONTAINER); $this->icon = PMA\libraries\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 = NodeFactory::getInstance('Node', $new_label); $new->isNew = true; $new->icon = PMA\libraries\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 */ public function __construct() { parent::__construct(__('Views'), Node::CONTAINER); $this->icon = PMA\libraries\Util::getImage('b_views.png', __('Views')); $this->links = array('text' => 'db_structure.php?server=' . $GLOBALS['server'] . '&db=%1$s&tbl_type=view', 'icon' => 'db_structure.php?server=' . $GLOBALS['server'] . '&db=%1$s&tbl_type=view'); $this->classes = 'viewContainer subContainer'; $this->real_name = 'views'; $new_label = _pgettext('Create new view', 'New'); $new = NodeFactory::getInstance('Node', $new_label); $new->isNew = true; $new->icon = PMA\libraries\Util::getImage('b_view_add.png', $new_label); $new->links = array('text' => 'view_create.php?server=' . $GLOBALS['server'] . '&db=%2$s', 'icon' => 'view_create.php?server=' . $GLOBALS['server'] . '&db=%2$s'); $new->classes = 'new_view italics'; $this->addChild($new); }
/** * Prints Server Process list * * @return string */ function PMA_getHtmlForServerProcesslist() { $url_params = array(); $show_full_sql = !empty($_REQUEST['full']); if ($show_full_sql) { $url_params['full'] = 1; $full_text_link = 'server_status_processes.php' . URL::getCommon(array(), '?'); } else { $full_text_link = 'server_status_processes.php' . URL::getCommon(array('full' => 1)); } // This array contains display name and real column name of each // sortable column in the table $sortable_columns = array(array('column_name' => __('ID'), 'order_by_field' => 'Id'), array('column_name' => __('User'), 'order_by_field' => 'User'), array('column_name' => __('Host'), 'order_by_field' => 'Host'), array('column_name' => __('Database'), 'order_by_field' => 'db'), array('column_name' => __('Command'), 'order_by_field' => 'Command'), array('column_name' => __('Time'), 'order_by_field' => 'Time'), array('column_name' => __('Status'), 'order_by_field' => 'State'), array('column_name' => __('Progress'), 'order_by_field' => 'Progress'), array('column_name' => __('SQL query'), 'order_by_field' => 'Info')); $sortableColCount = count($sortable_columns); $sql_query = $show_full_sql ? 'SHOW FULL PROCESSLIST' : 'SHOW PROCESSLIST'; if (!empty($_REQUEST['order_by_field']) && !empty($_REQUEST['sort_order']) || !empty($_REQUEST['showExecuting'])) { $sql_query = 'SELECT * FROM `INFORMATION_SCHEMA`.`PROCESSLIST` '; } if (!empty($_REQUEST['showExecuting'])) { $sql_query .= ' WHERE state = "executing" '; } if (!empty($_REQUEST['order_by_field']) && !empty($_REQUEST['sort_order'])) { $sql_query .= ' ORDER BY ' . Util::backquote($_REQUEST['order_by_field']) . ' ' . $_REQUEST['sort_order']; } $result = $GLOBALS['dbi']->query($sql_query); $retval = '<table id="tableprocesslist" ' . 'class="data clearfloat noclick sortable">'; $retval .= '<thead>'; $retval .= '<tr>'; $retval .= '<th>' . __('Processes') . '</th>'; foreach ($sortable_columns as $column) { $is_sorted = !empty($_REQUEST['order_by_field']) && !empty($_REQUEST['sort_order']) && $_REQUEST['order_by_field'] == $column['order_by_field']; $column['sort_order'] = 'ASC'; if ($is_sorted && $_REQUEST['sort_order'] === 'ASC') { $column['sort_order'] = 'DESC'; } if (isset($_REQUEST['showExecuting'])) { $column['showExecuting'] = 'on'; } $retval .= '<th>'; $columnUrl = URL::getCommon($column); $retval .= '<a href="server_status_processes.php' . $columnUrl . '" '; if ($is_sorted) { $retval .= 'onmouseout="$(\'.soimg\').toggle()" ' . 'onmouseover="$(\'.soimg\').toggle()"'; } $retval .= '>'; $retval .= $column['column_name']; if ($is_sorted) { $asc_display_style = 'inline'; $desc_display_style = 'none'; if ($_REQUEST['sort_order'] === 'DESC') { $desc_display_style = 'inline'; $asc_display_style = 'none'; } $retval .= '<img class="icon ic_s_desc soimg" alt="' . __('Descending') . '" title="" src="themes/dot.gif" ' . 'style="display: ' . $desc_display_style . '" />'; $retval .= '<img class="icon ic_s_asc soimg hide" alt="' . __('Ascending') . '" title="" src="themes/dot.gif" ' . 'style="display: ' . $asc_display_style . '" />'; } $retval .= '</a>'; if (0 === --$sortableColCount) { $retval .= '<a href="' . $full_text_link . '">'; if ($show_full_sql) { $retval .= Util::getImage('s_partialtext.png', __('Truncate Shown Queries')); } else { $retval .= Util::getImage('s_fulltext.png', __('Show Full Queries')); } $retval .= '</a>'; } $retval .= '</th>'; } $retval .= '</tr>'; $retval .= '</thead>'; $retval .= '<tbody>'; while ($process = $GLOBALS['dbi']->fetchAssoc($result)) { $retval .= PMA_getHtmlForServerProcessItem($process, $show_full_sql); } $retval .= '</tbody>'; $retval .= '</table>'; return $retval; }
/** * 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">' . 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 .= Util::getIcon($icon, $display_text); } } return $linkContent; }
/** * Displays input field * * $opts keys: * o doc - (string) documentation link * o errors - error array * o setvalue - (string) shows button allowing to set predefined value * o show_restore_default - (boolean) whether show "restore default" button * o userprefs_allow - whether user preferences are enabled for this field * (null - no support, true/false - enabled/disabled) * o userprefs_comment - (string) field comment * o values - key - value pairs for <select> fields * o values_escaped - (boolean) tells whether values array is already escaped * (defaults to false) * o values_disabled - (array)list of disabled values (keys from values) * o comment - (string) tooltip comment * o comment_warning - (bool) whether this comments warns about something * * @param string $path config option path * @param string $name config option name * @param string $type type of config option * @param mixed $value current value * @param string $description verbose description * @param bool $value_is_default whether value is default * @param array $opts see above description * * @return string */ function PMA_displayInput($path, $name, $type, $value, $description = '', $value_is_default = true, $opts = null) { global $_FormDisplayGroup; static $icons; // An array of IMG tags used further below in the function if (defined('TESTSUITE')) { $icons = null; } $is_setup_script = defined('PMA_SETUP'); if ($icons === null) { // if the static variables have not been initialised $icons = array(); // Icon definitions: // The same indexes will be used in the $icons array. // The first element contains the filename and the second // element is used for the "alt" and "title" attributes. $icon_init = array('edit' => array('b_edit.png', ''), 'help' => array('b_help.png', __('Documentation')), 'reload' => array('s_reload.png', ''), 'tblops' => array('b_tblops.png', '')); if ($is_setup_script) { // When called from the setup script, we don't have access to the // sprite-aware getImage() function because the PMA_theme class // has not been loaded, so we generate the img tags manually. foreach ($icon_init as $k => $v) { $title = ''; if (!empty($v[1])) { $title = ' title="' . $v[1] . '"'; } $icons[$k] = sprintf('<img alt="%s" src="%s"%s />', $v[1], ".{$GLOBALS['cfg']['ThemePath']}/original/img/{$v[0]}", $title); } } else { // In this case we just use getImage() because it's available foreach ($icon_init as $k => $v) { $icons[$k] = Util::getImage($v[0], $v[1]); } } } $has_errors = isset($opts['errors']) && !empty($opts['errors']); $option_is_disabled = !$is_setup_script && isset($opts['userprefs_allow']) && !$opts['userprefs_allow']; $name_id = 'name="' . htmlspecialchars($path) . '" id="' . htmlspecialchars($path) . '"'; $field_class = $type == 'checkbox' ? 'checkbox' : ''; if (!$value_is_default) { $field_class .= ($field_class == '' ? '' : ' ') . ($has_errors ? 'custom field-error' : 'custom'); } $field_class = $field_class ? ' class="' . $field_class . '"' : ''; $tr_class = $_FormDisplayGroup > 0 ? 'group-field group-field-' . $_FormDisplayGroup : ''; if (isset($opts['setvalue']) && $opts['setvalue'] == ':group') { unset($opts['setvalue']); $_FormDisplayGroup++; $tr_class = 'group-header-field group-header-' . $_FormDisplayGroup; } if ($option_is_disabled) { $tr_class .= ($tr_class ? ' ' : '') . 'disabled-field'; } $tr_class = $tr_class ? ' class="' . $tr_class . '"' : ''; $htmlOutput = '<tr' . $tr_class . '>'; $htmlOutput .= '<th>'; $htmlOutput .= '<label for="' . htmlspecialchars($path) . '">' . $name . '</label>'; if (!empty($opts['doc'])) { $htmlOutput .= '<span class="doc">'; $htmlOutput .= '<a href="' . $opts['doc'] . '" target="documentation">' . $icons['help'] . '</a>'; $htmlOutput .= "\n"; $htmlOutput .= '</span>'; } if ($option_is_disabled) { $htmlOutput .= '<span class="disabled-notice" title="'; $htmlOutput .= __('This setting is disabled, it will not be applied to your configuration.'); $htmlOutput .= '">' . __('Disabled') . "</span>"; } if (!empty($description)) { $htmlOutput .= '<small>' . $description . '</small>'; } $htmlOutput .= '</th>'; $htmlOutput .= '<td>'; switch ($type) { case 'text': $htmlOutput .= '<input type="text" size="40" ' . $name_id . $field_class . ' value="' . htmlspecialchars($value) . '" />'; break; case 'password': $htmlOutput .= '<input type="password" size="40" ' . $name_id . $field_class . ' value="' . htmlspecialchars($value) . '" />'; break; case 'short_text': // As seen in the reporting server (#15042) we sometimes receive // an array here. No clue about its origin nor content, so let's avoid // a notice on htmlspecialchars(). if (!is_array($value)) { $htmlOutput .= '<input type="text" size="25" ' . $name_id . $field_class . ' value="' . htmlspecialchars($value) . '" />'; } break; case 'number_text': $htmlOutput .= '<input type="number" ' . $name_id . $field_class . ' value="' . htmlspecialchars($value) . '" />'; break; case 'checkbox': $htmlOutput .= '<span' . $field_class . '><input type="checkbox" ' . $name_id . ($value ? ' checked="checked"' : '') . ' /></span>'; break; case 'select': $htmlOutput .= '<select ' . $name_id . $field_class . '>'; $escape = !(isset($opts['values_escaped']) && $opts['values_escaped']); $values_disabled = isset($opts['values_disabled']) ? array_flip($opts['values_disabled']) : array(); foreach ($opts['values'] as $opt_value_key => $opt_value) { // set names for boolean values if (is_bool($opt_value)) { $opt_value = mb_strtolower($opt_value ? __('Yes') : __('No')); } // escape if necessary if ($escape) { $display = htmlspecialchars($opt_value); $display_value = htmlspecialchars($opt_value_key); } else { $display = $opt_value; $display_value = $opt_value_key; } // compare with selected value // boolean values are cast to integers when used as array keys $selected = is_bool($value) ? (int) $value === $opt_value_key : $opt_value_key === $value; $htmlOutput .= '<option value="' . $display_value . '"'; if ($selected) { $htmlOutput .= ' selected="selected"'; } if (isset($values_disabled[$opt_value_key])) { $htmlOutput .= ' disabled="disabled"'; } $htmlOutput .= '>' . $display . '</option>'; } $htmlOutput .= '</select>'; break; case 'list': $htmlOutput .= '<textarea cols="40" rows="5" ' . $name_id . $field_class . '>' . htmlspecialchars(implode("\n", $value)) . '</textarea>'; break; } if (isset($opts['comment']) && $opts['comment']) { $class = 'field-comment-mark'; if (isset($opts['comment_warning']) && $opts['comment_warning']) { $class .= ' field-comment-warning'; } $htmlOutput .= '<span class="' . $class . '" title="' . htmlspecialchars($opts['comment']) . '">i</span>'; } if ($is_setup_script && isset($opts['userprefs_comment']) && $opts['userprefs_comment']) { $htmlOutput .= '<a class="userprefs-comment" title="' . htmlspecialchars($opts['userprefs_comment']) . '">' . $icons['tblops'] . '</a>'; } if (isset($opts['setvalue']) && $opts['setvalue']) { $htmlOutput .= '<a class="set-value" href="#' . htmlspecialchars("{$path}={$opts['setvalue']}") . '" title="' . sprintf(__('Set value: %s'), htmlspecialchars($opts['setvalue'])) . '" style="display:none">' . $icons['edit'] . '</a>'; } if (isset($opts['show_restore_default']) && $opts['show_restore_default']) { $htmlOutput .= '<a class="restore-default" href="#' . $path . '" title="' . __('Restore default value') . '" style="display:none">' . $icons['reload'] . '</a>'; } // this must match with displayErrors() in scripts/config.js if ($has_errors) { $htmlOutput .= "\n <dl class=\"inline_errors\">"; foreach ($opts['errors'] as $error) { $htmlOutput .= '<dd>' . htmlspecialchars($error) . '</dd>'; } $htmlOutput .= '</dl>'; } $htmlOutput .= '</td>'; if ($is_setup_script && isset($opts['userprefs_allow'])) { $htmlOutput .= '<td class="userprefs-allow" title="' . __('Allow users to customize this value') . '">'; $htmlOutput .= '<input type="checkbox" name="' . $path . '-userprefs-allow" '; if ($opts['userprefs_allow']) { $htmlOutput .= 'checked="checked"'; } $htmlOutput .= '/>'; $htmlOutput .= '</td>'; } else { if ($is_setup_script) { $htmlOutput .= '<td> </td>'; } } $htmlOutput .= '</tr>'; return $htmlOutput; }
/** * Returns the message with corresponding image icon * * @param string $message the message(s) * * @return string message with icon */ public function getMessageWithIcon($message) { if ('error' == $this->getLevel()) { $image = 's_error.png'; } elseif ('success' == $this->getLevel()) { $image = 's_success.png'; } else { $image = 's_notice.png'; } $message = Message::notice(Util::getImage($image)) . " " . $message; return $message; }
/** * Returns icon for the node * * @param boolean $match Whether the node matched loaded tree * * @return String with image name */ public function getIcon($match) { if (!$GLOBALS['cfg']['NavigationTreeEnableExpansion']) { return ''; } elseif ($match && !$this->is_group) { $this->visible = true; return Util::getImage('b_minus.png'); } else { return Util::getImage('b_plus.png', __('Expand/Collapse')); } }
/** * Returns HTML for control buttons displayed infront of a node * * @return String HTML for control buttons */ public function getHtmlForControlButtons() { $ret = ''; $cfgRelation = PMA_getRelationsParam(); if ($cfgRelation['navwork']) { if ($this->hiddenCount > 0) { $ret = '<span class="dbItemControls">' . '<a href="navigation.php' . PMA_URL_getCommon() . '&showUnhideDialog=true' . '&dbName=' . urldecode($this->real_name) . '"' . ' class="showUnhide ajax">' . Util::getImage('lightbulb.png', __('Show hidden items')) . '</a></span>'; } } return $ret; }
/** * Renders a single link for the top of the navigation panel * * @param string $link The url for the link * @param bool $showText Whether to show the text or to * only use it for title attributes * @param string $text The text to display and use for title attributes * @param bool $showIcon Whether to show the icon * @param string $icon The filename of the icon to show * @param string $linkId Value to use for the ID attribute * @param boolean $disableAjax Whether to disable ajax page loading for this link * @param string $linkTarget The name of the target frame for the link * @param array $classes HTML classes to apply * * @return string HTML code for one link */ public static function getNavigationLink( $link, $showText, $text, $showIcon, $icon, $linkId = '', $disableAjax = false, $linkTarget = '', $classes = array() ) { $retval = '<a href="' . $link . '"'; if (! empty($linkId)) { $retval .= ' id="' . $linkId . '"'; } if (! empty($linkTarget)) { $retval .= ' target="' . $linkTarget . '"'; } if ($disableAjax) { $classes[] = 'disableAjax'; } if (!empty($classes)) { $retval .= ' class="' . join(" ", $classes) . '"'; } $retval .= ' title="' . $text . '">'; if ($showIcon) { $retval .= Util::getImage( $icon, $text ); } if ($showText) { $retval .= $text; } $retval .= '</a>'; if ($showText) { $retval .= '<br />'; } return $retval; }
/** * 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 (Util::showIcons('TabsMode')) { $retval .= Util::getImage('window-new.png', __('Open new phpMyAdmin window')); } else { $retval .= __('Open new phpMyAdmin window'); } $retval .= '</a>'; $retval .= '</div>'; return $retval; }
/** * 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 ($GLOBALS['cfg']['LintEnable']) { $this->_scripts->addFile('codemirror/addon/lint/lint.js'); $this->_scripts->addFile('codemirror/addon/lint/sql-lint.js'); } } $this->_scripts->addCode('ConsoleEnterExecutes=' . ($GLOBALS['cfg']['ConsoleEnterExecutes'] ? 'true' : 'false')); $this->_scripts->addFiles($this->_console->getScripts()); 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 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="page_nav_icons">'; $retval .= '<span id="lock_page_icon"></span>'; $retval .= '<span id="page_settings_icon">' . Util::getImage('s_cog.png', __('Page-related settings')) . '</span>'; $retval .= sprintf('<a id="goto_pagetop" href="#">%s</a>', Util::getImage('s_top.png', __('Click on the bar to scroll to top of page'))); $retval .= '</span>'; } $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; }
/** * Get HTML snippet for change database charset * * @param string $db database name * @param string $table table name * * @return string $html_output */ function PMA_getHtmlForChangeDatabaseCharset($db, $table) { $html_output = '<div class="operations_half_width">' . '<form id="change_db_charset_form" '; $html_output .= 'class="ajax" '; $html_output .= 'method="post" action="db_operations.php">'; $html_output .= PMA_URL_getHiddenInputs($db, $table); $html_output .= '<fieldset>' . "\n" . ' <legend>'; if (PMA\libraries\Util::showIcons('ActionLinksMode')) { $html_output .= PMA\libraries\Util::getImage('s_asci.png') . ' '; } $html_output .= '<label for="select_db_collation">' . __('Collation') . '</label>' . "\n" . '</legend>' . "\n" . PMA_generateCharsetDropdownBox(PMA_CSDROPDOWN_COLLATION, 'db_collation', 'select_db_collation', isset($_REQUEST['db_collation']) ? $_REQUEST['db_collation'] : '', false) . '</fieldset>' . '<fieldset class="tblFooters">' . '<input type="submit" name="submitcollation"' . ' value="' . __('Go') . '" />' . "\n" . '</fieldset>' . "\n" . '</form></div>' . "\n"; return $html_output; }
/** * 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='dragHandle'>" . "<span class='ui-icon ui-icon-arrowthick-2-n-s'></span>" . "</td>\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" . " value='{$routine['item_param_name'][$i]}' /></td>\n"; $retval .= " <td><select name='item_param_type[{$index}]'>"; $retval .= PMA\libraries\Util::getSupportedDatatypes(true, $routine['item_param_type'][$i]) . "\n"; $retval .= " </select></td>\n"; $retval .= " <td>\n"; $retval .= " <input id='item_param_length_{$index}'\n" . " name='item_param_length[{$index}]' type='text'\n" . " value='{$routine['item_param_length'][$i]}' />\n"; $retval .= " <div class='enum_hint'>\n"; $retval .= " <a href='#' class='open_enum_editor'>\n"; $retval .= " " . PMA\libraries\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 with Settings dialog * * @return string */ function PMA_getHtmlForSettingsDialog() { $retval = '<div class="popupContent settingsPopup">'; $retval .= '<a href="#addNewChart">'; $retval .= PMA\libraries\Util::getImage('b_chart.png') . __('Add chart'); $retval .= '</a>'; $retval .= '<a href="#rearrangeCharts">'; $retval .= PMA\libraries\Util::getImage('b_tblops.png') . __('Enable charts dragging'); $retval .= '</a>'; $retval .= '<div class="clearfloat paddingtop"></div>'; $retval .= '<div class="floatleft">'; $retval .= __('Refresh rate') . '<br />'; $retval .= ServerStatusData::getHtmlForRefreshList('gridChartRefresh', 5, array(2, 3, 4, 5, 10, 20, 40, 60, 120, 300, 600, 1200)); $retval .= '<br />'; $retval .= '</div>'; $retval .= '<div class="floatleft">'; $retval .= __('Chart columns'); $retval .= '<br />'; $retval .= '<select name="chartColumns">'; $retval .= '<option>1</option>'; $retval .= '<option>2</option>'; $retval .= '<option>3</option>'; $retval .= '<option>4</option>'; $retval .= '<option>5</option>'; $retval .= '<option>6</option>'; $retval .= '</select>'; $retval .= '</div>'; $retval .= '<div class="clearfloat paddingtop">'; $retval .= '<b>' . __('Chart arrangement') . '</b> '; $retval .= PMA\libraries\Util::showHint(__('The arrangement of the charts is stored to the browsers local storage. ' . 'You may want to export it if you have a complicated set up.')); $retval .= '<br/>'; $retval .= '<a class="ajax" href="#importMonitorConfig">'; $retval .= __('Import'); $retval .= '</a>'; $retval .= ' '; $retval .= '<a class="disableAjax" href="#exportMonitorConfig">'; $retval .= __('Export'); $retval .= '</a>'; $retval .= ' '; $retval .= '<a href="#clearMonitorConfig">'; $retval .= __('Reset to default'); $retval .= '</a>'; $retval .= '</div>'; $retval .= '</div>'; return $retval; }