Example #1
0
<?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
}
Example #2
0
<?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));
}
Example #3
0
    $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");
}
Example #4
0
<?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}");
}
Example #5
0
<?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}");
}
Example #6
0
    $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'");
}
Example #7
0
$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}");
}
Example #8
0
/**
 * 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}");
}