if (!function_exists("file_get_contents")) { function file_get_contents($filename) { $fp = fopen($filename, "rb"); if (!$fp) { return false; } $contents = ""; while (!feof($fp)) { $contents .= fread($fp, 4096); } return $contents; } } xoops_cp_header(); echo mystyle(); include 'mymenu.php'; $myts =& MyTextSanitizer::getInstance(); $file = isset($_GET['file']) ? $myts->stripSlashesGPC($_GET['file']) : "help.html"; display_lang_file($file); xoops_cp_footer(); exit; // show under language/XX/$file only <body> part. function display_lang_file($file, $link = '') { global $xoopsConfig, $xoopsModule; if (empty($link)) { $link = preg_replace('/[&\\?]?file=[^&]*|\\?$/', '', $_SERVER['REQUEST_URI']); $link .= preg_match('/\\?/', $link) ? '&' : '?'; $link .= 'file='; }
function detail_package($pid, $vmode = false, $new = 0) { global $file_state, $xoopsModuleConfig; $pkg = new InstallPackage($pid); $dirname = $pkg->getVar('vcheck'); $title = $pkg->getVar('name'); if ($dirname) { $title .= " ({$dirname})"; } if ($new) { $newpkg = new Package($new); $title .= _AM_UPDATE_TO . $newpkg->getVar('name'); $files = $pkg->checkFiles($newpkg); $id = $new; //$files = $pkg->checkPackage($newpkg); } else { if ($vmode) { $files = $pkg->modifyFiles(); if ($xoopsModuleConfig['check_extra']) { $files = array_merge($files, $pkg->checkExtra()); ksort($files); } } else { $files = $pkg->checkFiles(); } $id = $pid; } if (count($files) == 0) { echo _AM_NODATA; return; } echo mystyle(); echo "<h3>{$title}</h3>"; if (!$vmode) { echo "<form method='POST' name='FileMark'>\n"; echo "<input type='hidden' name='pkgid' value='{$pid}'/>\n"; } $dels = count(array_keys($files, 'del')); if ($dels && $vmode) { $sw = " <a href='index.php?op=detail&pkgid={$pid}&view="; if ($vmode == 'yes') { $sw .= "all'>" . _AM_VIEW_ALL; } else { $sw .= "yes'>" . _AM_VIEW_SCRIPT; } $sw .= "</a>"; $fm = "<form method='post'>\n<input name='clear' type='submit' value='" . _AM_UPDATE_CLEAR . "'/>\n<input name='pkgid' type='hidden' value='{$pid}'/>\n</form>"; } else { $sw = $fm = ""; } echo "<table cellspacing='5'>\n<tr>\n<td>" . _AM_FILE_ALL . " " . count($pkg->files) . "</td>\n<td>" . _AM_CHG . " " . count(array_keys($files, 'chg')) . "</td><td>" . _AM_DEL . " " . $dels . "</td><td>" . $sw . "</td>\n</tr>\n</table>\n"; echo "<table cellspacing='1' class='outer'>\n"; $checkall = "<input type='checkbox' id='allconf' name='allconf' onclick='xoopsCheckAll(\"FileMark\", \"allconf\")'/>"; echo "<tr>"; if (!$vmode) { echo "<th align='center' class='ckbox'>{$checkall}</th>"; } echo "<th>" . _AM_STATUS . "</th><th>" . _AM_FILE . "</th></tr>\n"; $n = 0; foreach ($files as $file => $stat) { if ($vmode == 'yes') { if ($stat == 'del') { continue; } if (is_binary($file) || preg_match('/\\.css$/', $file)) { continue; } } $bg = $n++ % 2 ? 'even' : 'odd'; $ck = "<input type='checkbox' name='conf[]' value='{$file}'/>"; $slabel = $file_state[$stat]; switch ($stat) { case 'chg': $slabel = "<a href='diff.php?pkgid={$id}&file={$file}' target='diff'>{$slabel}</a>"; break; case 'new': $slabel = "<b>{$slabel}</b>"; break; } if ($vmode) { $diff = $pkg->dbDiff($file); if ($stat == 'extra') { } elseif (empty($diff)) { $stat = 'same'; $adiff = $new ? $newpkg->getDiff($file) : ""; if (empty($adiff)) { $file .= " ="; } } elseif (count(preg_split('/\\n/', $diff) < 6) && preg_match('/\\n .*\\n-\\n$/', $diff)) { $stat = 'same'; $file .= " +"; } elseif ($new) { $adiff = $newpkg->getDiff($file); if ($adiff == $diff) { $stat = 'mod'; $file .= " *"; } } $ck = ""; } else { $ck = "<td class='ckbox'><input type='checkbox' name='conf[]' value='{$file}'/></td>"; } $myfile = $pkg->getRealPath($file, false); echo "<tr class='{$bg}'>{$ck}"; echo "<td>{$slabel}</td><td class='{$stat}'>{$myfile}</td></tr>\n"; } echo "</table>\n"; if (!$vmode) { echo "<input type='submit' name='accept' value='" . _AM_REGIST_SUBMIT . "'/>\n"; echo "</form>\n"; } if ($fm && count($files) && !$new) { echo "<hr/>" . $fm; } }