Thread: Administrative and Maintenance Tools - Template Editing: Show Difference
View Single Post
  #2  
Old 10-08-2020, 04:00 PM
Dr.CustUmz's Avatar
Dr.CustUmz Dr.CustUmz is offline
 
Join Date: Aug 2013
Location: USA
Posts: 647
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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
Attached Files
File Type: zip Text.zip (22.4 KB, 5 views)
Reply With Quote
 
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01103 seconds
  • Memory Usage 1,814KB
  • Queries Executed 12 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD_SHOWPOST
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (2)bbcode_php
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_box
  • (1)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (1)post_thanks_postbit_info
  • (1)postbit
  • (1)postbit_attachment
  • (1)postbit_onlinestatus
  • (1)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • reputationlevel
  • showthread
Included Files:
  • ./showpost.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/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showpost_start
  • bbcode_fetch_tags
  • bbcode_create
  • postbit_factory
  • showpost_post
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_attachment
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • showpost_complete