コード例 #1
0
 public function fetchHistoryComparison($nodeid, $oldpost, $newpost)
 {
     if (!$this->canViewPostHistory($nodeid)) {
         throw new Exception('no_permission');
     }
     $_posthistory = vB::getDbAssertor()->getRows('vBForum:postedithistory', array(vB_dB_Query::TYPE_KEY => vB_dB_Query::QUERY_SELECT, vB_dB_Query::CONDITIONS_KEY => array('nodeid' => $nodeid, 'postedithistoryid' => array($oldpost, $newpost)), vB_dB_Query::COLUMNS_KEY => array('postedithistoryid', 'reason', 'dateline', 'username', 'original', 'pagetext')), array('field' => 'postedithistoryid', 'direction' => vB_dB_Query::SORT_ASC));
     if (!$_posthistory) {
         throw new Exception('no_permission');
     }
     $posthistory = array();
     $key = 1;
     foreach ($_posthistory as $info) {
         $posthistory['post' . $key] = $info;
         $key++;
     }
     require_once DIR . '/includes/class_diff.php';
     if ($posthistory['post2']) {
         $textdiff_obj = new vB_Text_Diff($posthistory['post1']['pagetext'], $posthistory['post2']['pagetext']);
     } else {
         $textdiff_obj = new vB_Text_Diff($posthistory['post1']['pagetext'], $posthistory['post1']['pagetext']);
     }
     $results = array();
     $diff = $textdiff_obj->fetch_diff();
     foreach ($diff as $diffrow) {
         $compare_show = array();
         if ($diffrow->old_class == 'unchanged' and $diffrow->new_class == 'unchanged') {
             // no change
             $results[] = array('unchanged_olddata' => vB_String::fetchWordWrappedString(nl2br(vB_String::htmlSpecialCharsUni(implode("\n", $diffrow->fetch_data_old())))));
         } else {
             // something has changed
             $results[] = array('changed_olddata' => vB_String::fetchWordWrappedString(nl2br(vB_String::htmlSpecialCharsUni(implode("\n", $diffrow->fetch_data_old())))), 'changed_newdata' => vB_String::fetchWordWrappedString(nl2br(vB_String::htmlSpecialCharsUni(implode("\n", $diffrow->fetch_data_new())))));
         }
     }
     return $results;
 }
コード例 #2
0
ファイル: template.php プロジェクト: hungnv0789/vhtm
	{
		list($left_id, $left_type) = explode('|', $vbulletin->GPC['left_template']);
		list($right_id, $right_type) = explode('|', $vbulletin->GPC['right_template']);

		$left_template = fetch_template_current_historical($left_id, $left_type);
		$right_template = fetch_template_current_historical($right_id, $right_type);
	}

	if (!$left_template OR !$right_template)
	{
		exit;
	}

	require_once(DIR . '/includes/class_diff.php');

	$diff = new vB_Text_Diff($left_template['templatetext'], $right_template['templatetext']);
	$entries =& $diff->fetch_diff();


	docompare_print_control_form($inline, $wrap, $context_lines);


	print_table_start(true, '90%', '', '', true);
	print_table_header(construct_phrase($vbphrase['comparing_versions_of_x'], htmlspecialchars_uni($left_template['title'])), 4);

	if (!$inline)
	{
		// side by side
		print_cells_row(array(
			$vbphrase['old_version'],
			$vbphrase['new_version']
コード例 #3
0
    $history['reason'] = fetch_word_wrapped_string($history['reason']);
    ($hook = vBulletinHook::fetch_hook('posthistory_history_bits')) ? eval($hook) : false;
    eval('$historybits .= "' . fetch_template('posthistory_listbit') . '";');
}
// we do compare when we have two selected version from the database
$form_do = 'compare';
$button_text = $vbphrase['compare_versions'];
$show['comparetable'] = false;
if ($_REQUEST['do'] == 'compare') {
    $show['comparetable'] = true;
    $show['titlecompare'] = false;
    $comparebits = '';
    if ($compare['oldver'] and $compare['newver']) {
        // make the diff
        require_once DIR . '/includes/class_diff.php';
        $textdiff_obj = new vB_Text_Diff($compare['oldver']['pagetext'], $compare['newver']['pagetext']);
        $diff = $textdiff_obj->fetch_diff();
        ($hook = vBulletinHook::fetch_hook('posthistory_compare')) ? eval($hook) : false;
        foreach ($diff as $diffrow) {
            $compare_show = array();
            if ($diffrow->old_class == 'unchanged' and $diffrow->new_class == 'unchanged') {
                // no change
                $compare_show['olddata'] = fetch_word_wrapped_string(nl2br(htmlspecialchars_uni(implode("\n", $diffrow->fetch_data_old()))));
                $compare_show['template'] = 'posthistory_content_not_changed';
            } else {
                // something has changed
                $compare_show['olddata'] = fetch_word_wrapped_string(nl2br(htmlspecialchars_uni(implode("\n", $diffrow->fetch_data_old()))));
                $compare_show['newdata'] = fetch_word_wrapped_string(nl2br(htmlspecialchars_uni(implode("\n", $diffrow->fetch_data_new()))));
                $compare_show['template'] = 'posthistory_content_changed';
            }
            ($hook = vBulletinHook::fetch_hook('posthistory_comparebit')) ? eval($hook) : false;
コード例 #4
0
 public function fetch_origin_custom_diff()
 {
     $diff = new vB_Text_Diff($this->origin, $this->custom, $this->output_progress);
     return $diff->fetch_annotated_lines();
 }