Version: 1.00, by tdev1
Developer Last Online: Apr 2016
Category: Administrative and Maintenance Tools -
Version: 4.2.0
Rating:
Released: 03-09-2013
Last Update: Never
Installs: 5
Re-useable Code Code Changes Translations
No support by the author.
This little php code will show the difference of your template to the default one: it can help you maintaining the modifications you did to the templates
How to install:
a) make a backup of the file admincp/template.php:
I know this is older but I have adapted it to vB3 but the differences aren't displaying, I have gone through the diff files and I'm not catching what needs to be changed, I have tried replacing all &$ with $ I didn't see any splits to explode, and my logs aren't reporting any error
I know the author has not been on in years, but I was just hoping someone would be able to help me with this. Running vb3.8.11 on php 5.4.60 (i believe)
below are the edits I made to work with vb3, and the files required for this edit.
PHP Code:
$masterstyleid = '-1'; //vb4 defines this as -1 or -2 (default or mobile) /vb3 master is -1 $templateo = $db->query_first(" SELECT templateid, styleid, title, template_un FROM " . TABLE_PREFIX . "template WHERE styleid IN ($masterstyleid,0) AND title = '" . $db->escape_string($template['title']) . "' "); $texto = $templateo['template_un']; if(trim($texto) != '') { print_textarea_row('<span style="color:green;font-weight:bold;">Default '.$vbphrase['template'].'</span>', 'templateo', $texto, 22, '75" style="width:99%', true, false, 'ltr', 'code'); @include_once 'Text/Diff.php'; @include_once 'Text/Diff/Renderer/inline.php'; if(class_exists('Text_Diff') && class_exists('Text_Diff_Renderer_inline')) { $diff = new Text_Diff('auto', array(explode("\n", $texto), explode("\n", $text))); $renderer = new Text_Diff_Renderer_inline(array('ins_prefix' => '<span style="color:green;font-weight:bold;">','ins_suffix' => '</span>','del_prefix' => '<span style="color:red;font-weight:bold;">','del_suffix' => '</span>')); $fdiff = $renderer->render($diff); print_label_row('<span style="color:orange;font-weight:bold;">Difference</span><br/><small>red=removed,<br/>green=added</small>', '<div style="background-color:white;font-size:0.9em;border:1px solid black;white-space: pre;font-family: "Courier New", monospace;">'.$fdiff.'</div>'); } else { print_label_row('<span style="color:orange;font-weight:bold;">Difference</span>', 'For this feature to work, please install <a href="http://pear.php.net/package/Text_Diff">PEAR Text_Diff</a>:<br/><pre>$ sudo pear install Text_Diff</pre>'); } } else { print_label_row('Original', 'There is no original version for this template.'); }