function getDiff($path, $target = "") { if ($this->files[$path] == 'delete') { return ''; } //if (!isset($this->modifies[$path])) return ''; $ver = $this->getVar('origin'); if (empty($ver)) { $ver = $this->getVar('pversion'); } $prefix = $this->getVar('pname') . '/' . $ver; $file = XOOPS_UPLOAD_PATH . "/update/source/{$prefix}/{$path}"; if (is_binary($path)) { return 'file is binary'; } if (file_exists($file)) { $src = file_get_contents($file); } else { $src = $this->getFile($path); } if ($src === false) { return _AM_DIFF_FETCH_ERROR; } $orig = $target ? $target : $this->getRealPath($path); $dest = file_exists($orig) ? file_get_contents($orig) : ''; $tag = array('/\\$(Id|Date|Author|Revision):[^\\$]*\\$/', '/\\r/'); $rep = array('$\\1$', ''); if ($this->reverse) { return diff_str(preg_replace($tag, $rep, $dest), preg_replace($tag, $rep, $src)); } else { return diff_str(preg_replace($tag, $rep, $src), preg_replace($tag, $rep, $dest)); } }
</head> <body>'; echo "<style>\n.del { color: blue; }\n.add { color: red; }\n.info { color: grey; }\n.msg { font-size: 14px; font-weight: bold; color: red; }\n.chg { background-color: #fef; }\n.db { background-color: #eff; }\nh1 { font-size: 16px; }\npre { font-size: 12px; padding: 2px;}\n</style>\n"; $res = $xoopsDB->query("SELECT name FROM " . UPDATE_FILE . ", " . UPDATE_DIFF . ",\n" . UPDATE_PKG . " WHERE path=" . $xoopsDB->quoteString($file) . " AND fileid=fileref AND pkgref=pkgid AND pkgid=" . $pkgid); list($name) = $xoopsDB->fetchRow($res); $title = htmlspecialchars("{$name}: {$file}"); if ($chg) { echo "<h1>" . _AM_FILE_DIFF . " - {$atitle}</h1>"; $adiff = $pkg->getDiff($file); if (empty($adiff)) { echo "<p>" . _AM_FILE_SAME . "</p>"; } else { if ($adiff == $diff) { echo "<p>" . _AM_FILE_SAMEDIFF . "</p>"; } else { $bdiff = diff_str($diff, $adiff); if (strlen($bdiff) < strlen($adiff)) { echo "<div class='msg'>" . _AM_DIFF_DIFF . " {$name} - " . $pkg->getVar('pversion') . "</div>"; echo "<pre class='chg'>" . colorDiff($bdiff) . "</pre>"; } else { echo "<div class='msg'>" . _AM_HAS_CHANGE . ' - ' . $pkg->getVar('pversion') . "</div>"; if ($adiff) { echo "<pre class='chg'>" . colorDiff($adiff) . "</pre>"; } } } } } if ($diff != false) { echo "<h1>" . _AM_FILE_DBDIFF . " - {$title}</h1>"; if ($diff) {