From 5bf66662a9bdd62c5bccab15e607cd95cfb8fcab Mon Sep 17 00:00:00 2001 From: Charles Cabergs Date: Mon, 27 Jul 2020 10:05:23 +0200 Subject: Removed wordpress and phpmyadmin, my server doesn't handle it well and it brings shame on my familly --- .../classes/Config/FormDisplayTemplate.php | 526 --------------------- 1 file changed, 526 deletions(-) delete mode 100644 srcs/phpmyadmin/libraries/classes/Config/FormDisplayTemplate.php (limited to 'srcs/phpmyadmin/libraries/classes/Config/FormDisplayTemplate.php') diff --git a/srcs/phpmyadmin/libraries/classes/Config/FormDisplayTemplate.php b/srcs/phpmyadmin/libraries/classes/Config/FormDisplayTemplate.php deleted file mode 100644 index 07663b8..0000000 --- a/srcs/phpmyadmin/libraries/classes/Config/FormDisplayTemplate.php +++ /dev/null @@ -1,526 +0,0 @@ -config = $config; - $this->template = new Template(); - } - - /** - * Displays top part of the form - * - * @param string $action default: $_SERVER['REQUEST_URI'] - * @param string $method 'post' or 'get' - * @param array|null $hiddenFields array of form hidden fields (key: field name) - * - * @return string - */ - public function displayFormTop( - $action = null, - $method = 'post', - $hiddenFields = null - ): string { - static $hasCheckPageRefresh = false; - - if ($action === null) { - $action = $_SERVER['REQUEST_URI']; - } - if ($method != 'post') { - $method = 'get'; - } - $htmlOutput = '
'; - $htmlOutput .= ''; - // we do validation on page refresh when browser remembers field values, - // add a field with known value which will be used for checks - if (! $hasCheckPageRefresh) { - $hasCheckPageRefresh = true; - $htmlOutput .= '' . "\n"; - } - $htmlOutput .= Url::getHiddenInputs('', '', 0, 'server') . "\n"; - $htmlOutput .= Url::getHiddenFields((array) $hiddenFields, '', true); - return $htmlOutput; - } - - /** - * Displays form tabs which are given by an array indexed by fieldset id - * ({@link self::displayFieldsetTop}), with values being tab titles. - * - * @param array $tabs tab names - * - * @return string - */ - public function displayTabsTop(array $tabs): string - { - $items = []; - foreach ($tabs as $tabId => $tabName) { - $items[] = [ - 'content' => htmlspecialchars($tabName), - 'url' => [ - 'href' => '#' . $tabId, - ], - ]; - } - - $htmlOutput = $this->template->render('list/unordered', [ - 'class' => 'tabs responsivetable', - 'items' => $items, - ]); - $htmlOutput .= '
'; - $htmlOutput .= '
'; - return $htmlOutput; - } - - /** - * Displays top part of a fieldset - * - * @param string $title title of fieldset - * @param string $description description shown on top of fieldset - * @param array|null $errors error messages to display - * @param array $attributes optional extra attributes of fieldset - * - * @return string - */ - public function displayFieldsetTop( - $title = '', - $description = '', - $errors = null, - array $attributes = [] - ): string { - $this->group = 0; - - $attributes = array_merge(['class' => 'optbox'], $attributes); - - return $this->template->render('config/form_display/fieldset_top', [ - 'attributes' => $attributes, - 'title' => $title, - 'description' => $description, - 'errors' => $errors, - ]); - } - - /** - * 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 '; - break; - case 'password': - $htmlOutput .= ''; - 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 .= ''; - } - break; - case 'number_text': - $htmlOutput .= ''; - break; - case 'checkbox': - $htmlOutput .= ''; - break; - case 'select': - $htmlOutput .= ''; - break; - case 'list': - $htmlOutput .= ''; - break; - } - if ($isSetupScript - && isset($opts['userprefs_comment']) - && $opts['userprefs_comment'] - ) { - $htmlOutput .= '' - . $icons['tblops'] . ''; - } - if (isset($opts['setvalue']) && $opts['setvalue']) { - $htmlOutput .= '' . $icons['edit'] . ''; - } - if (isset($opts['show_restore_default']) && $opts['show_restore_default']) { - $htmlOutput .= '' . $icons['reload'] . ''; - } - // this must match with displayErrors() in scripts/config.js - if ($hasErrors) { - $htmlOutput .= "\n
"; - foreach ($opts['errors'] as $error) { - $htmlOutput .= '
' . htmlspecialchars($error) . '
'; - } - $htmlOutput .= '
'; - } - $htmlOutput .= ''; - if ($isSetupScript && isset($opts['userprefs_allow'])) { - $htmlOutput .= ''; - $htmlOutput .= 'group++; - if ($headerText === '') { - return ''; - } - $colspan = $this->config->get('is_setup') ? 3 : 2; - - return $this->template->render('config/form_display/group_header', [ - 'group' => $this->group, - 'colspan' => $colspan, - 'header_text' => $headerText, - ]); - } - - /** - * Display group footer - * - * @return void - */ - public function displayGroupFooter(): void - { - $this->group--; - } - - /** - * Displays bottom part of a fieldset - * - * @param bool $showButtons Whether show submit and reset button - * - * @return string - */ - public function displayFieldsetBottom(bool $showButtons = true): string - { - return $this->template->render('config/form_display/fieldset_bottom', [ - 'show_buttons' => $showButtons, - 'is_setup' => $this->config->get('is_setup'), - ]); - } - - /** - * Closes form tabs - * - * @return string - */ - public function displayTabsBottom(): string - { - return $this->template->render('config/form_display/tabs_bottom'); - } - - /** - * Displays bottom part of the form - * - * @return string - */ - public function displayFormBottom(): string - { - return $this->template->render('config/form_display/form_bottom'); - } - - /** - * Appends JS validation code to $js_array - * - * @param string $fieldId ID of field to validate - * @param string|array $validators validators callback - * @param array $jsArray will be updated with javascript code - * - * @return void - */ - public function addJsValidate($fieldId, $validators, array &$jsArray): void - { - foreach ((array) $validators as $validator) { - $validator = (array) $validator; - $vName = array_shift($validator); - $vArgs = []; - foreach ($validator as $arg) { - $vArgs[] = Sanitize::escapeJsString($arg); - } - $vArgs = $vArgs ? ", ['" . implode("', '", $vArgs) . "']" : ''; - $jsArray[] = "registerFieldValidator('$fieldId', '$vName', true$vArgs)"; - } - } - - /** - * Displays JavaScript code - * - * @param array $jsArray lines of javascript code - * - * @return string - */ - public function displayJavascript(array $jsArray): string - { - if (empty($jsArray)) { - return ''; - } - - return $this->template->render('javascript/display', [ - 'js_array' => $jsArray, - ]); - } - - /** - * Displays error list - * - * @param string $name Name of item with errors - * @param array $errorList List of errors to show - * - * @return string HTML for errors - */ - public function displayErrors($name, array $errorList): string - { - return $this->template->render('config/form_display/errors', [ - 'name' => $name, - 'error_list' => $errorList, - ]); - } -} -- cgit