Permalink
Browse files

Remove md5 twig extension

Adapt templates to remove md5 from PhpFuncionsExtension.php

Signed-off-by: Leonardo Strozzi <laps15@inf.ufpr.br>
  • Loading branch information...
laps15 committed May 22, 2018
1 parent 83f4336 commit 927fed774ca50ae047a49e265ef280eeb3abfd57
@@ -659,6 +659,8 @@ protected function displayTableList()
Template::get('database/structure/structure_table_row')
->render(
array(
'table_name_hash' => md5($current_table['TABLE_NAME']),
'db_table_name_hash' => md5($this->db . '.' . $current_table['TABLE_NAME']),
'db' => $this->db,
'curr' => $i,
'input_class' => implode(' ', $input_class),
@@ -189,6 +189,7 @@ public function indexAction()
|| ! empty($column['Key'])
) {
$column_array[$column['Field']] = $column['Field'];
$column_array[$column['Field'] . '_hash'] = md5($column['Field']);
}
}
if ($GLOBALS['cfg']['NaturalOrder']) {
@@ -371,11 +371,18 @@ public function zoomSubmitAction($dataLabel, $goto)
__('Browse foreign values')
)
);
$column_names_hashes = [];
foreach ($this->_columnNames as $columnName) {
$column_names_hashes[$columnName] = md5($columnName);
}
$this->response->addHTML(
Template::get('table/search/zoom_result_form')->render([
'db' => $this->db,
'table' => $this->table,
'column_names' => $this->_columnNames,
'column_names_hashes' => $column_names_hashes,
'foreigners' => $this->_foreigners,
'column_null_flags' => $this->_columnNullFlags,
'column_types' => $this->_columnTypes,
@@ -30,7 +30,6 @@ public function getFunctions()
new TwigFunction('array_search', 'array_search'),
new TwigFunction('bin2hex', 'bin2hex'),
new TwigFunction('htmlentities', 'htmlentities'),
new TwigFunction('md5', 'md5'),
new TwigFunction('preg_quote', 'preg_quote'),
new TwigFunction('preg_replace', 'preg_replace'),
new TwigFunction('strpos', 'strpos'),
@@ -28,8 +28,8 @@
((already_favorite ? 'remove' : 'add') ~ '_favorite'): true
} %}
{% include 'database/structure/favorite_anchor.twig' with {
'table_name_hash': md5(current_table['TABLE_NAME']),
'db_table_name_hash': md5(db ~ '.' ~ current_table['TABLE_NAME']),
'table_name_hash': table_name_hash,
'db_table_name_hash': db_table_name_hash,
'fav_params': fav_params,
'already_favorite': already_favorite,
'titles': titles
@@ -184,28 +184,6 @@
{% endif %}
{% else %}
{% set count = 0 %}
{% if properties_num_columns %}
{% set count = count + 2 %}
{% endif %}
{% if is_show_stats %}
{% set count = count + 2 %}
{% endif %}
{% if show_charset %}
{% set count = count + 1 %}
{% endif %}
{% if show_comment %}
{% set count = count + 1 %}
{% endif %}
{% if show_creation %}
{% set count = count + 1 %}
{% endif %}
{% if show_last_update %}
{% set count = count + 1 %}
{% endif %}
{% if show_last_check %}
{% set count = count + 1 %}
{% endif %}
{% if db_is_system_schema %}
{% set action_colspan = 3 %}
@@ -117,7 +117,7 @@
{% set myfield = save_row[i]['Field'] %}
{# Use an md5 as array index to avoid having special characters
in the name attribute (see bug #1746964 ) #}
{% set myfield_md5 = md5(myfield) %}
{% set myfield_md5 = column_array[myfield ~ '_hash'] %}
{% set foreign_table = false %}
{% set foreign_column = false %}
@@ -65,7 +65,7 @@
'in_zoom_search_edit': true,
'foreigners': foreigners,
'column_name': field_popup,
'column_name_hash': md5(field_popup),
'column_name_hash': column_name_hashes[field_popup],
'foreign_data': foreign_data,
'table': table,
'column_index': column_index,

0 comments on commit 927fed7

Please sign in to comment.