vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 4.x Add-ons (https://vborg.vbsupport.ru/forumdisplay.php?f=245)
-   -   Administrative and Maintenance Tools - Template Editing: Show Difference (https://vborg.vbsupport.ru/showthread.php?t=295968)

tdev1 03-09-2013 11:00 PM

Template Editing: Show Difference
 
1 Attachment(s)
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:
Code:

cp admincp/template.php admincp/template_original.php
b) apply the attached patch:
Code:

patch -p0 < template_mod.diff.txt
c) install Text_Diff via pear:
Code:

pear install Text_Diff

Dr.CustUmz 10-08-2020 04:00 PM

1 Attachment(s)
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'$texto22'75" style="width:99%'truefalse'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.');


And have placed it under line 2116:
PHP Code:

'template'$template['template_un'], 22'75" style="width:100%'truetrue'ltr''code'); 

I have placed the Text folder in my root

Its displaying how it should, BUT it is not showing differences.
Attachment 157758


All times are GMT. The time now is 05:10 AM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01025 seconds
  • Memory Usage 1,733KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (3)bbcode_code_printable
  • (2)bbcode_php_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (2)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete