Overview
Comment:Fix bug appel simplediff avec namespaces + espaces insécables dans les nombres
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 1823585df4a899f5a79d3ce6db45e1f113742822
User & Date: bohwaz on 2013-09-13 16:25:22
Other Links: manifest | tags
References
2020-12-08
23:25 Wiki page "Changelog/0.9" artifact: b9c916b4d1 user: bohwaz
Context
2013-09-14
15:46
faute d'orthographe check-in: 638f5849d5 user: bohwaz tags: trunk
2013-09-13
16:25
Fix bug appel simplediff avec namespaces + espaces insécables dans les nombres check-in: 1823585df4 user: bohwaz tags: trunk
2013-09-10
11:35
Le graphique des dépenses et recettes était inversé + Fix bug dans la gestion du cache statique check-in: 583fa92c76 user: bohwaz tags: trunk
Changes

Modified src/include/lib.template.php from [adf522bd76] to [061878cf78].

237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
        throw new Template_Exception('Paramètres old et new requis.');
    }

    $old = $params['old'];
    $new = $params['new'];

    require_once GARRADIN_ROOT . '/include/libs/diff/class.simplediff.php';
    $diff = simpleDiff::diff_to_array(false, $old, $new, 3);

    $out = '<table class="diff">';
    $prev = key($diff);

    foreach ($diff as $i=>$line)
    {
        if ($i > $prev + 1)
        {
            $out .= '<tr><td colspan="5" class="separator"><hr /></td></tr>';
        }

        list($type, $old, $new) = $line;

        $class1 = $class2 = '';
        $t1 = $t2 = '';

        if ($type == simpleDiff::INS)
        {
            $class2 = 'ins';
            $t2 = '<b>+</b>';
            $old = htmlspecialchars($old, ENT_QUOTES, 'UTF-8');
            $new = htmlspecialchars($new, ENT_QUOTES, 'UTF-8');
        }
        elseif ($type == simpleDiff::DEL)
        {
            $class1 = 'del';
            $t1 = '<b>-</b>';
            $old = htmlspecialchars($old, ENT_QUOTES, 'UTF-8');
            $new = htmlspecialchars($new, ENT_QUOTES, 'UTF-8');
        }
        elseif ($type == simpleDiff::CHANGED)
        {
            $class1 = 'del';
            $class2 = 'ins';
            $t1 = '<b>-</b>';
            $t2 = '<b>+</b>';

            $lineDiff = simpleDiff::wdiff($old, $new);
            $lineDiff = htmlspecialchars($lineDiff, ENT_QUOTES, 'UTF-8');

            // Don't show new things in deleted line
            $old = preg_replace('!\{\+(?:.*)\+\}!U', '', $lineDiff);
            $old = str_replace('  ', ' ', $old);
            $old = str_replace('-] [-', ' ', $old);
            $old = preg_replace('!\[-(.*)-\]!U', '<del>\\1</del>', $old);







|
















|






|






|






|







237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
        throw new Template_Exception('Paramètres old et new requis.');
    }

    $old = $params['old'];
    $new = $params['new'];

    require_once GARRADIN_ROOT . '/include/libs/diff/class.simplediff.php';
    $diff = \simpleDiff::diff_to_array(false, $old, $new, 3);

    $out = '<table class="diff">';
    $prev = key($diff);

    foreach ($diff as $i=>$line)
    {
        if ($i > $prev + 1)
        {
            $out .= '<tr><td colspan="5" class="separator"><hr /></td></tr>';
        }

        list($type, $old, $new) = $line;

        $class1 = $class2 = '';
        $t1 = $t2 = '';

        if ($type == \simpleDiff::INS)
        {
            $class2 = 'ins';
            $t2 = '<b>+</b>';
            $old = htmlspecialchars($old, ENT_QUOTES, 'UTF-8');
            $new = htmlspecialchars($new, ENT_QUOTES, 'UTF-8');
        }
        elseif ($type == \simpleDiff::DEL)
        {
            $class1 = 'del';
            $t1 = '<b>-</b>';
            $old = htmlspecialchars($old, ENT_QUOTES, 'UTF-8');
            $new = htmlspecialchars($new, ENT_QUOTES, 'UTF-8');
        }
        elseif ($type == \simpleDiff::CHANGED)
        {
            $class1 = 'del';
            $class2 = 'ins';
            $t1 = '<b>-</b>';
            $t2 = '<b>+</b>';

            $lineDiff = \simpleDiff::wdiff($old, $new);
            $lineDiff = htmlspecialchars($lineDiff, ENT_QUOTES, 'UTF-8');

            // Don't show new things in deleted line
            $old = preg_replace('!\{\+(?:.*)\+\}!U', '', $lineDiff);
            $old = str_replace('  ', ' ', $old);
            $old = str_replace('-] [-', ' ', $old);
            $old = preg_replace('!\[-(.*)-\]!U', '<del>\\1</del>', $old);
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
    $out .= '</select>';

    return $out;
}

function escape_money($number)
{
    return number_format((float)$number, 2, ',', ' ');
}

function tpl_html_champ_membre($params)
{
    if (empty($params['config']) || empty($params['name']))
        throw new \BadFunctionCallException('Paramètres type et name obligatoires.');








|







354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
    $out .= '</select>';

    return $out;
}

function escape_money($number)
{
    return number_format((float)$number, 2, ',', '&nbsp;');
}

function tpl_html_champ_membre($params)
{
    if (empty($params['config']) || empty($params['name']))
        throw new \BadFunctionCallException('Paramètres type et name obligatoires.');