while ($row = $result->fetch()) { if (isset($userModules[$row['basename']])) { continue; } $v = ''; $p = 0; if (preg_match("/^([^\\s]+)\\s+([\\d]+)\$/", $row['version'], $matches)) { $v = (string) $matches[1]; $p = (int) $matches[2]; } $userModules[$row['basename']] = array('basename' => $row['basename'], 'version' => $v, 'mode' => isset($onlineModules[$row['basename']]['mode']) ? $onlineModules[$row['basename']]['mode'] : false, 'time' => $p, 'author' => $row['author']); } } $NvUpdate->module_info($onlineModules, $userModules); } elseif ($type == 'module') { $_modules = nv_getExtVersion(0); $_modules = nv_object2array($_modules); $_modules = $_modules['module']; $onlineModules = array(); foreach ($_modules as $m) { $name = array_shift($m); $onlineModules[$name] = $m; unset($onlineModules[$name]['date']); $onlineModules[$name]['pubtime'] = strtotime($m['date']); } $NvUpdate->module_com_info($onlineModules); } else { die(' '); } } $contents = $NvUpdate->step3($array);
$xtpl->assign('VERSION_LINK', sprintf($lang_module['newVersion_info1'], NV_BASE_ADMINURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&' . NV_NAME_VARIABLE . '=' . $module_name . '&' . NV_OP_VARIABLE . '=getupdate&version=' . (string) $new_version->updateable . '&checksess=' . md5((string) $new_version->updateable . $global_config['sitekey'] . session_id()))); } elseif ((string) $new_version->updateable != '') { $xtpl->assign('VERSION_LINK', sprintf($lang_module['newVersion_info2'], (string) $new_version->updateable, NV_BASE_ADMINURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&' . NV_NAME_VARIABLE . '=' . $module_name . '&' . NV_OP_VARIABLE . '=getupdate&version=' . (string) $new_version->updateable . '&checksess=' . md5((string) $new_version->updateable . $global_config['sitekey'] . session_id()))); } else { $xtpl->assign('VERSION_LINK', sprintf($lang_module['newVersion_info3'], (string) $new_version->link)); } $xtpl->parse('sysUpd.inf'); } clearstatcache(); $sysUpdDate = filemtime(NV_ROOTDIR . '/' . NV_CACHEDIR . '/nukeviet.version.' . NV_LANG_INTERFACE . '.xml'); $xtpl->assign('SYSUPDDATE', nv_date('d/m/Y H:i', $sysUpdDate)); $xtpl->parse('sysUpd'); echo $xtpl->text('sysUpd'); } } elseif ($i == 'extUpd' or $i == 'extUpdRef') { $exts = $i == 'extUpd' ? nv_getExtVersion(28800) : nv_getExtVersion(120); $error = ''; if ($exts === false) { $error = $lang_module['error_unknow']; } elseif (is_string($exts)) { $error = $exts; } if (!empty($error)) { $xtpl->assign('ERROR', $lang_module['checkExtensions'] . ': ' . $error); $xtpl->parse('error'); echo $xtpl->text('error'); } else { clearstatcache(); $extUpdDate = filemtime(NV_ROOTDIR . '/' . NV_CACHEDIR . '/extensions.version.' . NV_LANG_INTERFACE . '.xml'); $exts = $exts->xpath('extension'); $a = 1;
$i = 0; foreach ($XML_exts as $extname => $values) { $exts[$i] = array('id' => (int) $values->id, 'type' => (string) $values->type, 'name' => (string) $values->name, 'version' => (string) $values->version, 'date' => (string) $values->date, 'new_version' => (string) $values->new_version, 'new_date' => (string) $values->new_date, 'author' => (string) $values->author, 'license' => (string) $values->license, 'mode' => (string) $values->mode, 'message' => (string) $values->message, 'link' => (string) $values->link, 'support' => (string) $values->support, 'updateable' => array(), 'origin' => (string) $values->origin == 'true' ? true : false); // Xu ly update $updateables = $values->xpath('updateable/upds/upd'); if (!empty($updateables)) { foreach ($updateables as $updateable) { $exts[$i]['updateable'][] = array('fid' => (string) $updateable->upd_fid, 'old' => explode(',', (string) $updateable->upd_old), 'new' => (string) $updateable->upd_new); } } $i++; unset($updateables, $updateable); } $NvUpdate->module_info($exts); } elseif ($type == 'module') { $XML_exts = nv_getExtVersion(0); if ($XML_exts === false or is_string($XML_exts)) { $NvUpdate->trigger_error($lang_module['update_error_check_version_ext']); } $XML_exts = $XML_exts->xpath('extension'); $onlineModules = array(); foreach ($XML_exts as $extname => $values) { $exts_type = trim((string) $values->type); $exts_name = trim((string) $values->name); if ($exts_type == 'module') { $onlineModules[$exts_name] = array('id' => (int) $values->id, 'type' => (string) $values->type, 'name' => (string) $values->name, 'version' => (string) $values->version, 'date' => (string) $values->date, 'new_version' => (string) $values->new_version, 'new_date' => (string) $values->new_date, 'author' => (string) $values->author, 'license' => (string) $values->license, 'mode' => (string) $values->mode, 'message' => (string) $values->message, 'link' => (string) $values->link, 'support' => (string) $values->support, 'updateable' => array(), 'origin' => (string) $values->origin == 'true' ? true : false); $onlineModules[$exts_name]['pubtime'] = strtotime($onlineModules[$exts_name]['date']); // Xu ly update $updateables = $values->xpath('updateable/upds/upd'); if (!empty($updateables)) { foreach ($updateables as $updateable) {