$db_target->query("INSERT INTO {$table_target}_field_home SET {$data}"); $db_target->query("INSERT INTO {$table_target}_log SET {$data}"); $db_target->query("INSERT INTO {$table_target}_profile SET {$data}"); $db_target->query("INSERT INTO {$table_target}_status SET {$data}"); $db_uc->query("INSERT INTO {$table_target_uc_memberfields} SET {$data}"); $row = daddslashes($row, 1); $unset = array('regip', 'lastip', 'lastvisit', 'lastactivity', 'lastpost', 'posts', 'threads', 'digestposts', 'pageviews', 'extcredits1', 'extcredits2', 'extcredits3', 'extcredits4', 'extcredits5', 'extcredits6', 'extcredits7', 'extcredits8', 'bday', 'sigstatus', 'tpp', 'ppp', 'styleid', 'dateformat', 'timeformat', 'pmsound', 'showemail', 'newsletter', 'invisible', 'prompt', 'editormode', 'customshow', 'xspacestatus', 'customaddfeed', 'newbietaskid', 'secques', 'gender'); list($year, $month, $day) = explode('-', $row['bday']); $row['notifysound'] = $row['pmsound']; $update = array('status' => array('regip' => $row['regip'], 'lastip' => $row['lastip'], 'lastvisit' => $row['lastvisit'], 'lastactivity' => $row['lastactivity'], 'lastpost' => $row['lastpost'], 'buyercredit' => $row['buyercredit'], 'sellercredit' => $row['sellercredit']), 'count' => array('posts' => $row['posts'], 'threads' => $row['threads'], 'digestposts' => $row['digestposts'], 'extcredits1' => $row['extcredits1'], 'extcredits2' => $row['extcredits2'], 'extcredits3' => $row['extcredits3'], 'extcredits4' => $row['extcredits4'], 'extcredits5' => $row['extcredits5'], 'extcredits6' => $row['extcredits6'], 'extcredits7' => $row['extcredits7'], 'extcredits8' => $row['extcredits8'], 'oltime' => $row['oltime']), 'profile' => array('birthyear' => $year, 'birthmonth' => $month, 'birthday' => $day, 'gender' => $row['gender'], 'site' => $rowfield['site'], 'alipay' => $rowfield['alipay'], 'icq' => $rowfield['icq'], 'qq' => $rowfield['qq'], 'yahoo' => $rowfield['yahoo'], 'msn' => $rowfield['msn'], 'taobao' => $rowfield['taobao'], 'address' => $rowfield['location'], 'bio' => $rowfield['bio']), 'field_forum' => array('customshow' => $row['customshow'], 'customstatus' => $rowfield['customstatus'], 'medals' => $rowfield['medals'], 'sightml' => $rowfield['sightml'], 'groupterms' => $rowfield['groupterms'], 'authstr' => $rowfield['authstr'])); foreach ($unset as $k) { unset($row[$k]); } foreach ($update as $table => $trow) { $data = implode_field_value($trow, ',', db_table_fields($db_target, $table_target . '_' . $table)); $db_target->query("UPDATE {$table_target}_{$table} SET {$data} WHERE uid='{$row['uid']}'"); } $data = implode_field_value($row, ',', db_table_fields($db_target, $table_target)); $db_target->query("INSERT INTO {$table_target} SET {$data}"); $salt = rand(100000, 999999); $row['password'] = md5($row['password'] . $salt); $row['salt'] = $salt; $rows = array('uid' => $row['uid'], 'username' => $row['username'], 'password' => $row['password'], 'email' => $row['email'], 'myid' => '', 'myidkey' => '', 'regip' => $row['regip'], 'regdate' => $row['regdate'], 'lastloginip' => '', 'lastlogintime' => '', 'salt' => $row['salt'], 'secques' => $row['secques']); $data = implode_field_value($rows, ',', db_table_fields($db_uc, $table_target_uc_member)); $db_uc->query("INSERT INTO {$table_target_uc_member} SET {$data}"); } if ($nextid) { showmessage("继续转换数据表 " . $table_source . " uid > {$nextid}", "index.php?a={$action}&source={$source}&prg={$curprg}&start={$nextid}"); } else { $db_target->query("UPDATE {$table_target} SET emailstatus=1 WHERE groupid<>8"); }
<?php /** * DiscuzX Convert * * $Id: access.php 10469 2010-05-11 09:12:14Z monkey $ * English by Valery Votintsev at sources.ru */ $curprg = basename(__FILE__); $table_source = $db_source->tablepre . 'access'; $table_target = $db_target->tablepre . 'forum_access'; $limit = 2000; $nextid = 0; $start = getgpc('start'); if (empty($start)) { $start = 0; $db_target->query("TRUNCATE {$table_target}"); } $query = $db_source->query("SELECT * FROM {$table_source} LIMIT {$start}, {$limit}"); while ($row = $db_source->fetch_array($query)) { $nextid = 1; $row = daddslashes($row, 1); $data = implode_field_value($row, ',', db_table_fields($db_target, $table_target)); $db_target->query("INSERT INTO {$table_target} SET {$data}"); } if ($nextid) { showmessage(lang('continue_convert_table') . $table_source . lang('from') . $start . lang('to') . ($start + $limit) . lang('lines'), "index.php?a={$action}&source={$source}&prg={$curprg}&start=" . ($start + $limit)); //vot }
function block_import($data) { global $_G; if (!is_array($data['block'])) { return; } $data = daddslashes($data); $stylemapping = array(); if ($data['style']) { $hashes = $styles = array(); foreach ($data['style'] as $value) { $hashes[] = $value['hash']; $styles[$value['hash']] = $value['styleid']; } $query = $_G['db']->query('SELECT styleid, hash FROM ' . $_G['tablepre'] . "common_block_style WHERE hash IN (" . dimplode($hashes) . ')'); while ($value = $_G['db']->fetch_array($query)) { $id = $styles[$value['hash']]; $stylemapping[$id] = intval($value['styleid']); unset($styles[$value['hash']]); } foreach ($styles as $id) { $style = $data['style'][$id]; $style['styleid'] = ''; if (is_array($style['template'])) { $style['template'] = dstripslashes($style['template']); $style['template'] = addslashes(serialize($style['template'])); } $sql = implode_field_value($style); $_G['db']->query('INSERT INTO ' . $_G['tablepre'] . 'common_block_style SET ' . $sql); $newid = $_G['db']->insert_id(); $stylemapping[$id] = $newid; } } $blockmapping = array(); foreach ($data['block'] as $block) { $oid = $block['bid']; if (!empty($block['styleid'])) { $block['styleid'] = intval($stylemapping[$block['styleid']]); } $block['bid'] = ''; $block['uid'] = $_G['uid']; $block['username'] = $_G['username']; $block['dateline'] = 0; if (is_array($block['param'])) { $block['param'] = dstripslashes($block['param']); $block['param'] = addslashes(serialize($block['param'])); } $sql = implode_field_value($block); $_G['db']->query('INSERT INTO ' . $_G['tablepre'] . 'common_block SET ' . $sql); $newid = $_G['db']->insert_id(); $blockmapping[$oid] = $newid; } return $blockmapping; }
<?php /** * DiscuzX Convert * * $Id: trades.php 10469 2010-05-11 09:12:14Z monkey $ */ $curprg = basename(__FILE__); $table_source = $db_source->tablepre . 'trades'; $table_target = $db_target->tablepre . 'forum_trade'; $limit = 2000; $nextid = 0; $start = getgpc('start'); if ($start == 0) { $start = 0; $db_target->query("TRUNCATE {$table_target}"); } $query = $db_source->query("SELECT * FROM {$table_source} LIMIT {$start}, {$limit}"); while ($data = $db_source->fetch_array($query)) { $nextid = 1; $data = daddslashes($data, 1); $datalist = implode_field_value($data, ',', db_table_fields($db_target, $table_target)); $db_target->query("INSERT INTO {$table_target} SET {$datalist}"); } if ($nextid) { showmessage("繼續轉換數據表 " . $table_source . " {$start} 至 " . ($start + $limit) . " 行", "index.php?a={$action}&source={$source}&prg={$curprg}&start=" . ($start + $limit)); }
<?php /** * DiscuzX Convert * * $Id: home_comment.php 15720 2010-08-25 23:56:08Z monkey $ * English by Valery Votintsev at sources.ru */ $curprg = basename(__FILE__); $table_source = $db_source->tablepre . 'comment'; $table_target = $db_target->tablepre . 'home_comment'; $limit = $setting['limit']['comment'] ? $setting['limit']['comment'] : 1000; $nextid = 0; $start = getgpc('start'); if ($start == 0) { $db_target->query("TRUNCATE {$table_target}"); } $query = $db_source->query("SELECT * FROM {$table_source} WHERE cid>'{$start}' AND (idtype='blogid' OR idtype='uid' OR idtype='picid' OR idtype='sid') ORDER BY cid LIMIT {$limit}"); while ($comment = $db_source->fetch_array($query)) { $nextid = $comment['cid']; $comment = daddslashes($comment, 1); $data = implode_field_value($comment, ',', db_table_fields($db_target, $table_target)); $db_target->query("INSERT INTO {$table_target} SET {$data}"); } if ($nextid) { showmessage(lang('update', 'continue_convert_table') . $table_source . " cid> {$nextid}", "index.php?a={$action}&source={$source}&prg={$curprg}&start={$nextid}"); }
<?php /** * DiscuzX Convert * * $Id: threadtypes.php 10469 2010-05-11 09:12:14Z monkey $ */ $curprg = basename(__FILE__); $table_source = $db_source->tablepre . 'threadtypes'; $table_target = $db_target->tablepre . 'forum_threadtype'; $limit = 100; $nextid = 0; $start = getgpc('start'); if ($start == 0) { $db_target->query("TRUNCATE {$table_target}"); } $query = $db_source->query("SELECT * FROM {$table_source} WHERE typeid>'{$start}' AND special='1' ORDER BY typeid LIMIT {$limit}"); while ($threadtype = $db_source->fetch_array($query)) { $nextid = $threadtype['typeid']; $threadtype = daddslashes($threadtype, 1); $data = implode_field_value($threadtype, ',', db_table_fields($db_target, $table_target)); $db_target->query("INSERT INTO {$table_target} SET {$data}"); } if ($nextid) { showmessage("繼續轉換數據表 " . $table_source . " typeid > {$nextid}", "index.php?a={$action}&source={$source}&prg={$curprg}&start={$nextid}"); }
$data = daddslashes($data, 1); foreach ($usergroup as $field) { $userdata[$field] = $data[$field]; } $data['allowsearch'] = $data['allowsearch'] ? 63 : 0; foreach ($usergroup_field as $field) { $userfielddata[$field] = $data[$field]; } $userfielddata['allowpostimage'] = $userfielddata['allowpostattach']; if ($userfielddata['raterange']) { $raterangearray = array(); foreach (explode("\n", $userfielddata['raterange']) as $range) { $range = explode("\t", $range); if (count($range) == 4) { $raterangearray[$range[0]] = implode("\t", array($range[0], 'isself' => 0, 'min' => $range[1], 'max' => $range[2], 'mrpd' => $range[3])); } } if (!empty($raterangearray)) { $userfielddata['raterange'] = implode("\n", $raterangearray); } } $userdatalist = implode_field_value($userdata, ',', db_table_fields($db_target, $table_target)); $userfielddatalist = implode_field_value($userfielddata, ',', db_table_fields($db_target, $table_target_field)); $db_target->query("INSERT INTO {$table_target} SET {$userdatalist}"); $db_target->query("INSERT INTO {$table_target_field} SET {$userfielddatalist}"); } if ($nextid) { showmessage("继续转换数据表 " . $table_source . " groupid > {$nextid}", "index.php?a={$action}&source={$source}&prg={$curprg}&start={$nextid}"); } else { $db_target->query("UPDATE {$table_target} SET allowvisit='2' WHERE groupid='1'"); }
$table_source = $db_source->tablepre . 'mailcron'; $table_target = $db_target->tablepre . 'common_mailcron'; $table_source_rel = $db_source->tablepre . 'mailqueue'; $table_target_rel = $db_target->tablepre . 'common_mailqueue'; $limit = 1000; $nextid = 0; $start = getgpc('start'); if ($start == 0) { $db_target->query("TRUNCATE {$table_target}"); $db_target->query("TRUNCATE {$table_target_rel}"); } $query = $db_source->query("SELECT * FROM {$table_source} WHERE cid>'{$start}' ORDER BY cid LIMIT {$limit}"); $mcids = array(); while ($rs = $db_source->fetch_array($query)) { $mcids[] = $rs['cid']; $nextid = $rs['cid']; $rs = daddslashes($rs, 1); $data = implode_field_value($rs, ',', db_table_fields($db_target, $table_target)); $db_target->query("INSERT INTO {$table_target} SET {$data}"); } if (!empty($mcids)) { $query = $db_source->query("SELECT * FROM {$table_source_rel} WHERE cid IN (" . dimplode($mcids) . ")"); while ($rs = $db_source->fetch_array($query)) { $rs = daddslashes($rs, 1); $data = implode_field_value($rs, ',', db_table_fields($db_target, $table_target_rel)); $db_target->query("INSERT INTO {$table_target_rel} SET {$data}"); } } if ($nextid) { showmessage(lang('update', 'continue_convert_table') . $table_source . " mcid> {$nextid}", "index.php?a={$action}&source={$source}&prg={$curprg}&start={$nextid}"); }
/** * DiscuzX Convert * * $Id: spacenews.php 15777 2010-08-26 04:00:58Z zhengqingpeng $ * English by Valery Votintsev at sources.ru */ $curprg = basename(__FILE__); $table_source = $db_source->tablepre . 'spacenews'; $table_target = $db_target->tablepre . 'portal_article_content'; $limit = 1000; $nextid = 0; $start = getgpc('start'); if ($start == 0) { $db_target->query("TRUNCATE {$table_target}"); } $query = $db_source->query("SELECT * FROM {$table_source} WHERE nid>'{$start}' ORDER BY nid LIMIT {$limit}"); while ($news = $db_source->fetch_array($query)) { $nextid = $news['nid']; $setcontent = array(); $setcontent['cid'] = $news['nid']; $setcontent['aid'] = $news['itemid']; $setcontent['content'] = $news['message']; $setcontent['pageorder'] = $news['pageorder']; $setcontent['dateline'] = $news['dateline']; $setcontent = daddslashes($setcontent, 1); $data = implode_field_value($setcontent, ',', db_table_fields($db_target, $table_target)); $db_target->query("INSERT INTO {$table_target} SET {$data}"); } if ($nextid) { showmessage(lang('update', 'continue_convert_table') . $table_source . " nid> {$nextid}", "index.php?a={$action}&source={$source}&prg={$curprg}&start={$nextid}"); }
if ($value['type'] == 'zone') { $menuzone[] = $value; } if ($value['type'] == 'group') { $menugroup[] = $value; } if ($value['type'] == 'item') { $itemstrarray[$value['node']][] = "'{$value['mcode']}' : ['{$value['mname']}','{$value['murl']}','']"; } } foreach ($menuzone as $value) { foreach ($menugroup as $value1) { if ($value1['node'] == $value['mid']) { $groupstrarray[$value['mid']][] = "'{$value1['mcode']}' : {" . implode_field_value($itemstrarray[$value1['mid']], ',') . "}"; } } } foreach ($menuzone as $value) { $zonestrarray[] = "'{$value['mcode']}' : {" . implode_field_value($groupstrarray[$value['mid']], ',') . "}"; } function implode_field_value($array, $glue = ',') { $sql = $comma = ''; foreach ($array as $k => $v) { $sql .= $comma . "{$v}"; $comma = $glue; } return $sql; } //包含后台模板文件 include "tpl/index.htm";
} //出错! if (strlen($adminpwd) != 32) { $adminpwd = md5($adminpwd); } //用户密码加密 if (is_array($mid)) { $adminmid = getdotstring($mid, 'int'); } //格式化成id,id形式 foreach ($menuarray as $value) { if (in_array($value['mid'], $mid)) { $temparray[] = $value['mcode']; } } $adminpurview = implode_field_value($temparray); //格式化成id,id形式 $arrayadd = array("adminname" => Char_cv($adminname), "adminpwd" => Char_cv($adminpwd), "adminmid" => $adminmid, "adminpurview" => $adminpurview); $info = $Table->edit($adminid, $arrayadd); if ($info == "OK") { exit("<script language='javascript'>alert('编辑成功');parent.\$.fn.colorbox.close();</script>"); } else { exit("<script language='javascript'>alert('编辑失败');history.go(-1);</script>"); } } else { $evalue = $Table->getone($adminid); //print_r($evalue); include "tpl/admin_add.htm"; } } else { showmsg("未知请求", "-1");