diff options
| author | Charles <sircharlesaze@gmail.com> | 2020-01-09 10:55:03 +0100 |
|---|---|---|
| committer | Charles <sircharlesaze@gmail.com> | 2020-01-09 13:09:38 +0100 |
| commit | 04d6d5ca99ebfd1cebb8ce06618fb3811fc1a8aa (patch) | |
| tree | 5c691241355c943a3c68ddb06b8cf8c60aa11319 /srcs/phpmyadmin/templates/server | |
| parent | 7e0d85db834d6351ed85d01e5126ac31dc510b86 (diff) | |
| download | ft_server-04d6d5ca99ebfd1cebb8ce06618fb3811fc1a8aa.tar.gz ft_server-04d6d5ca99ebfd1cebb8ce06618fb3811fc1a8aa.tar.bz2 ft_server-04d6d5ca99ebfd1cebb8ce06618fb3811fc1a8aa.zip | |
phpmyadmin working
Diffstat (limited to 'srcs/phpmyadmin/templates/server')
34 files changed, 2104 insertions, 0 deletions
diff --git a/srcs/phpmyadmin/templates/server/binlog/index.twig b/srcs/phpmyadmin/templates/server/binlog/index.twig new file mode 100644 index 0000000..cdc85dc --- /dev/null +++ b/srcs/phpmyadmin/templates/server/binlog/index.twig @@ -0,0 +1,107 @@ +<h2> + {{ get_image('s_tbl') }} + {% trans 'Binary log' %} +</h2> + +<form action="server_binlog.php" method="post"> + {{ get_hidden_inputs(url_params) }} + <fieldset> + <legend> + {% trans 'Select binary log to view' %} + </legend> + + {% set full_size = 0 %} + <select name="log"> + {% for each_log in binary_logs %} + <option value="{{ each_log['Log_name'] }}" + {{- each_log['Log_name'] == log ? ' selected' }}> + {{ each_log['Log_name'] }} + {% if each_log['File_size'] is defined %} + ({{ format_byte_down(each_log['File_size'], 3, 2)|join(' ') }}) + {% set full_size = full_size + each_log['File_size'] %} + {% endif %} + </option> + {% endfor %} + </select> + {{ binary_logs|length }} + {% trans 'Files' %}, + {% if full_size > 0 %} + {{ format_byte_down(full_size)|join(' ') }} + {% endif %} + </fieldset> + + <fieldset class="tblFooters"> + <input class="btn btn-primary" type="submit" value="{% trans 'Go' %}"> + </fieldset> +</form> + +{{ sql_message|raw }} + +<table id="binlogTable"> + <thead> + <tr> + <td colspan="6" class="center"> + {% if has_previous %} + {% if has_icons %} + <a href="server_binlog.php" data-post="{{ get_common(previous_params, '') }}" title=" + {%- trans %}Previous{% context %}Previous page{% endtrans %}"> + « + </a> + {% else %} + <a href="server_binlog.php" data-post="{{ get_common(previous_params, '') }}"> + {% trans %}Previous{% context %}Previous page{% endtrans %} « + </a> + {% endif %} + - + {% endif %} + + {% if is_full_query %} + <a href="server_binlog.php" data-post="{{ get_common(full_queries_params, '') }}" title="{% trans 'Truncate shown queries' %}"> + <img src="{{ image_path }}s_partialtext.png" alt="{% trans 'Truncate shown queries' %}"> + </a> + {% else %} + <a href="server_binlog.php" data-post="{{ get_common(full_queries_params, '') }}" title="{% trans 'Show full queries' %}"> + <img src="{{ image_path }}s_fulltext.png" alt="{% trans 'Show full queries' %}"> + </a> + {% endif %} + + {% if has_next %} + - + {% if has_icons %} + <a href="server_binlog.php" data-post="{{ get_common(next_params, '') }}" title=" + {%- trans %}Next{% context %}Next page{% endtrans %}"> + » + </a> + {% else %} + <a href="server_binlog.php" data-post="{{ get_common(next_params, '') }}"> + {% trans %}Next{% context %}Next page{% endtrans %} » + </a> + {% endif %} + {% endif %} + </td> + </tr> + <tr> + <th>{% trans 'Log name' %}</th> + <th>{% trans 'Position' %}</th> + <th>{% trans 'Event type' %}</th> + <th>{% trans 'Server ID' %}</th> + <th>{% trans 'Original position' %}</th> + <th>{% trans 'Information' %}</th> + </tr> + </thead> + + <tbody> + {% for value in values %} + <tr class="noclick"> + <td>{{ value['Log_name'] }}</td> + <td class="right">{{ value['Pos'] }}</td> + <td>{{ value['Event_type'] }}</td> + <td class="right">{{ value['Server_id'] }}</td> + <td class="right"> + {{- value['Orig_log_pos'] is defined ? value['Orig_log_pos'] : value['End_log_pos'] -}} + </td> + <td>{{ format_sql(value['Info'], not is_full_query) }}</td> + </tr> + {% endfor %} + </tbody> +</table> diff --git a/srcs/phpmyadmin/templates/server/collations/index.twig b/srcs/phpmyadmin/templates/server/collations/index.twig new file mode 100644 index 0000000..bb9dfb3 --- /dev/null +++ b/srcs/phpmyadmin/templates/server/collations/index.twig @@ -0,0 +1,32 @@ +<h2> + {{ get_image('s_asci') }} + {% trans 'Character sets and collations' %} +</h2> + +<div id="div_mysql_charset_collations"> + <table class="data noclick"> + <thead> + <tr> + <th id="collationHeader">{% trans 'Collation' %}</th> + <th>{% trans 'Description' %}</th> + </tr> + </thead> + + {% for charset in charsets %} + <tr> + <th colspan="2" class="right"> + {{ charset.name }} + {% if charset.description is not empty %} + (<em>{{ charset.description }}</em>) + {% endif %} + </th> + </tr> + {% for collation in charset.collations %} + <tr{{ collation.is_default ? ' class="marked"' }}> + <td>{{ collation.name }}</td> + <td>{{ collation.description }}</td> + </tr> + {% endfor %} + {% endfor %} + </table> +</div> diff --git a/srcs/phpmyadmin/templates/server/databases/index.twig b/srcs/phpmyadmin/templates/server/databases/index.twig new file mode 100644 index 0000000..ebff55f --- /dev/null +++ b/srcs/phpmyadmin/templates/server/databases/index.twig @@ -0,0 +1,323 @@ +<h2> + {{ get_image('s_db') }} + {% if has_statistics %} + {% trans 'Databases statistics' %} + {% else %} + {% trans 'Databases' %} + {% endif %} +</h2> + +{% if is_create_database_shown %} + <ul> + <li id="li_create_database" class="no_bullets"> + {% if has_create_database_privileges %} + <form method="post" action="server_databases.php" id="create_database_form" class="ajax"> + <p> + <strong> + <label for="text_create_db"> + {{ get_image('b_newdb') }} + {% trans 'Create database' %} + </label> + {{ show_mysql_docu('CREATE_DATABASE') }} + </strong> + </p> + + {{ get_hidden_inputs('', '', 5) }} + <input type="hidden" name="reload" value="1"> + {% if has_statistics %} + <input type="hidden" name="statistics" value="1"> + {% endif %} + + <input type="text" name="new_db" maxlength="64" class="textfield" value=" + {{- database_to_create }}" id="text_create_db" placeholder=" + {%- trans 'Database name' %}" required> + + {% if charsets is not empty %} + <select lang="en" dir="ltr" name="db_collation"> + <option value="">{% trans 'Collation' %}</option> + <option value=""></option> + {% for charset in charsets %} + <optgroup label="{{ charset.name }}" title="{{ charset.description }}"> + {% for collation in charset.collations %} + <option value="{{ collation.name }}" title="{{ collation.description }}"{{ collation.is_selected ? ' selected' }}> + {{- collation.name -}} + </option> + {% endfor %} + </optgroup> + {% endfor %} + </select> + {% endif %} + + <input id="buttonGo" class="btn btn-primary" type="submit" value="{% trans 'Create' %}"> + </form> + {% else %} + <p> + <strong> + {{ get_image('b_newdb') }} + {% trans 'Create database' %} + {{ show_mysql_docu('CREATE_DATABASE') }} + </strong> + </p> + + <span class="noPrivileges"> + {{ get_image('s_error', '', { + 'hspace': 2, + 'border': 0, + 'align': 'middle' + }) }} + {% trans 'No privileges to create databases' %} + </span> + {% endif %} + </li> + </ul> +{% endif %} + +{% if database_count > 0 %} + {% include 'filter.twig' with {'filter_value': ''} only %} + + <div id="tableslistcontainer"> + {{ get_list_navigator( + database_count, + pos, + url_params, + 'server_databases.php', + 'frame_content', + max_db_list + ) }} + + <form class="ajax" action="server_databases.php" method="post" name="dbStatsForm" id="dbStatsForm"> + {{ get_hidden_inputs(url_params) }} + <div class="responsivetable"> + <table id="tabledatabases" class="data"> + <thead> + <tr> + {% if is_drop_allowed %} + <th></th> + {% endif %} + <th> + <a href="server_databases.php{{ get_common(url_params|merge({ + 'sort_by': 'SCHEMA_NAME', + 'sort_order': url_params.sort_by == 'SCHEMA_NAME' + and url_params.sort_order == 'asc' ? 'desc' : 'asc' + })) }}"> + {% trans 'Database' %} + {% if url_params.sort_by == 'SCHEMA_NAME' %} + {% if url_params.sort_order == 'asc' %} + {{ get_image('s_asc', 'Ascending'|trans) }} + {% else %} + {{ get_image('s_desc', 'Descending'|trans) }} + {% endif %} + {% endif %} + </a> + </th> + + <th> + <a href="server_databases.php{{ get_common(url_params|merge({ + 'sort_by': 'DEFAULT_COLLATION_NAME', + 'sort_order': url_params.sort_by == 'DEFAULT_COLLATION_NAME' + and url_params.sort_order == 'asc' ? 'desc' : 'asc' + })) }}"> + {% trans 'Collation' %} + {% if url_params.sort_by == 'DEFAULT_COLLATION_NAME' %} + {% if url_params.sort_order == 'asc' %} + {{ get_image('s_asc', 'Ascending'|trans) }} + {% else %} + {{ get_image('s_desc', 'Descending'|trans) }} + {% endif %} + {% endif %} + </a> + </th> + + {% if has_statistics %} + {% for name, statistic in header_statistics %} + <th{{ statistic.format == 'byte' ? ' colspan="2"' }}> + <a href="server_databases.php{{ get_common(url_params|merge({ + 'sort_by': name, + 'sort_order': url_params.sort_by == name + and url_params.sort_order == 'asc' ? 'desc' : 'asc' + })) }}"> + {{ statistic.title }} + {% if url_params.sort_by == name %} + {% if url_params.sort_order == 'asc' %} + {{ get_image('s_asc', 'Ascending'|trans) }} + {% else %} + {{ get_image('s_desc', 'Descending'|trans) }} + {% endif %} + {% endif %} + </a> + </th> + {% endfor %} + {% endif %} + + {% if has_master_replication %} + <th>{% trans 'Master replication' %}</th> + {% endif %} + + {% if has_slave_replication %} + <th>{% trans 'Slave replication' %}</th> + {% endif %} + + <th>{% trans 'Action' %}</th> + </tr> + </thead> + + <tbody> + {% for database in databases %} + <tr class="db-row{{ database.is_system_schema ? ' noclick' }}" data-filter-row="{{ database.name|upper }}"> + {% if is_drop_allowed %} + <td class="tool"> + <input type="checkbox" name="selected_dbs[]" class="checkall" title=" + {{- database.name }}" value=" + {{- database.name }}" + {{- database.is_system_schema ? ' disabled' }}> + </td> + {% endif %} + + <td class="name"> + <a href="{{ get_script_name_for_option(default_tab_database, 'database') }} + {{- get_common({'db': database.name}) }}" title=" + {{- "Jump to database '%s'"|trans|format(database.name) }}"> + {{ database.name }} + </a> + </td> + + <td class="value"> + <dfn title="{{ database.collation.description }}"> + {{ database.collation.name }} + </dfn> + </td> + + {% if has_statistics %} + {% for statistic in database.statistics %} + {% if statistic.format is same as('byte') %} + {% set value = format_byte_down(statistic.raw, 3, 1) %} + <td class="value"> + <data value="{{ statistic.raw }}" title="{{ statistic.raw }}"> + {{ value[0] }} + </data> + </td> + <td class="unit">{{ value[1] }}</td> + {% else %} + <td class="value"> + <data value="{{ statistic.raw }}" title="{{ statistic.raw }}"> + {{ format_number(statistic.raw, 0) }} + </data> + </td> + {% endif %} + {% endfor %} + {% endif %} + + {% if database.replication.master.status %} + {% if database.replication.master.is_replicated %} + <td class="tool center"> + {{ get_icon('s_success', 'Replicated'|trans) }} + </td> + {% else %} + <td class="tool center"> + {{ get_icon('s_cancel', 'Not replicated'|trans) }} + </td> + {% endif %} + {% endif %} + + {% if database.replication.slave.status %} + {% if database.replication.slave.is_replicated %} + <td class="tool center"> + {{ get_icon('s_success', 'Replicated'|trans) }} + </td> + {% else %} + <td class="tool center"> + {{ get_icon('s_cancel', 'Not replicated'|trans) }} + </td> + {% endif %} + {% endif %} + + <td class="tool"> + <a class="server_databases" data=" + {{- database.name|js_format }}" href="server_privileges.php + {{- get_common({ + 'db': database.name, + 'checkprivsdb': database.name + }) }}" title=" + {{- 'Check privileges for database "%s".'|trans|format(database.name) }}"> + {{ get_icon('s_rights', 'Check privileges'|trans) }} + </a> + </td> + </tr> + {% endfor %} + </tbody> + + <tfoot> + <tr> + <th colspan="{{ is_drop_allowed ? '3' : '2' }}"> + {% trans 'Total:' %} + <span id="filter-rows-count"> + {{- database_count -}} + </span> + </th> + + {% if has_statistics %} + {% for statistic in total_statistics %} + {% if statistic.format is same as('byte') %} + {% set value = format_byte_down(statistic.raw, 3, 1) %} + <th class="value"> + <data value="{{ statistic.raw }}" title="{{ statistic.raw }}"> + {{ value[0] }} + </data> + </th> + <th class="unit">{{ value[1] }}</th> + {% else %} + <th class="value"> + <data value="{{ statistic.raw }}" title="{{ statistic.raw }}"> + {{ format_number(statistic.raw, 0) }} + </data> + </th> + {% endif %} + {% endfor %} + {% endif %} + + {% if has_master_replication %} + <th></th> + {% endif %} + + {% if has_slave_replication %} + <th></th> + {% endif %} + + <th></th> + </tr> + </tfoot> + </table> + </div> + + {# Footer buttons #} + {% if is_drop_allowed %} + {% include 'select_all.twig' with { + 'pma_theme_image': pma_theme_image, + 'text_dir': text_dir, + 'form_name': 'dbStatsForm' + } only %} + + {{ get_button_or_image( + '', + 'mult_submit ajax', + 'Drop'|trans, + 'b_deltbl' + ) }} + {% endif %} + + {# Enable statistics #} + {% if not has_statistics %} + {{ 'Note: Enabling the database statistics here might cause heavy traffic between the web server and the MySQL server.'|trans|notice }} + <ul> + <li class="li_switch_dbstats"> + <a href="server_databases.php" data-post="{{ get_common({'statistics': '1'}, '') }}" title="{% trans 'Enable statistics' %}"> + <strong>{% trans 'Enable statistics' %}</strong> + </a> + </li> + </ul> + {% endif %} + </form> + </div> +{% else %} + <p>{{ 'No databases'|trans|notice }}</p> +{% endif %} diff --git a/srcs/phpmyadmin/templates/server/engines/index.twig b/srcs/phpmyadmin/templates/server/engines/index.twig new file mode 100644 index 0000000..2b92dc1 --- /dev/null +++ b/srcs/phpmyadmin/templates/server/engines/index.twig @@ -0,0 +1,27 @@ +<h2> + {{ get_image('b_engine') }} + {% trans 'Storage engines' %} +</h2> + +<table class="noclick"> + <thead> + <tr> + <th>{% trans 'Storage Engine' %}</th> + <th>{% trans 'Description' %}</th> + </tr> + </thead> + <tbody> + {% for engine, details in engines %} + <tr class=" + {{- details['Support'] == 'NO' or details['Support'] == 'DISABLED' ? ' disabled' }} + {{ details['Support'] == 'DEFAULT' ? ' marked' }}"> + <td> + <a rel="newpage" href="server_engines.php{{ get_common({'engine': engine}) }}"> + {{ details['Engine'] }} + </a> + </td> + <td>{{ details['Comment'] }}</td> + </tr> + {% endfor %} + </tbody> +</table> diff --git a/srcs/phpmyadmin/templates/server/engines/show.twig b/srcs/phpmyadmin/templates/server/engines/show.twig new file mode 100644 index 0000000..088e3a0 --- /dev/null +++ b/srcs/phpmyadmin/templates/server/engines/show.twig @@ -0,0 +1,48 @@ +<h2> + {{ get_image('b_engine') }} + {% trans 'Storage engines' %} +</h2> + +{% if engine is not empty %} + <h2> + {{ get_image('b_engine') }} + {{ engine.title }} + {{ show_mysql_docu(engine.help_page) }} + </h2> + <p><em>{{ engine.comment }}</em></p> + + {% if engine.info_pages is not empty and engine.info_pages is iterable %} + <p> + <strong>[</strong> + {% if page is empty %} + <strong>{% trans 'Variables' %}</strong> + {% else %} + <a href="server_engines.php + {{- get_common({'engine': engine.engine}) }}"> + {% trans 'Variables' %} + </a> + {% endif %} + {% for current, label in engine.info_pages %} + <strong>|</strong> + {% if page is defined and page == current %} + <strong>{{ label }}</strong> + {% else %} + <a href="server_engines.php + {{- get_common({'engine': engine.engine, 'page': current}) }}"> + {{ label }} + </a> + {% endif %} + {% endfor %} + <strong>]</strong> + </p> + {% endif %} + + {% if engine.page is not empty %} + {{ engine.page|raw }} + {% else %} + <p>{{ engine.support }}</p> + {{ engine.variables|raw }} + {% endif %} +{% else %} + <p>{{ 'Unknown storage engine.'|trans|error }}</p> +{% endif %} diff --git a/srcs/phpmyadmin/templates/server/plugins/index.twig b/srcs/phpmyadmin/templates/server/plugins/index.twig new file mode 100644 index 0000000..ec8bbd4 --- /dev/null +++ b/srcs/phpmyadmin/templates/server/plugins/index.twig @@ -0,0 +1,58 @@ +<h2> + {{ get_image('b_plugin') }} + {% trans 'Plugins' %} +</h2> + +<div id="plugins_plugins"> + <div id="sectionlinks"> + {% for type in plugins|keys %} + <a class="btn btn-primary" href="#plugins-{{ clean_types[type] }}"> + {{ type }} + </a> + {% endfor %} + </div> + {% for type, list in plugins %} + <div class="responsivetable"> + <table class="data_full_width" id="plugins-{{ clean_types[type] }}"> + <caption class="tblHeaders"> + {{ type }} + </caption> + <thead> + <tr> + <th>{% trans 'Plugin' %}</th> + <th>{% trans 'Description' %}</th> + <th>{% trans 'Version' %}</th> + <th>{% trans 'Author' %}</th> + <th>{% trans 'License' %}</th> + </tr> + </thead> + <tbody> + {% for plugin in list %} + <tr class="noclick"> + <th> + {{ plugin.name }} + {% if plugin.status != 'ACTIVE' %} + <small class="attention"> + {% if plugin.status == 'INACTIVE' %} + {% trans 'inactive' %} + {% elseif plugin.status == 'DISABLED' %} + {% trans 'disabled' %} + {% elseif plugin.status == 'DELETING' %} + {% trans 'deleting' %} + {% elseif plugin.status == 'DELETED' %} + {% trans 'deleted' %} + {% endif %} + </small> + {% endif %} + </th> + <td>{{ plugin.description }}</td> + <td>{{ plugin.version }}</td> + <td>{{ plugin.author }}</td> + <td>{{ plugin.license }}</td> + </tr> + {% endfor %} + </tbody> + </table> + </div> + {% endfor %} +</div> diff --git a/srcs/phpmyadmin/templates/server/privileges/add_user_fieldset.twig b/srcs/phpmyadmin/templates/server/privileges/add_user_fieldset.twig new file mode 100644 index 0000000..26f0419 --- /dev/null +++ b/srcs/phpmyadmin/templates/server/privileges/add_user_fieldset.twig @@ -0,0 +1,8 @@ +<fieldset id="fieldset_add_user"> + <legend>{% trans %}New{% context %}Create new user{% endtrans %}</legend> + <a id="add_user_anchor" href="server_privileges.php{{ get_common(url_params) }}" + {% if rel_params is not empty %} + rel="{{ get_common(rel_params) }}" + {% endif %}> + {{ get_icon('b_usradd') }}{% trans 'Add user account' %}</a> +</fieldset> diff --git a/srcs/phpmyadmin/templates/server/privileges/choose_user_group.twig b/srcs/phpmyadmin/templates/server/privileges/choose_user_group.twig new file mode 100644 index 0000000..a28f302 --- /dev/null +++ b/srcs/phpmyadmin/templates/server/privileges/choose_user_group.twig @@ -0,0 +1,9 @@ +<form class="ajax" id="changeUserGroupForm" action="server_privileges.php" method="post"> + {{ get_hidden_inputs(params) }} + <fieldset id="fieldset_user_group_selection"> + <legend>{% trans 'User group' %}</legend> + {% trans 'User group' %}: + {{ get_dropdown('userGroup', all_user_groups, user_group, 'userGroup_select') }} + <input type="hidden" name="changeUserGroup" value="1"> + </fieldset> +</form> diff --git a/srcs/phpmyadmin/templates/server/privileges/column_privileges.twig b/srcs/phpmyadmin/templates/server/privileges/column_privileges.twig new file mode 100644 index 0000000..b49efa5 --- /dev/null +++ b/srcs/phpmyadmin/templates/server/privileges/column_privileges.twig @@ -0,0 +1,24 @@ +<div class="item" id="div_item_{{ name }}"> + <label for="select_{{ name }}_priv"> + <code><dfn title="{{ name_for_dfn }}">{{ priv_for_header }}</dfn></code> + </label> + + <select id="select_{{ name }}_priv" name="{{ name_for_select }}[]" multiple="multiple" size="8"> + {% for curr_col, curr_col_privs in columns %} + <option value="{{ curr_col }}" + {% if row[name_for_select] == 'Y' or curr_col_privs[name_for_current] %} + selected="selected" + {% endif %}> + {{ curr_col }} + </option> + {% endfor %} + </select> + + <em>{% trans 'Or' %}</em> + <label for="checkbox_{{ name_for_select }}_none"> + <input type="checkbox" name="{{ name_for_select }}_none" + id="checkbox_{{ name_for_select }}_none" + title="{% trans %}None{% context %}None privileges{% endtrans %}"> + {% trans %}None{% context %}None privileges{% endtrans %} + </label> +</div> diff --git a/srcs/phpmyadmin/templates/server/privileges/delete_user_fieldset.twig b/srcs/phpmyadmin/templates/server/privileges/delete_user_fieldset.twig new file mode 100644 index 0000000..84d288f --- /dev/null +++ b/srcs/phpmyadmin/templates/server/privileges/delete_user_fieldset.twig @@ -0,0 +1,17 @@ +<fieldset id="fieldset_delete_user"> + <legend> + {{ get_icon('b_usrdrop') }}{% trans 'Remove selected user accounts' %} + </legend> + <input type="hidden" name="mode" value="2"> + <p>({% trans 'Revoke all active privileges from the users and delete them afterwards.' %})</p> + <input type="checkbox" title="{% trans 'Drop the databases that have the same names as the users.' %}" + name="drop_users_db" id="checkbox_drop_users_db"> + <label for="checkbox_drop_users_db" + title="{% trans 'Drop the databases that have the same names as the users.' %}"> + {% trans 'Drop the databases that have the same names as the users.' %} + </label> +</fieldset> + +<fieldset id="fieldset_delete_user_footer" class="tblFooters"> + <input id="buttonGo" class="btn btn-primary ajax" type="submit" name="delete" value="{% trans 'Go' %}"> +</fieldset> diff --git a/srcs/phpmyadmin/templates/server/privileges/edit_routine_privileges.twig b/srcs/phpmyadmin/templates/server/privileges/edit_routine_privileges.twig new file mode 100644 index 0000000..12f8433 --- /dev/null +++ b/srcs/phpmyadmin/templates/server/privileges/edit_routine_privileges.twig @@ -0,0 +1,26 @@ +<div id="edit_user_dialog"> + {{ header|raw }} + <form class="submenu-item" name="usersForm" id="addUsersForm" action="server_privileges.php" method="post"> + {{ get_hidden_inputs() }} + <input type="hidden" name="username" value="{{ username }}"> + <input type="hidden" name="hostname" value="{{ hostname }}"> + <input type="hidden" name="dbname" value="{{ database }}"> + <input type="hidden" name="routinename" value="{{ routine }}"> + <input type="hidden" name="grant_count" value="{{ grant_count }}"> + <fieldset id="fieldset_user_global_rights"> + <legend data-submenu-label="{% trans 'Routine' %}"> + {% trans 'Routine-specific privileges' %} + </legend> + <p> + <small> + <em>{% trans 'Note: MySQL privilege names are expressed in English.' %}</em> + </small> + </p> + {{ priv_checkboxes|raw }} + </fieldset> + <fieldset id="fieldset_user_privtable_footer" class="tblFooters"> + <input type="hidden" name="update_privs" value="1"> + <input class="btn btn-primary" type="submit" value="{% trans 'Go' %}"> + </fieldset> + </form> +</div> diff --git a/srcs/phpmyadmin/templates/server/privileges/global_priv_table.twig b/srcs/phpmyadmin/templates/server/privileges/global_priv_table.twig new file mode 100644 index 0000000..54b1046 --- /dev/null +++ b/srcs/phpmyadmin/templates/server/privileges/global_priv_table.twig @@ -0,0 +1,22 @@ +{% for key, table in priv_table %} + <fieldset> + <legend> + <input type="checkbox" class="sub_checkall_box" id="checkall_{{ priv_table_names[key] }}_priv" + title="{% trans 'Check all' %}"> + <label for="checkall_{{ priv_table_names[key] }}_priv">{{ priv_table_names[key] }}</label> + </legend> + {% for priv in table %} + {% set checked = row[priv[0] ~ '_priv'] is defined and row[priv[0] ~ '_priv'] == 'Y' ? ' checked="checked"' %} + {% set formatted_priv = format_privilege(priv, true) %} + <div class="item"> + <input type="checkbox" class="checkall" name="{{ priv[0] }}_priv" id="checkbox_{{ priv[0] }}_priv" + value="Y" title="{{ priv[2] }}" {{ checked }}> + <label for="checkbox_{{ priv[0] }}_priv"> + <code> + {{ formatted_priv|raw }} + </code> + </label> + </div> + {% endfor %} + </fieldset> +{% endfor %} diff --git a/srcs/phpmyadmin/templates/server/privileges/initials_row.twig b/srcs/phpmyadmin/templates/server/privileges/initials_row.twig new file mode 100644 index 0000000..feadc46 --- /dev/null +++ b/srcs/phpmyadmin/templates/server/privileges/initials_row.twig @@ -0,0 +1,26 @@ +<table id="initials_table" cellspacing="5"> + <tr> + {% for tmp_initial, initial_was_found in array_initials %} + {% if tmp_initial is not same as(null) %} + {% if initial_was_found %} + <td> + <a class="ajax + {{- initial is defined and initial is same as(tmp_initial) ? ' active' -}} + " href="server_privileges.php + {{- get_common({'initial': tmp_initial}) }}"> + {{- tmp_initial|raw -}} + </a> + </td> + {% else %} + <td>{{ tmp_initial|raw }}</td> + {% endif %} + {% endif %} + {% endfor %} + <td> + <a href="server_privileges.php + {{- get_common({'showall': 1}) }}" class="nowrap"> + {% trans 'Show all' %} + </a> + </td> + </tr> +</table> diff --git a/srcs/phpmyadmin/templates/server/privileges/privileges_summary.twig b/srcs/phpmyadmin/templates/server/privileges/privileges_summary.twig new file mode 100644 index 0000000..438ecb7 --- /dev/null +++ b/srcs/phpmyadmin/templates/server/privileges/privileges_summary.twig @@ -0,0 +1,104 @@ +<form class="submenu-item" action="server_privileges.php" id="{{ form_id }}" method="post"> + {{ get_hidden_inputs() }} + <input type="hidden" name="username" value="{{ username }}"> + <input type="hidden" name="hostname" value="{{ hostname }}"> + + <fieldset> + <legend data-submenu-label="{{ sub_menu_label }}"> + {{ legend }} + </legend> + + <table class="data"> + <thead> + <tr> + <th>{{ type_label }}</th> + <th>{% trans 'Privileges' %}</th> + <th>{% trans 'Grant' %}</th> + {% if type == 'database' %} + <th>{% trans 'Table-specific privileges' %}</th> + {% elseif type == 'table' %} + <th>{% trans 'Column-specific privileges' %}</th> + {% endif %} + <th colspan="2">{% trans 'Action' %}</th> + </tr> + </thead> + + <tbody> + {% if privileges|length == 0 %} + {% set colspan = type == 'database' ? 7 : (type == 'table' ? 6 : 5) %} + <tr> + <td colspan="{{ colspan }}"><center><em>{% trans 'None' %}</em></center></td> + </tr> + {% else %} + {% for privilege in privileges %} + <tr> + <td>{{ privilege['name'] }}</td> + <td><code>{{ privilege['privileges']|raw }}</code></td> + <td>{{ privilege['grant'] ? 'Yes'|trans : 'No'|trans }}</td> + + {% if type == 'database' %} + <td>{{ privilege['table_privs'] ? 'Yes'|trans : 'No'|trans }}</td> + {% elseif type == 'table' %} + <td>{{ privilege['column_privs'] ? 'Yes'|trans : 'No'|trans }}</td> + {% endif %} + + <td>{{ privilege['edit_link']|raw }}</td> + <td>{{ privilege['revoke_link']|raw }}</td> + </tr> + {% endfor %} + {% endif %} + </tbody> + </table> + + {% if type == 'database' %} + <label for="text_dbname">{% trans 'Add privileges on the following database(s):' %}</label> + + {%- if databases is not empty %} + <select name="pred_dbname[]" multiple="multiple"> + {% for database in databases %} + <option value="{{ database|escape_mysql_wildcards }}"> + {{ database }} + </option> + {% endfor %} + </select> + {% endif -%} + + <input type="text" id="text_dbname" name="dbname"> + {{ show_hint("Wildcards % and _ should be escaped with a \\ to use them literally."|trans) }} + {% elseif type == 'table' %} + <input type="hidden" name="dbname" value="{{ database }}"> + + <label for="text_tablename">{% trans 'Add privileges on the following table:' %}</label> + + {%- if tables is not empty %} + <select name="pred_tablename" class="autosubmit"> + <option value="" selected="selected">{% trans 'Use text field' %}:</option> + {% for table in tables %} + <option value="{{ table }}">{{ table }}</option> + {% endfor %} + </select> + {% endif -%} + + <input type="text" id="text_tablename" name="tablename"> + {% else %} + <input type="hidden" name="dbname" value="{{ database }}"> + + <label for="text_routinename">{% trans 'Add privileges on the following routine:' %}</label> + + {%- if routines is not empty %} + <select name="pred_routinename" class="autosubmit"> + <option value="" selected="selected">{% trans 'Use text field' %}:</option> + {% for routine in routines %} + <option value="{{ routine }}">{{ routine }}</option> + {% endfor %} + </select> + {% endif -%} + + <input type="text" id="text_routinename" name="routinename"> + {% endif %} + </fieldset> + + <fieldset class="tblFooters"> + <input class="btn btn-primary" type="submit" value="{% trans 'Go' %}"> + </fieldset> +</form> diff --git a/srcs/phpmyadmin/templates/server/privileges/require_options.twig b/srcs/phpmyadmin/templates/server/privileges/require_options.twig new file mode 100644 index 0000000..03da691 --- /dev/null +++ b/srcs/phpmyadmin/templates/server/privileges/require_options.twig @@ -0,0 +1,32 @@ +<fieldset> + <legend>SSL</legend> + <div id="require_ssl_div"> + {% for require_option in require_options %} + {% if require_option['name'] is same as('ssl_cipher') %} + <div id="specified_div" style="padding-left:20px;"> + {% endif %} + <div class="item"> + {% if require_option['radio'] %} + <input type="radio" name="ssl_type" + id="{{ require_option['name'] }}_{{ require_option['value'] }}" + title="{{ require_option['description'] }}" + value="{{ require_option['value'] }}" {{ require_option['checked']|raw }}> + <label for="{{ require_option['name'] }}_{{ require_option['value'] }}"> + <code>{{ require_option['label'] }}</code> + </label> + {% else %} + <label for="text_{{ require_option['name'] }}"> + <code>{{ require_option['label'] }}</code> + </label> + <input type="text" name="{{ require_option['name'] }}" + id="text_{{ require_option['name'] }}" value="{{ require_option['value'] }}" + size="80" title="{{ require_option['description'] }}" + {%- if require_option['disabled'] %} + disabled + {%- endif %}> + {% endif %} + </div> + {% endfor %} + </div>{# END specified_div #} + </div>{# END require_ssl_div #} +</fieldset> diff --git a/srcs/phpmyadmin/templates/server/privileges/resource_limits.twig b/srcs/phpmyadmin/templates/server/privileges/resource_limits.twig new file mode 100644 index 0000000..2569bd7 --- /dev/null +++ b/srcs/phpmyadmin/templates/server/privileges/resource_limits.twig @@ -0,0 +1,21 @@ +<fieldset> + <legend>{% trans 'Resource limits' %}</legend> + <p> + <small> + <em>{% trans 'Note: Setting these options to 0 (zero) removes the limit.' %}</em> + </small> + </p> + {% for limit in limits %} + <div class="item"> + <label for="text_{{ limit['input_name'] }}"> + <code> + <dfn title="{{ limit['description'] }}"> + {{ limit['name_main'] }} + </dfn> + </code> + </label> + <input type="number" name="{{ limit['input_name'] }}" id="text_{{ limit['input_name'] }}" + value="{{ limit['value'] }}" title="{{ limit['description'] }}"> + </div> + {% endfor %} +</fieldset> diff --git a/srcs/phpmyadmin/templates/server/replication/change_master.twig b/srcs/phpmyadmin/templates/server/replication/change_master.twig new file mode 100644 index 0000000..1ff75ba --- /dev/null +++ b/srcs/phpmyadmin/templates/server/replication/change_master.twig @@ -0,0 +1,35 @@ +<form method="post" action="server_replication.php"> + {{ get_hidden_inputs('', '') }} + <fieldset id="fieldset_add_user_login"> + <legend> + {% trans 'Slave configuration' %} - + {% trans 'Change or reconfigure master server' %} + </legend> + <p> + {% trans 'Make sure you have a unique server-id in your configuration file (my.cnf). If not, please add the following line into [mysqld] section:' %} + </p> + <pre>server-id={{ server_id }}</pre> + + <div class="item"> + <label for="text_username">{% trans 'User name:' %}</label> + <input id="text_username" name="username" type="text" maxlength="{{ username_length }}" title="{% trans 'User name' %}" required> + </div> + <div class="item"> + <label for="text_pma_pw">{% trans 'Password:' %}</label> + <input id="text_pma_pw" name="pma_pw" type="password" title="{% trans 'Password' %}" required> + </div> + <div class="item"> + <label for="text_hostname">{% trans 'Host:' %}</label> + <input id="text_hostname" name="hostname" type="text" maxlength="{{ hostname_length }}" value="" required> + </div> + <div class="item"> + <label for="text_port">{% trans 'Port:' %}</label> + <input id="text_port" name="text_port" type="number" maxlength="6" value="3306" required> + </div> + </fieldset> + <fieldset id="fieldset_user_privtable_footer" class="tblFooters"> + <input type="hidden" name="sr_take_action" value="true"> + <input type="hidden" name="{{ submit_name }}" value="1"> + <input class="btn btn-primary" type="submit" id="confslave_submit" value="{% trans 'Go' %}"> + </fieldset> +</form> diff --git a/srcs/phpmyadmin/templates/server/replication/database_multibox.twig b/srcs/phpmyadmin/templates/server/replication/database_multibox.twig new file mode 100644 index 0000000..816db08 --- /dev/null +++ b/srcs/phpmyadmin/templates/server/replication/database_multibox.twig @@ -0,0 +1,9 @@ +<select id="db_select" class="width96" name="db_select[]" size="6" multiple> + {% for database in databases %} + <option value="{{ database }}">{{ database }}</option> + {% endfor %} +</select> +<p> + <a href="#" id="db_select_href">{% trans 'Select all' %}</a> / + <a href="#" id="db_reset_href">{% trans 'Unselect all' %}</a> +</p> diff --git a/srcs/phpmyadmin/templates/server/replication/index.twig b/srcs/phpmyadmin/templates/server/replication/index.twig new file mode 100644 index 0000000..c40df0d --- /dev/null +++ b/srcs/phpmyadmin/templates/server/replication/index.twig @@ -0,0 +1,36 @@ +<h2> + {{ get_image('s_replication') }} + {% trans 'Replication' %} +</h2> + +{% if is_super_user %} + <div id="replication"> + {{ error_messages|raw }} + + {% if is_master %} + {{ master_replication_html|raw }} + {% elseif master_configure is null and clear_screen is null %} + <fieldset> + <legend>{% trans 'Master replication' %}</legend> + {% apply format('<a href="server_replication.php" data-post="' ~ get_common(url_params|merge({'mr_configure': true}), '') ~ '">', '</a>')|raw %} + {% trans %} + This server is not configured as master in a replication process. Would you like to %sconfigure%s it? + {% endtrans %} + {% endapply %} + </fieldset> + {% endif %} + + {% if master_configure is not null %} + {{ master_configuration_html|raw }} + {% else %} + {% if clear_screen is null %} + {{ slave_configuration_html|raw }} + {% endif %} + {% if slave_configure is not null %} + {{ change_master_html|raw }} + {% endif %} + {% endif %} + </div> +{% else %} + {{ 'No privileges'|trans|error }} +{% endif %} diff --git a/srcs/phpmyadmin/templates/server/replication/master_add_slave_user.twig b/srcs/phpmyadmin/templates/server/replication/master_add_slave_user.twig new file mode 100644 index 0000000..5c2eec3 --- /dev/null +++ b/srcs/phpmyadmin/templates/server/replication/master_add_slave_user.twig @@ -0,0 +1,84 @@ +<div id="master_addslaveuser_gui"> + <form action="server_privileges.php" method="post" autocomplete="off" onsubmit="return checkAddUser(this);"> + {{ get_hidden_inputs('', '') }} + + <fieldset id="fieldset_add_user_login"> + <legend>{% trans 'Add slave replication user' %}</legend> + + <input type="hidden" name="grant_count" value="25"> + <input type="hidden" name="createdb" id="createdb_0" value="0"> + {# Needed for the replication slaves. #} + <input type="hidden" name="Repl_slave_priv" id="checkbox_Repl_slave_priv" value="Y"> + <input type="hidden" name="sr_take_action" value="true"> + + <div class="item"> + <label for="select_pred_username"> + {% trans 'User name:' %} + </label> + <span class="options"> + <select name="pred_username" id="select_pred_username" title="{% trans 'User name' %}"> + <option value="any"{{ predefined_username == 'any' ? ' selected' }}>{% trans 'Any user' %}</option> + <option value="userdefined"{{ predefined_username == 'userdefined' ? ' selected' }}>{% trans 'Use text field:' %}</option> + </select> + </span> + <input type="text" name="username" id="pma_username" maxlength="{{ username_length }}" title="{% trans 'User name' %}" value="{{ username }}"> + </div> + + <div class="item"> + <label for="select_pred_hostname"> + {% trans 'Host:' %} + </label> + <span class="options"> + <select name="pred_hostname" id="select_pred_hostname" title="{% trans 'Host' %}" + {%- if this_host is not null %} data-thishost="{{ this_host }}"{% endif %}> + <option value="any"{{ predefined_hostname == 'any' ? ' selected' }}>{% trans 'Any host' %}</option> + <option value="localhost"{{ predefined_hostname == 'localhost' ? ' selected' }}>{% trans 'Local' %}</option> + {% if this_host is not null %} + <option value="thishost"{{ predefined_hostname == 'thishost' ? ' selected' }}>{% trans 'This host' %}</option> + {% endif %} + <option value="hosttable"{{ predefined_hostname == 'hosttable' ? ' selected' }}>{% trans 'Use host table' %}</option> + <option value="userdefined"{{ predefined_hostname == 'userdefined' ? ' selected' }}>{% trans 'Use text field:' %}</option> + </select> + </span> + <input type="text" name="hostname" id="pma_hostname" maxlength="{{ hostname_length }}" title="{% trans 'Host' %}" value="{{ hostname }}"> + {{ show_hint('When Host table is used, this field is ignored and values stored in Host table are used instead.'|trans) }} + </div> + + <div class="item"> + <label for="select_pred_password"> + {% trans 'Password:' %} + </label> + <span class="options"> + <select name="pred_password" id="select_pred_password" title="{% trans 'Password' %}"> + <option value="none"{{ has_username ? ' selected' }}>{% trans 'No password' %}</option> + <option value="userdefined"{{ not has_username ? ' selected' }}>{% trans 'Use text field:' %}</option> + </select> + </span> + <input type="password" id="text_pma_pw" name="pma_pw" title="{% trans 'Password' %}"> + </div> + + <div class="item"> + <label for="text_pma_pw2"> + {% trans 'Re-type:' %} + </label> + <span class="options"></span> + <input type="password" id="text_pma_pw2" name="pma_pw2" title="{% trans 'Re-type' %}"> + </div> + + <div class="item"> + <label for="button_generate_password"> + {% trans 'Generate password:' %} + </label> + <span class="options"> + <input type="button" class="btn btn-secondary button" id="button_generate_password" value="{% trans 'Generate' %}" onclick="Functions.suggestPassword(this.form)"> + </span> + <input type="text" name="generated_pw" id="generated_pw"> + </div> + </fieldset> + + <fieldset id="fieldset_user_privtable_footer" class="tblFooters"> + <input type="hidden" name="adduser_submit" value="1"> + <input class="btn btn-primary" type="submit" id="adduser_submit" value="{% trans 'Go' %}"> + </fieldset> + </form> +</div> diff --git a/srcs/phpmyadmin/templates/server/replication/master_configuration.twig b/srcs/phpmyadmin/templates/server/replication/master_configuration.twig new file mode 100644 index 0000000..5243bac --- /dev/null +++ b/srcs/phpmyadmin/templates/server/replication/master_configuration.twig @@ -0,0 +1,32 @@ +<fieldset> + <legend>{% trans 'Master configuration' %}</legend> + <p> + {% trans %} + This server is not configured as a master server in a replication process. You can choose from either replicating all databases and ignoring some of them (useful if you want to replicate a majority of the databases) or you can choose to ignore all databases by default and allow only certain databases to be replicated. Please select the mode: + {% endtrans %} + </p> + <select name="db_type" id="db_type"> + <option value="all">{% trans 'Replicate all databases; Ignore:' %}</option> + <option value="ign">{% trans 'Ignore all databases; Replicate:' %}</option> + </select> + <p>{% trans 'Please select databases:' %}</p> + {{ database_multibox|raw }} + <p> + {% trans %} + Now, add the following lines at the end of [mysqld] section in your my.cnf and please restart the MySQL server afterwards. + {% endtrans %} + </p> + <pre id="rep"></pre> + <p> + {% trans %} + Once you restarted MySQL server, please click on Go button. Afterwards, you should see a message informing you, that this server <strong>is</strong> configured as master. + {% endtrans %} + </p> +</fieldset> + +<fieldset class="tblFooters"> + <form method="post" action="server_replication.php"> + {{ get_hidden_inputs('', '') }} + <input id="goButton" class="btn btn-primary" type="submit" value="{% trans 'Go' %}"> + </form> +</fieldset> diff --git a/srcs/phpmyadmin/templates/server/replication/master_replication.twig b/srcs/phpmyadmin/templates/server/replication/master_replication.twig new file mode 100644 index 0000000..8ba5d1b --- /dev/null +++ b/srcs/phpmyadmin/templates/server/replication/master_replication.twig @@ -0,0 +1,52 @@ +{% if not clear_screen %} + <fieldset> + <legend>{% trans 'Master replication' %}</legend> + {% trans 'This server is configured as master in a replication process.' %} + <ul> + <li> + <a href="#master_status_href" id="master_status_href"> + {% trans 'Show master status' %} + </a> + {{ master_status_table|raw }} + </li> + <li> + <p> + <a href="#master_slaves_href" id="master_slaves_href"> + {% trans 'Show connected slaves' %} + </a> + </p> + + <div id="replication_slaves_section" style="display: none;"> + <table class="data"> + <thead> + <tr> + <th>{% trans 'Server ID' %}</th> + <th>{% trans 'Host' %}</th> + </tr> + </thead> + <tbody> + {% for slave in slaves %} + <tr> + <td class="value">{{ slave['Server_id'] }}</td> + <td class="value">{{ slave['Host'] }}</td> + </tr> + {% endfor %} + </tbody> + </table> + <br> + {{ 'Only slaves started with the --report-host=host_name option are visible in this list.'|trans|notice }} + <br> + </div> + </li> + <li> + <a href="server_replication.php" data-post="{{ get_common(url_params, '') }}" id="master_addslaveuser_href"> + {% trans 'Add slave replication user' %} + </a> + </li> +{% endif %} +{% if master_add_user %} + {{ master_add_slave_user|raw }} +{% elseif not clear_screen %} + </ul> + </fieldset> +{% endif %} diff --git a/srcs/phpmyadmin/templates/server/replication/slave_configuration.twig b/srcs/phpmyadmin/templates/server/replication/slave_configuration.twig new file mode 100644 index 0000000..5b12ea7 --- /dev/null +++ b/srcs/phpmyadmin/templates/server/replication/slave_configuration.twig @@ -0,0 +1,109 @@ +<fieldset> + <legend>{% trans 'Slave replication' %}</legend> + {% if server_slave_multi_replication %} + {% trans 'Master connection:' %} + <form method="get" action="server_replication.php"> + {{ get_hidden_inputs(url_params) }} + <select name="master_connection"> + <option value="">{% trans 'Default' %}</option> + {% for server in server_slave_multi_replication %} + <option value="{{ server['Connection_name'] }}"{{ master_connection == server['Connection_name'] ? ' selected' }}> + {{ server['Connection_name'] }} + </option> + {% endfor %} + </select> + <input id="goButton" class="btn btn-primary" type="submit" value="{% trans 'Go' %}"> + </form> + <br> + <br> + {% endif %} + + {% if server_slave_status %} + <div id="slave_configuration_gui"> + {% if not slave_sql_running %} + {{ 'Slave SQL Thread not running!'|trans|error }} + {% endif %} + {% if not slave_io_running %} + {{ 'Slave IO Thread not running!'|trans|error }} + {% endif %} + + <p>{% trans 'Server is configured as slave in a replication process. Would you like to:' %}</p> + <ul> + <li> + <a href="#slave_status_href" id="slave_status_href">{% trans 'See slave status table' %}</a> + {{ slave_status_table|raw }} + </li> + <li> + <a href="#slave_control_href" id="slave_control_href">{% trans 'Control slave:' %}</a> + <div id="slave_control_gui" class="hide"> + <ul> + <li> + <a href="server_replication.php" data-post="{{ slave_control_full_link }}"> + {{ not slave_io_running or not slave_sql_running ? 'Full start' : 'Full stop' }} + </a> + </li> + <li> + <a class="ajax" id="reset_slave" href="server_replication.php" data-post="{{ slave_control_reset_link }}"> + {% trans 'Reset slave' %} + </a> + </li> + <li> + <a href="server_replication.php" data-post="{{ slave_control_sql_link }}"> + {% if not slave_sql_running %} + {% trans 'Start SQL Thread only' %} + {% else %} + {% trans 'Stop SQL Thread only' %} + {% endif %} + </a> + </li> + <li> + <a href="server_replication.php" data-post="{{ slave_control_io_link }}"> + {% if not slave_io_running %} + {% trans 'Start IO Thread only' %} + {% else %} + {% trans 'Stop IO Thread only' %} + {% endif %} + </a> + </li> + </ul> + </div> + </li> + <li> + <a href="#slave_errormanagement_href" id="slave_errormanagement_href"> + {% trans 'Error management:' %} + </a> + <div id="slave_errormanagement_gui" class="hide"> + {{ 'Skipping errors might lead into unsynchronized master and slave!'|trans|error }} + <ul> + <li> + <a href="server_replication.php" data-post="{{ slave_skip_error_link }}"> + {% trans 'Skip current error' %} + </a> + </li> + <li> + <form method="post" action="server_replication.php"> + {{ get_hidden_inputs('', '') }} + {{ 'Skip next %s errors.'|trans|format('<input type="text" name="sr_skip_errors_count" value="1" class="repl_gui_skip_err_cnt">')|raw }} + <input class="btn btn-primary" type="submit" name="sr_slave_skip_error" value="{% trans 'Go' %}"> + <input type="hidden" name="sr_take_action" value="1"> + </form> + </li> + </ul> + </div> + </li> + <li> + <a href="server_replication.php" data-post="{{ reconfigure_master_link }}"> + {% trans 'Change or reconfigure master server' %} + </a> + </li> + </ul> + </div> + {% elseif not has_slave_configure %} + {% apply format('<a href="server_replication.php" data-post="' ~ get_common(url_params|merge({ + 'sl_configure': true, + 'repl_clear_scr': true + })) ~ '">', '</a>')|raw %} + {% trans 'This server is not configured as slave in a replication process. Would you like to %sconfigure%s it?' %} + {% endapply %} + {% endif %} +</fieldset> diff --git a/srcs/phpmyadmin/templates/server/replication/status_table.twig b/srcs/phpmyadmin/templates/server/replication/status_table.twig new file mode 100644 index 0000000..79c45f6 --- /dev/null +++ b/srcs/phpmyadmin/templates/server/replication/status_table.twig @@ -0,0 +1,34 @@ +<div id="replication_{{ type }}_section"{{ is_hidden ? ' style="display: none;"' }}> + {% if has_title %} + <h4> + <a id="replication_{{ type }}"></a> + {% if type == 'master' %} + {% trans 'Master status' %} + {% else %} + {% trans 'Slave status' %} + {% endif %} + </h4> + {% endif %} + + <table id="server{{ type }}replicationsummary" class="data"> + <thead> + <tr> + <th>{% trans 'Variable' %}</th> + <th>{% trans 'Value' %}</th> + </tr> + </thead> + + <tbody> + {% for variable in variables %} + <tr> + <td class="name">{{ variable.name }}</td> + <td class="value"> + <span{% if variable.status == 'attention' %} class="attention"{% elseif variable.status == 'allfine' %} class="allfine"{% endif %}> + {{ variable.value }} + </span> + </td> + </tr> + {% endfor %} + </tbody> + </table> +</div> diff --git a/srcs/phpmyadmin/templates/server/status/advisor/index.twig b/srcs/phpmyadmin/templates/server/status/advisor/index.twig new file mode 100644 index 0000000..b1bc3a9 --- /dev/null +++ b/srcs/phpmyadmin/templates/server/status/advisor/index.twig @@ -0,0 +1,39 @@ +{% extends 'server/status/base.twig' %} +{% set active = 'advisor' %} + +{% block content %} + + {% if data is not empty %} + <a href="#openAdvisorInstructions">{{ get_icon('b_help', 'Instructions'|trans) }}</a> + + <div id="statustabs_advisor"></div> + + <div id="advisorInstructionsDialog" class="hide"> + <p> + {% trans %} + The Advisor system can provide recommendations on server variables by analyzing the server status variables. + {% endtrans %} + </p> + <p> + {% trans %} + Do note however that this system provides recommendations based on simple calculations and by rule of thumb which may not necessarily apply to your system. + {% endtrans %} + </p> + <p> + {% trans %} + Prior to changing any of the configuration, be sure to know what you are changing (by reading the documentation) and how to undo the change. Wrong tuning can have a very negative effect on performance. + {% endtrans %} + </p> + <p> + {% trans %} + The best way to tune your system would be to change only one setting at a time, observe or benchmark your database, and undo the change if there was no clearly measurable improvement. + {% endtrans %} + </p> + </div> + + <div id="advisorData" class="hide">{{ data }}</div> + {% else %} + {{ 'Not enough privilege to view the advisor.'|trans|error }} + {% endif %} + +{% endblock %} diff --git a/srcs/phpmyadmin/templates/server/status/base.twig b/srcs/phpmyadmin/templates/server/status/base.twig new file mode 100644 index 0000000..66547a8 --- /dev/null +++ b/srcs/phpmyadmin/templates/server/status/base.twig @@ -0,0 +1,39 @@ +<div> + <ul id="topmenu2"> + <li> + <a href="server_status.php{{ get_common() }}"{{ active == 'status' ? ' class="tabactive"' }}> + {% trans 'Server' %} + </a> + </li> + <li> + <a href="server_status_processes.php{{ get_common() }}"{{ active == 'processes' ? ' class="tabactive"' }}> + {% trans 'Processes' %} + </a> + </li> + <li> + <a href="server_status_queries.php{{ get_common() }}"{{ active == 'queries' ? ' class="tabactive"' }}> + {% trans 'Query statistics' %} + </a> + </li> + <li> + <a href="server_status_variables.php{{ get_common() }}"{{ active == 'variables' ? ' class="tabactive"' }}> + {% trans 'All status variables' %} + </a> + </li> + <li> + <a href="server_status_monitor.php{{ get_common() }}"{{ active == 'monitor' ? ' class="tabactive"' }}> + {% trans 'Monitor' %} + </a> + </li> + <li> + <a href="server_status_advisor.php{{ get_common() }}"{{ active == 'advisor' ? ' class="tabactive"' }}> + {% trans 'Advisor' %} + </a> + </li> + </ul> + <div class="clearfloat"></div> + + <div> + {% block content %}{% endblock %} + </div> +</div> diff --git a/srcs/phpmyadmin/templates/server/status/monitor/index.twig b/srcs/phpmyadmin/templates/server/status/monitor/index.twig new file mode 100644 index 0000000..c4c7277 --- /dev/null +++ b/srcs/phpmyadmin/templates/server/status/monitor/index.twig @@ -0,0 +1,268 @@ +{% extends 'server/status/base.twig' %} +{% set active = 'monitor' %} +{% block content %} + +<div class="tabLinks"> + <a href="#pauseCharts"> + {{ get_image('play') }} + {% trans 'Start Monitor' %} + </a> + <a href="#settingsPopup" class="popupLink"> + {{ get_image('s_cog') }} + {% trans 'Settings' %} + </a> + <a href="#monitorInstructionsDialog"> + {{ get_image('b_help') }} + {% trans 'Instructions/Setup' %} + </a> + <a href="#endChartEditMode" class="hide"> + {{ get_image('s_okay') }} + {% trans 'Done dragging (rearranging) charts' %} + </a> +</div> + +<div class="popupContent settingsPopup"> + <a href="#addNewChart"> + {{ get_image('b_chart') }} + {% trans 'Add chart' %} + </a> + <a href="#rearrangeCharts"> + {{ get_image('b_tblops') }} + {% trans 'Enable charts dragging' %} + </a> + <div class="clearfloat paddingtop"></div> + + <div class="floatleft"> + {% trans 'Refresh rate' %} + <br> + <select id="id_gridChartRefresh" class="refreshRate" name="gridChartRefresh"> + {% for rate in [2, 3, 4, 5, 10, 20, 40, 60, 120, 300, 600, 1200] %} + <option value="{{ rate }}"{{ rate == 5 ? ' selected' }}> + {% if rate < 60 %} + {% if rate == 1 %} + {{ '%d second'|trans|format(rate) }} + {% else %} + {{ '%d seconds'|trans|format(rate) }} + {% endif %} + {% else %} + {% if rate / 60 == 1 %} + {{ '%d minute'|trans|format(rate / 60) }} + {% else %} + {{ '%d minutes'|trans|format(rate / 60) }} + {% endif %} + {% endif %} + </option> + {% endfor %} + </select> + <br> + </div> + + <div class="floatleft"> + {% trans 'Chart columns' %} + <br> + <select name="chartColumns"> + <option>1</option> + <option>2</option> + <option>3</option> + <option>4</option> + <option>5</option> + <option>6</option> + </select> + </div> + + <div class="clearfloat paddingtop"> + <strong>{% trans 'Chart arrangement' %}</strong> + {{ show_hint('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.'|trans) }} + <br> + <a class="ajax" href="#importMonitorConfig"> + {% trans 'Import' %} + </a> - + <a class="disableAjax" href="#exportMonitorConfig"> + {% trans 'Export' %} + </a> - + <a href="#clearMonitorConfig"> + {% trans 'Reset to default' %} + </a> + </div> +</div> + +<div id="monitorInstructionsDialog" title="{% trans 'Monitor Instructions' %}" class="hide"> + <p> + {% trans %} + The phpMyAdmin Monitor can assist you in optimizing the server configuration and track down time intensive queries. For the latter you will need to set log_output to 'TABLE' and have either the slow_query_log or general_log enabled. Note however, that the general_log produces a lot of data and increases server load by up to 15%. + {% endtrans %} + </p> + <img class="ajaxIcon" src="{{ image_path }}ajax_clock_small.gif" alt="{% trans 'Loading…' %}"> + + <div class="ajaxContent"></div> + <br> + + <div class="monitorUse hide"> + <p><strong>{% trans 'Using the monitor:' %}</strong></p> + <p> + {% trans %} + Your browser will refresh all displayed charts in a regular interval. You may add charts and change the refresh rate under 'Settings', or remove any chart using the cog icon on each respective chart. + {% endtrans %} + </p> + <p> + {% trans %} + To display queries from the logs, select the relevant time span on any chart by holding down the left mouse button and panning over the chart. Once confirmed, this will load a table of grouped queries, there you may click on any occurring SELECT statements to further analyze them. + {% endtrans %} + </p> + <p> + {{ get_image('s_attention') }} + <strong>{% trans 'Please note:' %}</strong> + </p> + <p> + {% trans %} + Enabling the general_log may increase the server load by 5-15%. Also be aware that generating statistics from the logs is a load intensive task, so it is advisable to select only a small time span and to disable the general_log and empty its table once monitoring is not required any more. + {% endtrans %} + </p> + </div> +</div> + +<div id="addChartDialog" title="{% trans 'Add chart' %}" class="hide"> + <div id="tabGridVariables"> + <p> + <input type="text" name="chartTitle" value="{% trans 'Chart Title' %}"> + </p> + <input type="radio" name="chartType" value="preset" id="chartPreset"> + + <label for="chartPreset">{% trans 'Preset chart' %}</label> + <select name="presetCharts"></select> + <br> + + <input type="radio" name="chartType" value="variable" id="chartStatusVar" checked="checked"> + <label for="chartStatusVar"> + {% trans 'Status variable(s)' %} + </label> + <br> + + <div id="chartVariableSettings"> + <label for="chartSeries">{% trans 'Select series:' %}</label> + <br> + <select id="chartSeries" name="varChartList" size="1"> + <option>{% trans 'Commonly monitored' %}</option> + <option>Processes</option> + <option>Questions</option> + <option>Connections</option> + <option>Bytes_sent</option> + <option>Bytes_received</option> + <option>Threads_connected</option> + <option>Created_tmp_disk_tables</option> + <option>Handler_read_first</option> + <option>Innodb_buffer_pool_wait_free</option> + <option>Key_reads</option> + <option>Open_tables</option> + <option>Select_full_join</option> + <option>Slow_queries</option> + </select> + <br> + + <label for="variableInput"> + {% trans 'or type variable name:' %} + </label> + <input type="text" name="variableInput" id="variableInput"> + <br> + + <input type="checkbox" name="differentialValue" id="differentialValue" value="differential" checked="checked"> + <label for="differentialValue"> + {% trans 'Display as differential value' %} + </label> + <br> + + <input type="checkbox" id="useDivisor" name="useDivisor" value="1"> + <label for="useDivisor">{% trans 'Apply a divisor' %}</label> + + <span class="divisorInput hide"> + <input type="text" name="valueDivisor" size="4" value="1"> + (<a href="#kibDivisor">{% trans 'KiB' %}</a>, + <a href="#mibDivisor">{% trans 'MiB' %}</a>) + </span> + <br> + + <input type="checkbox" id="useUnit" name="useUnit" value="1"> + <label for="useUnit"> + {% trans 'Append unit to data values' %} + </label> + <span class="unitInput hide"> + <input type="text" name="valueUnit" size="4" value=""> + </span> + + <p> + <a href="#submitAddSeries"> + <strong>{% trans 'Add this series' %}</strong> + </a> + <span id="clearSeriesLink" class="hide"> + | <a href="#submitClearSeries">{% trans 'Clear series' %}</a> + </span> + </p> + + {% trans 'Series in chart:' %} + <br> + <span id="seriesPreview"> + <em>{% trans 'None' %}</em> + </span> + </div> + </div> +</div> + +<div id="logAnalyseDialog" title="{% trans 'Log statistics' %}" class="hide"> + <p> + {% trans 'Selected time range:' %} + <input type="text" name="dateStart" class="datetimefield" value=""> + - + <input type="text" name="dateEnd" class="datetimefield" value=""> + </p> + + <input type="checkbox" id="limitTypes" value="1" checked="checked"> + <label for="limitTypes"> + {% trans 'Only retrieve SELECT,INSERT,UPDATE and DELETE Statements' %} + </label> + <br> + + <input type="checkbox" id="removeVariables" value="1" checked="checked"> + <label for="removeVariables"> + {% trans 'Remove variable data in INSERT statements for better grouping' %} + </label> + + <p> + {% trans 'Choose from which log you want the statistics to be generated from.' %} + </p> + <p> + {% trans 'Results are grouped by query text.' %} + </p> +</div> + +<div id="queryAnalyzerDialog" title="{% trans 'Query analyzer' %}" class="hide"> + <textarea id="sqlquery"></textarea> + <br> + <div class="placeHolder"></div> +</div> + +<table class="clearfloat tdblock" id="chartGrid"></table> +<div id="logTable"><br></div> + +<script type="text/javascript"> + var variableNames = [ + {% for variable_name in javascript_variable_names %} + "{{ variable_name|e('js') }}", + {% endfor %} + ]; +</script> + +<form id="js_data" class="hide"> + {% for name, value in form %} + <input type="hidden" name="{{ name }}" value="{{ value }}"> + {% endfor %} +</form> + +<div id="profiling_docu" class="hide"> + {{ show_mysql_docu('general-thread-states') }} +</div> + +<div id="explain_docu" class="hide"> + {{ show_mysql_docu('explain-output') }} +</div> + +{% endblock %} diff --git a/srcs/phpmyadmin/templates/server/status/processes/index.twig b/srcs/phpmyadmin/templates/server/status/processes/index.twig new file mode 100644 index 0000000..bb73156 --- /dev/null +++ b/srcs/phpmyadmin/templates/server/status/processes/index.twig @@ -0,0 +1,53 @@ +{% extends 'server/status/base.twig' %} +{% set active = 'processes' %} +{% block content %} + +<fieldset id="tableFilter"> + <legend>{% trans 'Filters' %}</legend> + <form action="server_status_processes.php" method="post"> + {{ get_hidden_inputs(url_params) }} + <input class="btn btn-secondary" type="submit" value="{% trans 'Refresh' %}"> + <div class="formelement"> + <input type="checkbox" name="showExecuting" id="showExecuting" class="autosubmit"{{ is_checked ? ' checked' }}> + <label for="showExecuting"> + {% trans 'Show only active' %} + </label> + </div> + </form> +</fieldset> + +{{ server_process_list|raw }} + +{{ 'Note: Enabling the auto refresh here might cause heavy traffic between the web server and the MySQL server.'|trans|notice }} + +<div class="tabLinks"> + <label> + {% trans 'Refresh rate' %}: + + <select id="id_refreshRate" class="refreshRate" name="refreshRate"> + {% for rate in [2, 3, 4, 5, 10, 20, 40, 60, 120, 300, 600, 1200] %} + <option value="{{ rate }}"{{ rate == 5 ? ' selected' }}> + {% if rate < 60 %} + {% if rate == 1 %} + {{ '%d second'|trans|format(rate) }} + {% else %} + {{ '%d seconds'|trans|format(rate) }} + {% endif %} + {% else %} + {% if rate / 60 == 1 %} + {{ '%d minute'|trans|format(rate / 60) }} + {% else %} + {{ '%d minutes'|trans|format(rate / 60) }} + {% endif %} + {% endif %} + </option> + {% endfor %} + </select> + </label> + <a id="toggleRefresh" href="#"> + {{ get_image('play') }} + {% trans 'Start auto refresh' %} + </a> +</div> + +{% endblock %} diff --git a/srcs/phpmyadmin/templates/server/status/processes/list.twig b/srcs/phpmyadmin/templates/server/status/processes/list.twig new file mode 100644 index 0000000..83561f9 --- /dev/null +++ b/srcs/phpmyadmin/templates/server/status/processes/list.twig @@ -0,0 +1,65 @@ +<div class="responsivetable"> + <table id="tableprocesslist" class="data clearfloat noclick sortable"> + <thead> + <tr> + <th>{% trans 'Processes' %}</th> + {% for column in columns %} + <th> + <a href="server_status_processes.php" data-post="{{ get_common(column.params) }}" class="sortlink"> + {{ column.name }} + {% if column.is_sorted %} + <img class="icon ic_s_desc soimg" alt=" + {%- trans 'Descending' %}" src="themes/dot.gif" style="display: {{ column.sort_order == 'DESC' ? 'none' : 'inline' }}"> + <img class="icon ic_s_asc soimg hide" alt=" + {%- trans 'Ascending' %}" src="themes/dot.gif" style="display: {{ column.sort_order == 'DESC' ? 'inline' : 'none' }}"> + {% endif %} + </a> + {% if column.has_full_query %} + <a href="server_status_processes.php" data-post="{{ get_common(refresh_params, '') }}"> + {% if column.is_full %} + {{ get_image( + 's_partialtext', + 'Truncate shown queries'|trans, + {'class': 'icon_fulltext'} + ) }} + {% else %} + {{ get_image( + 's_fulltext', + 'Show full queries'|trans, + {'class': 'icon_fulltext'} + ) }} + {% endif %} + </a> + {% endif %} + </th> + {% endfor %} + </tr> + </thead> + + <tbody> + {% for row in rows %} + <tr> + <td> + <a class="ajax kill_process" href="server_status_processes.php" data-post="{{ get_common({'kill': row.id}, '') }}"> + {% trans 'Kill' %} + </a> + </td> + <td class="value">{{ row.id }}</td> + <td>{{ row.user }}</td> + <td>{{ row.host }}</td> + <td> + {% if row.db != '' %} + {{ row.db }} + {% else %} + <em>{% trans 'None' %}</em> + {% endif %} + </td> + <td>{{ row.command }}</td> + <td class="value">{{ row.time }}</td> + <td>{{ row.state }}</td> + <td>{{ row.progress }}</td> + <td>{{ row.info|raw }}</td> + {% endfor %} + </tbody> + </table> +</div> diff --git a/srcs/phpmyadmin/templates/server/status/queries/index.twig b/srcs/phpmyadmin/templates/server/status/queries/index.twig new file mode 100644 index 0000000..be743b9 --- /dev/null +++ b/srcs/phpmyadmin/templates/server/status/queries/index.twig @@ -0,0 +1,56 @@ +{% extends 'server/status/base.twig' %} +{% set active = 'queries' %} +{% block content %} + +{% if is_data_loaded %} + <h3 id="serverstatusqueries"> + {% trans %} + Questions since startup: + {% notes %} + Questions is the name of a MySQL Status variable + {% endtrans %} + {{ format_number(stats.total, 0) }} + {{ show_mysql_docu('server-status-variables', false, null, null, 'statvar_Questions') }} + </h3> + + <ul> + <li>ø {% trans 'per hour:' %} {{ format_number(stats.per_hour, 0) }}</li> + <li>ø {% trans 'per minute:' %} {{ format_number(stats.per_minute, 0) }}</li> + {% if stats.per_second >= 1 %} + <li>ø {% trans 'per second:' %} {{ format_number(stats.per_second, 0) }}</li> + {% endif %} + </ul> + + <table id="serverstatusqueriesdetails" class="width100 data sortable noclick"> + <colgroup> + <col class="namecol"> + <col class="valuecol" span="3"> + </colgroup> + + <thead> + <tr> + <th>{% trans 'Statements' %}</th> + <th>{% trans %}#{% notes %}# = Amount of queries{% endtrans %}</th> + <th>ø {% trans 'per hour' %}</th> + <th>%</th> + </tr> + </thead> + + <tbody> + {% for query in queries %} + <tr> + <th class="name">{{ query.name }}</th> + <td class="value">{{ format_number(query.value, 5, 0, true) }}</td> + <td class="value">{{ format_number(query.per_hour, 4, 1, true) }}</td> + <td class="value">{{ format_number(query.percentage, 0, 2) }}</td> + </tr> + {% endfor %} + </tbody> + </table> + + <div id="serverstatusquerieschart" class="width100" data-chart="{{ chart|json_encode }}"></div> +{% else %} + {{ 'Not enough privilege to view query statistics.'|trans|error }} +{% endif %} + +{% endblock %} diff --git a/srcs/phpmyadmin/templates/server/status/status/index.twig b/srcs/phpmyadmin/templates/server/status/status/index.twig new file mode 100644 index 0000000..53fd63f --- /dev/null +++ b/srcs/phpmyadmin/templates/server/status/status/index.twig @@ -0,0 +1,78 @@ +{% extends 'server/status/base.twig' %} +{% set active = 'status' %} +{% block content %} + +{% if is_data_loaded %} + <h3>{{ 'Network traffic since startup: %s'|trans|format(network_traffic) }}</h3> + <p>{{ 'This MySQL server has been running for %1$s. It started up on %2$s.'|trans|format(uptime, start_time) }}</p> + + <table id="serverstatustraffic" class="width100 data noclick"> + <thead> + <tr> + <th> + {% trans 'Traffic' %} + {{ show_hint('On a busy server, the byte counters may overrun, so those statistics as reported by the MySQL server may be incorrect.'|trans) }} + </th> + <th>#</th> + <th>ø {% trans 'per hour' %}</th> + </tr> + </thead> + + <tbody> + {% for each_traffic in traffic %} + <tr> + <th class="name">{{ each_traffic.name }}</th> + <td class="value">{{ each_traffic.number }}</td> + <td class="value">{{ each_traffic.per_hour }}</td> + </tr> + {% endfor %} + </tbody> + </table> + + <table id="serverstatusconnections" class="width100 data noclick"> + <thead> + <tr> + <th>{% trans 'Connections' %}</th> + <th>#</th> + <th>ø {% trans 'per hour' %}</th> + <th>%</th> + </tr> + </thead> + + <tbody> + {% for connection in connections %} + <tr> + <th class="name">{{ connection.name }}</th> + <td class="value">{{ connection.number }}</td> + <td class="value">{{ connection.per_hour }}</td> + <td class="value">{{ connection.percentage }}</td> + </tr> + {% endfor %} + </tbody> + </table> + + {% if is_master or is_slave %} + <p class="notice clearfloat"> + {% if is_master and is_slave %} + {% trans 'This MySQL server works as <b>master</b> and <b>slave</b> in <b>replication</b> process.' %} + {% elseif is_master %} + {% trans 'This MySQL server works as <b>master</b> in <b>replication</b> process.' %} + {% elseif is_slave %} + {% trans 'This MySQL server works as <b>slave</b> in <b>replication</b> process.' %} + {% endif %} + </p> + + <hr class="clearfloat"> + + <h3> + <a name="replication">{% trans 'Replication status' %}</a> + </h3> + + {{ replication|raw }} + {% endif %} + +{% else %} + {{ 'Not enough privilege to view server status.'|trans|error }} +{% endif %} + +{% endblock %} diff --git a/srcs/phpmyadmin/templates/server/status/variables/index.twig b/srcs/phpmyadmin/templates/server/status/variables/index.twig new file mode 100644 index 0000000..a5f8724 --- /dev/null +++ b/srcs/phpmyadmin/templates/server/status/variables/index.twig @@ -0,0 +1,137 @@ +{% extends 'server/status/base.twig' %} +{% set active = 'variables' %} +{% block content %} + +{% if is_data_loaded %} + <fieldset id="tableFilter"> + <legend>{% trans 'Filters' %}</legend> + <form action="server_status_variables.php" method="post"> + {{ get_hidden_inputs() }} + + <input class="btn btn-secondary" type="submit" value="{% trans 'Refresh' %}"> + + <div class="formelement"> + <label for="filterText">{% trans 'Containing the word:' %}</label> + <input name="filterText" type="text" id="filterText" value="{{ filter_text }}"> + </div> + + <div class="formelement"> + <input type="checkbox" name="filterAlert" id="filterAlert"{{ is_only_alerts ? ' checked' }}> + <label for="filterAlert"> + {% trans 'Show only alert values' %} + </label> + </div> + + <div class="formelement"> + <select id="filterCategory" name="filterCategory"> + <option value="">{% trans 'Filter by category…' %}</option> + {% for category in categories %} + <option value="{{ category.id }}"{{ category.is_selected ? ' selected' }}>{{ category.name }}</option> + {% endfor %} + </select> + </div> + + <div class="formelement"> + <input type="checkbox" name="dontFormat" id="dontFormat"{{ is_not_formatted ? ' checked' }}> + <label for="dontFormat"> + {% trans 'Show unformatted values' %} + </label> + </div> + </form> + </fieldset> + + <div id="linkSuggestions" class="defaultLinks hide"> + <p class="notice"> + {% trans 'Related links:' %} + {% for link in links %} + <span class="{{ link.name }}"> + {% for link_name, link_url in link.links %} + {% if link_name == 'doc' %} + {{ show_mysql_docu(link_url) }} + {% else %} + <a href="{{ link_url.url }}" data-post="{{ link_url.params }}">{{ link_name }}</a> + {% endif %} + | + {% endfor %} + </span> + {% endfor %} + </p> + </div> + + <div class="responsivetable"> + <table class="data noclick" id="serverstatusvariables"> + <colgroup> + <col class="namecol"> + <col class="valuecol"> + <col class="descrcol"> + </colgroup> + <thead> + <tr> + <th>{% trans 'Variable' %}</th> + <th>{% trans 'Value' %}</th> + <th>{% trans 'Description' %}</th> + </tr> + </thead> + <tbody> + {% for variable in variables %} + <tr{% if variable.class is not empty %} class="s_{{ variable.class }}"{% endif %}> + <th class="name"> + {{ variable.name|replace({'_': ' '}) }} + {{ variable.doc|raw }} + </th> + + <td class="value"> + <span class="formatted"> + {% if variable.has_alert %} + <span class="{{ variable.is_alert ? 'attention' : 'allfine' }}"> + {% endif %} + + {% if variable.name ends with '%' %} + {{ format_number(variable.value, 0, 2) }} % + {% elseif 'Uptime' in variable.name %} + {{ timespan_format(variable.value) }} + {% elseif variable.is_numeric and variable.value >= 1000 %} + <abbr title="{{ format_number(variable.value, 0) }}"> + {{ format_number(variable.value, 3, 1) }} + </abbr> + {% elseif variable.is_numeric %} + {{ format_number(variable.value, 3, 1) }} + {% else %} + {{ variable.value }} + {% endif %} + + {% if variable.has_alert %} + </span> + {% endif %} + </span> + <span class="original hide"> + {% if variable.has_alert %} + <span class="{{ variable.is_alert ? 'attention' : 'allfine' }}"> + {% endif %} + {{ variable.value }} + {% if variable.has_alert %} + </span> + {% endif %} + </span> + </td> + + <td class="descr"> + {{ variable.description }} + {% for doc in variable.description_doc %} + {% if doc.name == 'doc' %} + {{ show_mysql_docu(doc.url) }} + {% else %} + <a href="{{ doc.url.url }}" data-post="{{ doc.url.params }}">{{ doc.name }}</a> + {% endif %} + {% endfor %} + </td> + </tr> + {% endfor %} + </tbody> + </table> + </div> +{% else %} + {{ 'Not enough privilege to view status variables.'|trans|error }} +{% endif %} + +{% endblock %} diff --git a/srcs/phpmyadmin/templates/server/sub_page_header.twig b/srcs/phpmyadmin/templates/server/sub_page_header.twig new file mode 100644 index 0000000..d1c521c --- /dev/null +++ b/srcs/phpmyadmin/templates/server/sub_page_header.twig @@ -0,0 +1,16 @@ +{# array contains Sub page icon and text #} +{% set header = { + 'privileges': { + 'image': 'b_usrlist', + 'text': 'Privileges'|trans + } +} %} +<h2> + {% if is_image|default(true) %} + {{ get_image(header[type]['image']) }} + {% else %} + {{ get_icon(header[type]['image']) }} + {% endif %} + {{ header[type]['text'] }} + {{ link is defined ? show_mysql_docu(link) }} +</h2> diff --git a/srcs/phpmyadmin/templates/server/variables/index.twig b/srcs/phpmyadmin/templates/server/variables/index.twig new file mode 100644 index 0000000..75020cb --- /dev/null +++ b/srcs/phpmyadmin/templates/server/variables/index.twig @@ -0,0 +1,78 @@ +<h2> + {{ get_image('s_vars') }} + {% trans 'Server variables and settings' %} + {{ show_mysql_docu('server_system_variables') }} +</h2> + +{% if variables is not empty %} + <a href="server_variables.php{{ get_common() }}" class="ajax saveLink hide"> + {{ get_icon('b_save', 'Save'|trans) }} + </a> + <a href="#" class="cancelLink hide"> + {{ get_icon('b_close', 'Cancel'|trans) }} + </a> + {{ get_image('b_help', 'Documentation'|trans, { + 'class': 'hide', + 'id': 'docImage' + }) }} + + {% include 'filter.twig' with { + 'filter_value': filter_value + } only %} + + <div class="responsivetable"> + <table id="serverVariables" class="width100 data filteredData noclick"> + <thead> + <tr class="var-header var-row"> + <td class="var-action">{% trans 'Action' %}</td> + <td class="var-name">{% trans 'Variable' %}</td> + <td class="var-value">{% trans 'Value' %}</td> + </tr> + </thead> + + <tbody> + {% for variable in variables %} + <tr class="var-row{{ variable.has_session_value ? ' diffSession' }}" data-filter-row="{{ variable.name|upper }}"> + <td class="var-action"> + {% if variable.is_editable %} + <a href="#" data-variable="{{ variable.name }}" class="editLink">{{ get_icon('b_edit', 'Edit'|trans) }}</a> + {% else %} + <span title="{% trans 'This is a read-only variable and can not be edited' %}" class="read_only_var"> + {{ get_icon('bd_edit', 'Edit'|trans) }} + </span> + {% endif %} + </td> + <td class="var-name"> + {% if variable.doc_link != null %} + <span title="{{ variable.name|replace({'_': ' '}) }}"> + {{ variable.doc_link|raw }} + </span> + {% else %} + {{ variable.name|replace({'_': ' '}) }} + {% endif %} + </td> + <td class="var-value value{{ is_superuser ? ' editable' }}"> + {% if variable.is_escaped %} + {{ variable.value|raw }} + {% else %} + {{ variable.value|e|replace({',': ',​'})|raw }} + {% endif %} + </td> + </tr> + + {% if variable.has_session_value %} + <tr class="var-row diffSession" data-filter-row="{{ variable.name|upper }}"> + <td class="var-action"></td> + <td class="var-name session">({% trans 'Session value' %})</td> + <td class="var-value value">{{ variable.session_value }}</td> + </tr> + {% endif %} + {% endfor %} + </tbody> + </table> + </div> +{% else %} + {{ 'Not enough privilege to view server variables and settings. %s'|trans|format( + link_to_var_documentation('show_compatibility_56', is_mariadb) + )|error }} +{% endif %} |
