Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /**
- *
- * @ This file is created by http://DeZender.Net
- * @ deZender (PHP7 Decoder for ionCube Encoder)
- *
- * @ Version : 4.1.0.0
- * @ Author : DeZender
- * @ Release on : 15.05.2020
- * @ Official site : http://DeZender.Net
- *
- */
- namespace PhpMyAdmin;
- class Util
- {
- /**
- * Checks whether configuration value tells to show icons.
- *
- * @param string $value Configuration option name
- *
- * @return boolean Whether to show icons.
- */
- static public function showIcons($value)
- {
- return in_array($GLOBALS['cfg'][$value], ['icons', 'both']);
- }
- /**
- * Checks whether configuration value tells to show text.
- *
- * @param string $value Configuration option name
- *
- * @return boolean Whether to show text.
- */
- static public function showText($value)
- {
- return in_array($GLOBALS['cfg'][$value], ['text', 'both']);
- }
- /**
- * Returns an HTML IMG tag for a particular icon from a theme,
- * which may be an actual file or an icon from a sprite.
- * This function takes into account the ActionLinksMode
- * configuration setting and wraps the image tag in a span tag.
- *
- * @param string $icon name of icon file
- * @param string $alternate alternate text
- * @param boolean $force_text whether to force alternate text to be displayed
- * @param boolean $menu_icon whether this icon is for the menu bar or not
- * @param string $control_param which directive controls the display
- *
- * @return string an html snippet
- */
- static public function getIcon($icon, $alternate = '', $force_text = false, $menu_icon = false, $control_param = 'ActionLinksMode')
- {
- $include_icon = $include_text = false;
- if (self::showIcons($control_param)) {
- $include_icon = true;
- }
- if ($force_text || self::showText($control_param)) {
- $include_text = true;
- }
- $button = ($menu_icon ? '' : '<span class="nowrap">');
- if ($include_icon) {
- $button .= self::getImage($icon, $alternate);
- }
- if ($include_icon && $include_text) {
- $button .= ' ';
- }
- if ($include_text) {
- $button .= $alternate;
- }
- $button .= ($menu_icon ? '' : '</span>');
- return $button;
- }
- /**
- * Returns an HTML IMG tag for a particular image from a theme
- *
- * The image name should match CSS class defined in icons.css.php
- *
- * @param string $image The name of the file to get
- * @param string $alternate Used to set 'alt' and 'title' attributes
- * of the image
- * @param array $attributes An associative array of other attributes
- *
- * @return string an html IMG tag
- */
- static public function getImage($image, $alternate = '', array $attributes = [])
- {
- $alternate = htmlspecialchars($alternate);
- if (isset($attributes['class'])) {
- $attributes['class'] = 'icon ic_' . $image . ' ' . $attributes['class'];
- }
- else {
- $attributes['class'] = 'icon ic_' . $image;
- }
- $attr_str = '';
- foreach ($attributes as $key => $value) {
- if (!in_array($key, ['alt', 'title'])) {
- $attr_str .= ' ' . $key . '="' . $value . '"';
- }
- }
- if (isset($attributes['alt'])) {
- $alt = $attributes['alt'];
- }
- else {
- $alt = $alternate;
- }
- if (isset($attributes['title'])) {
- $title = $attributes['title'];
- }
- else {
- $title = $alternate;
- }
- $template = '<img src="themes/dot.gif" title="%s" alt="%s"%s>';
- return sprintf($template, $title, $alt, $attr_str);
- }
- /**
- * Returns the formatted maximum size for an upload
- *
- * @param integer $max_upload_size the size
- *
- * @return string the message
- *
- * @access public
- */
- static public function getFormattedMaximumUploadSize($max_upload_size)
- {
- list($max_size, $max_unit) = self::formatByteDown($max_upload_size, 4);
- return '(' . sprintf(__('Max: %s%s'), $max_size, $max_unit) . ')';
- }
- /**
- * Generates a hidden field which should indicate to the browser
- * the maximum size for upload
- *
- * @param integer $max_size the size
- *
- * @return string the INPUT field
- *
- * @access public
- */
- static public function generateHiddenMaxFileSize($max_size)
- {
- return '<input type="hidden" name="MAX_FILE_SIZE" value="' . $max_size . '">';
- }
- /**
- * Add slashes before "_" and "%" characters for using them in MySQL
- * database, table and field names.
- * Note: This function does not escape backslashes!
- *
- * @param string $name the string to escape
- *
- * @return string the escaped string
- *
- * @access public
- */
- static public function escapeMysqlWildcards($name)
- {
- return strtr($name, ['_' => '\\_', '%' => '\\%']);
- }
- /**
- * removes slashes before "_" and "%" characters
- * Note: This function does not unescape backslashes!
- *
- * @param string $name the string to escape
- *
- * @return string the escaped string
- *
- * @access public
- */
- static public function unescapeMysqlWildcards($name)
- {
- return strtr($name, ['\\_' => '_', '\\%' => '%']);
- }
- /**
- * removes quotes (',",`) from a quoted string
- *
- * checks if the string is quoted and removes this quotes
- *
- * @param string $quoted_string string to remove quotes from
- * @param string $quote type of quote to remove
- *
- * @return string unqoted string
- */
- static public function unQuote($quoted_string, $quote = NULL)
- {
- $quotes = [];
- if ($quote === NULL) {
- $quotes[] = '`';
- $quotes[] = '"';
- $quotes[] = '\'';
- }
- else {
- $quotes[] = $quote;
- }
- foreach ($quotes as $quote) {
- if ((mb_substr($quoted_string, 0, 1) === $quote) && (mb_substr($quoted_string, -1, 1) === $quote)) {
- $unquoted_string = mb_substr($quoted_string, 1, -1);
- $unquoted_string = str_replace($quote . $quote, $quote, $unquoted_string);
- return $unquoted_string;
- }
- }
- return $quoted_string;
- }
- /**
- * format sql strings
- *
- * @param string $sqlQuery raw SQL string
- * @param boolean $truncate truncate the query if it is too long
- *
- * @return string the formatted sql
- *
- * @global array $cfg the configuration array
- *
- * @access public
- * @todo move into PMA_Sql
- */
- static public function formatSql($sqlQuery, $truncate = false)
- {
- global $cfg;
- if ($truncate && ($cfg['MaxCharactersInDisplayedSQL'] < mb_strlen($sqlQuery))) {
- .....................................................................
- .........................................
- ...............
Add Comment
Please, Sign In to add comment