if (!is_null($cfields)) { $gui->cfieldsDiff = getCFDiff($cfields, $itemMgr); } $gui->diff = array("scope" => array()); foreach ($gui->diff as $key => $val) { if ($args->useDaisyDiff) { $diff = new HTMLDiffer(); list($differences, $diffcount) = $diff->htmlDiff($sbs['left_item'][$key], $sbs['right_item'][$key]); $gui->diff[$key]["diff"] = $differences; $gui->diff[$key]["count"] = $diffcount; } else { // insert line endings so diff is better readable and makes sense (not everything in one line) // then cast to array with \n as separating character, differ needs that $gui->diff[$key]["left"] = explode("\n", str_replace("</p>", "</p>\n", $sbs['left_item'][$key])); $gui->diff[$key]["right"] = explode("\n", str_replace("</p>", "</p>\n", $sbs['right_item'][$key])); $gui->diff[$key]["diff"] = $differ->inline($gui->diff[$key]["left"], $gui->leftID, $gui->diff[$key]["right"], $gui->rightID, $args->context); $gui->diff[$key]["count"] = count($differ->changes); } $gui->diff[$key]["heading"] = lang_get($key); // are there any changes? then display! if not, nothing to show here $additional = ''; $msg_key = "no_changes"; if ($gui->diff[$key]["count"] > 0) { $msg_key = "num_changes"; $additional = $gui->diff[$key]["count"]; } $gui->diff[$key]["message"] = sprintf($labels[$msg_key], $key, $additional); } } $smarty->assign('gui', $gui); $smarty->display($templateCfg->template_dir . $templateCfg->default_template);
if ($args->compare_selected_versions) { $diff_array = array("scope" => array()); foreach ($reqSet as $req) { if ($req['version'] == $args->version_left) { $left = $req; } if ($req['version'] == $args->version_right) { $right = $req; } } foreach ($diff_array as $key => $val) { // insert line endings so diff is better readable and makes sense (not everything in one line) // then cast to array with \n as separating character, differ needs that $diff_array[$key]["left"] = explode("\n", str_replace("</p>", "</p>\n", $left[$key])); $diff_array[$key]["right"] = explode("\n", str_replace("</p>", "</p>\n", $right[$key])); $diff_array[$key]["diff"] = $differ->inline($diff_array[$key]["left"], $gui->version_short . $args->version_left, $diff_array[$key]["right"], $gui->version_short . $args->version_right, $args->context); $diff_array[$key]["count"] = count($differ->changes); $diff_array[$key]["heading"] = lang_get($key); //are there any changes? then display! if not, nothing to show here if ($diff_array[$key]["count"] > 0) { $diff_array[$key]["message"] = sprintf($labels["num_changes"], $key, $diff_array[$key]["count"]); } else { $diff_array[$key]["message"] = sprintf($labels["no_changes"], $key); } } $gui->diff_array = $diff_array; $glue_char = config_get('gui_title_separator_1'); $gui->subtitle = sprintf(lang_get('diff_subtitle_req'), $args->version_left, $args->version_left, $args->version_right, $args->version_right, $reqSet[0]['req_doc_id'] . $glue_char . $reqSet[0]['title']); } $smarty->assign('gui', $gui); $smarty->display($templateCfg->template_dir . $templateCfg->default_template);
$pathResultToday = mysql_fetch_assoc($getPathSqlToday); $pathResultYesterday = mysql_fetch_assoc($getPathSqlYesterday); if (empty($pathResultToday) || empty($pathResultYesterday)) { // continue for the foreach if one of the files is not available as this compare will be invalid echo 'continue invoked for ' . $device['deviceName'] . "\n"; continue; } $pathResult_a = $pathResultToday['configLocation']; $pathResult_b = $pathResultYesterday['configLocation']; $filenameResult_a = $pathResultToday['configFilename']; $filenameResult_b = $pathResultYesterday['configFilename']; $path_a = $pathResult_a . '/' . $filenameResult_a; $path_b = $pathResult_b . '/' . $filenameResult_b; // run the compare with no linepadding set $diff = new diff(); $text = $diff->inline($path_a, $path_b); $count = count($diff->changes) . ' changes'; // send output to the report $report->eachData($device['deviceName'], $count, $text); // log to report } // End Data insert loop // script endTime $endTime = date('h:i:s A'); $time_end = microtime(true); $time = round($time_end - $time_start) . " Seconds"; $report->findReplace('<taskEndTime>', $endTime); $report->findReplace('<taskRunTime>', $time); $report->footer(); if ($taskRow['mailConnectionReport'] == '1') { require "/home/rconfig/classes/phpmailer/class.phpmailer.php";
// Validate and set full path vars $verified = TRUE; foreach ($_GET as $v) { if (!isset($v) || empty($v)) { $verified = FALSE; } } if (!$verified) { echo "<font color=\"red\">*</font> You must select all items with an asterisk"; // put in session to break and return error to script here exit; } else { // initialise Vars $path_a = $_GET['path_a']; $path_b = $_GET['path_b']; $linepadding = $_GET['linepadding']; } $diff = new diff(); if ($linepadding >= 1 && $linepadding <= 99) { //if linepadding var is number and is between 1 and 99 $text = $diff->inline($path_a, $path_b, $linepadding); } else { $text = $diff->inline($path_a, $path_b); } echo count($diff->changes) . ' changes'; echo $text; // echo output // Print time taken script $End = getTime(); echo "<div class=\"spacer\"></div>"; echo "<Strong>Time taken = " . number_format($End - $Start, 2) . " secs </strong>";