$sql = "SELECT b.basename, b.version, b.author FROM " . $db_config['prefix'] . "_" . $lang . "_modules a INNER JOIN " . $db_config['prefix'] . "_setup_extensions b ON a.title=b.title GROUP BY b.basename ORDER BY b.basename ASC"; $result = $db->query($sql); 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(' '); }
$XML_exts = $XML_exts->xpath('extension'); $exts = array(); $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');