ob_start(); if ($xoopsDB->getRowsNum($res)) { // force clean work files $work = XOOPS_UPLOAD_PATH . "/update/work"; if (is_dir("{$work}/{$updatedir}")) { system("rm -rf '{$work}/{$updatedir}'"); } if (is_dir("{$work}/{$backupdir}")) { system("rm -rf '{$work}/{$backupdir}'"); } while ($data = $xoopsDB->fetchArray($res)) { $pkg = new InstallPackage($data); $pkg->load(); $pname = $pkg->getVar('pname'); $newpkg = new Package($pname, $pkgs[$pkg->dirname]['pversion']); if ($pkg->getVar('parent') != $newpkg->getVar('pkgid')) { if ($op == 'exec') { $pkg->backupPackage($newpkg, $backupdir); $pkg->updatePackage($newpkg, $updatedir); package_expire($pname); } elseif ($op == 'update') { $pkg->updatePackage($newpkg, $updatedir); } else { $pkg->backupPackage($newpkg, $backupdir); } $pkgn++; } } } $content = ob_get_contents(); ob_end_clean();
function show_info_table($pkg) { $ppkg = new Package($pkg->getVar('parent')); $info = array('name' => _AM_PKG_NAME, 'pname' => _AM_PKG_PNAME, 'pversion' => _AM_PKG_CURRENT, 'dtime' => _AM_PKG_DTIME, 'ctime' => _AM_PKG_CTIME, 'vcheck' => _AM_PKG_DIRNAME); $buf = "<table cellspacing='0'>\n"; $dirname = $pkg->getVar('vcheck'); $module_handler =& xoops_gethandler('module'); $module = $dirname ? $module_handler->getByDirname($dirname) : false; list($mver, $iver) = get_current_version($pkg->getVar('pname'), $pkg->getVar('vcheck')); $n = 0; foreach ($info as $name => $label) { $bg = $n++ % 2 ? "even" : "odd"; $val = $ppkg->getVar($name); if (preg_match('/time$/', $name)) { $val = formatTimestamp($val); } elseif ($name == 'pversion') { if ($iver != $val) { $val .= " ({$iver})"; } if (is_object($module)) { $cver = $module->getVar('version') / 100; if ($cver != $mver) { $val .= " [{$cver}" . _AM_UPDATE_TO . "{$mver}]"; } } } elseif ($name == 'vcheck') { if ($dirname != $val) { $val = "{$dirname} ({$val})"; } } $val = htmlspecialchars($val); $buf .= "<tr class='{$bg}'><th>{$label}</th><td>{$val}</td></tr>\n"; } return $buf . "</table>\n"; }