Get the action word corresponding to a script name
in order to display it as a title in navigation panel
public static getTitleForTarget ( string $target ) : string | ||
$target | string | a valid value for $cfg['NavigationTreeDefaultTabTable'], $cfg['NavigationTreeDefaultTabTable2'], $cfg['DefaultTabTable'] or $cfg['DefaultTabDatabase'] |
return | string | Title for the $cfg value |
/** * 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 = array(); $this->_addIcon(Util::getScriptNameForOption($GLOBALS['cfg']['NavigationTreeDefaultTabTable'], 'table')); $this->_addIcon(Util::getScriptNameForOption($GLOBALS['cfg']['NavigationTreeDefaultTabTable2'], 'table')); $title = Util::getTitleForTarget($GLOBALS['cfg']['DefaultTabTable']); $this->title = $title; $script_name = Util::getScriptNameForOption($GLOBALS['cfg']['DefaultTabTable'], 'table'); $this->links = array('text' => $script_name . '?server=' . $GLOBALS['server'] . '&db=%2$s&table=%1$s' . '&pos=0&token=' . $_SESSION[' PMA_token '], 'icon' => array(Util::getScriptNameForOption($GLOBALS['cfg']['NavigationTreeDefaultTabTable'], 'table') . '?server=' . $GLOBALS['server'] . '&db=%2$s&table=%1$s&token=' . $_SESSION[' PMA_token '], Util::getScriptNameForOption($GLOBALS['cfg']['NavigationTreeDefaultTabTable2'], 'table') . '?server=' . $GLOBALS['server'] . '&db=%2$s&table=%1$s&token=' . $_SESSION[' PMA_token ']), 'title' => $this->title); $this->classes = 'table'; }
/** * Provide a line with links to the relevant database and table * * @param string $url_dbname url database name that urlencode() string * @param string $dbname database name * @param string $tablename table name * * @return string HTML snippet */ function PMA_getLinkToDbAndTable($url_dbname, $dbname, $tablename) { $html_output = '[ ' . __('Database') . ' <a href="' . Util::getScriptNameForOption($GLOBALS['cfg']['DefaultTabDatabase'], 'database') . PMA_URL_getCommon(array('db' => $url_dbname, 'reload' => 1)) . '">' . htmlspecialchars($dbname) . ': ' . Util::getTitleForTarget($GLOBALS['cfg']['DefaultTabDatabase']) . "</a> ]\n"; if (mb_strlen($tablename)) { $html_output .= ' [ ' . __('Table') . ' <a href="' . Util::getScriptNameForOption($GLOBALS['cfg']['DefaultTabTable'], 'table') . PMA_URL_getCommon(array('db' => $url_dbname, 'table' => $tablename, 'reload' => 1)) . '">' . htmlspecialchars($tablename) . ': ' . Util::getTitleForTarget($GLOBALS['cfg']['DefaultTabTable']) . "</a> ]\n"; } return $html_output; }
/** * Returns, as an array, a list of parameters * used on the client side * * @return array */ public function getJsParams() { $db = !empty($GLOBALS['db']) ? $GLOBALS['db'] : ''; $table = !empty($GLOBALS['table']) ? $GLOBALS['table'] : ''; $pftext = !empty($_SESSION['tmpval']['pftext']) ? $_SESSION['tmpval']['pftext'] : ''; // not sure when this happens, but it happens if (!isset($GLOBALS['collation_connection'])) { $GLOBALS['collation_connection'] = 'utf8_general_ci'; } $params = array('common_query' => PMA_URL_getCommon(array(), 'text'), 'opendb_url' => Util::getScriptNameForOption($GLOBALS['cfg']['DefaultTabDatabase'], 'database'), 'safari_browser' => PMA_USR_BROWSER_AGENT == 'SAFARI' ? 1 : 0, 'collation_connection' => $GLOBALS['collation_connection'], 'lang' => $GLOBALS['lang'], 'server' => $GLOBALS['server'], 'table' => $table, 'db' => $db, 'token' => $_SESSION[' PMA_token '], 'text_dir' => $GLOBALS['text_dir'], 'show_databases_navigation_as_tree' => $GLOBALS['cfg']['ShowDatabasesNavigationAsTree'], 'pma_absolute_uri' => $GLOBALS['cfg']['PmaAbsoluteUri'], 'pma_text_default_tab' => Util::getTitleForTarget($GLOBALS['cfg']['DefaultTabTable']), 'pma_text_left_default_tab' => Util::getTitleForTarget($GLOBALS['cfg']['NavigationTreeDefaultTabTable']), 'pma_text_left_default_tab2' => Util::getTitleForTarget($GLOBALS['cfg']['NavigationTreeDefaultTabTable2']), 'LimitChars' => $GLOBALS['cfg']['LimitChars'], 'pftext' => $pftext, 'confirm' => $GLOBALS['cfg']['Confirm'], 'LoginCookieValidity' => $GLOBALS['cfg']['LoginCookieValidity'], 'logged_in' => isset($GLOBALS['userlink']) ? true : false, 'PMA_VERSION' => PMA_VERSION); if (isset($GLOBALS['cfg']['Server']) && isset($GLOBALS['cfg']['Server']['auth_type'])) { $params['auth_type'] = $GLOBALS['cfg']['Server']['auth_type']; } return $params; }