* DiscuzX Convert * * $Id: do_setting.inc.php 10469 2010-05-11 09:12:14Z monkey $ */ showtips('setting_tips'); $sfile = DISCUZ_ROOT . './source/' . $source . '/setting.ini'; if (!submitcheck('submit')) { show_form_header(); show_table_header(); show_table_row(array(array('colspan="3"', '编辑配置文件 source/' . $source . '/setting.ini')), 'title'); foreach ($setting as $key => $value) { if (is_array($value) && !empty($value)) { show_table_row(array(array('colspan="3" align="left"', '<strong>[' . $key . ']<strong>')), 'bg1'); $disabled = in_array($key, array('program', 'config', 'steps', 'start', 'tablecheck')) ? ' disabled readonly' : ''; foreach ($value as $k => $v) { show_table_row(array(lang($k), array('class="bg2" width="70%"', '<input type="text" size="40" name="newsetting[' . $key . '][' . $k . ']" value="' . htmlspecialchars($v) . '"' . $disabled . '>' . ($disabled ? ' 只读' : ''))), 'bg2'); } } } show_table_footer(); show_form_footer('submit', lang('submit')); } else { $newsetting = getgpc('newsetting'); if (is_array($newsetting)) { $lines = file($sfile); foreach ($lines as $num => $line) { $lines[$num] = $line = trim($line); $check = substr($line, 0, 1); if ($check !== '' && $check != ';') { if ($check == '[') { $group = trim(str_replace(array('[', ']'), '', $line));
function show_config_input($type, $config, $error = array()) { $title = lang('update', 'config_type_' . $type); show_table_header(); show_table_row(array(array('colspan="3"', $title)), 'header title'); if ($type == 'target') { show_table_row(array(array('colspan="3"', '<font color="red">' . lang('update', 'config_type_target_comment') . '</font>')), 'bg2'); } foreach ($config as $key => $value) { $addmsg = $error && $key == 'dbhost' ? lang('update', $error) : ''; show_table_row(array(array('width="150"', lang('update', 'config_' . $key)), array('class="bg2"', '<input type="text" size="40" name="newconfig[' . $type . '][' . $key . ']" value="' . htmlspecialchars($value) . '">'), array('class="bg2"', '<font color="red">' . $addmsg . '</font>')), 'bg1'); } show_table_footer(); echo '<br>'; }
<?php // English by Valery Votintsev at sources.ru $config = loadconfig(); $db_target = new db_mysql($config['target']); $db_target->connect(); $readme = DISCUZ_ROOT . './source/' . $source . '/readme.txt'; if (file_exists($readme)) { $txt = file_get_contents($readme); } else { $txt = lang('update', 'finish'); } $txt = nl2br(htmlspecialchars($txt)); $txt = str_replace(' ', ' ', $txt); $txt = str_replace("\t", ' ', $txt); $process = load_process('main'); list($rday, $rhour, $rmin, $rsec) = remaintime(time() - $process['timestart']); $stime = gmdate('Y-m-d H:i:s', $process['timestart'] + 3600 * 8); $etime = gmdate('Y-m-d H:i:s', time() + 3600 * 8); $timetodo = lang('update', 'conversion_completed'); $timetodo .= "<br><br>" . lang('update', 'start_time') . ": <strong>{$stime}</strong><br>" . lang('update', 'end_time') . ": <strong>{$etime}</strong>"; $timetodo .= "<br>" . lang('update', 'execution_time') . ": <strong>{$rday}</strong> " . lang('update', 'days') . ", <strong>{$rhour}</strong> " . lang('update', 'hours') . ", <strong>{$rmin}</strong> " . lang('update', 'minutes') . ", <strong>{$rsec}</strong> " . lang('update', 'seconds'); $timetodo .= "<br><br>" . lang('update', 'update_more'); showtips($timetodo); show_table_header(); show_table_row(array(lang('update', 'read_me')), 'title'); show_table_row(array($txt)); show_table_footer();
show_form_header(); show_table_header(); show_table_row(array(array('colspan="3"', lang('config_usergroup'))), 'header title'); //vot show_table_row(array(lang('config_from_usergroup'), array('class="bg1" width="10%" align="center"', '->'), lang('config_target_usergroup'))); foreach ($sourcegroup as $key => $value) { $addmsg = $error && $key == 'dbhost' ? lang($error) : ''; //vot $key = intval($key); show_table_row(array(array('class="bg2" width="45%"', $value), array('class="bg1" width="10%" align="center"', '->'), array('class="bg2" width="45%"', '<select name="targetgroup[' . $key . ']">' . $targetoption . '</select>')), 'bg1'); } show_table_footer(); echo '<br/>'; show_table_header(); show_table_row(array(array('colspan="3"', lang('config_extcredits'))), 'header title'); //vot show_table_row(array(lang('config_from_credit'), array('class="bg1" width="10%" align="center"', '->'), lang('config_target_credit'))); show_table_row(array(array('class="bg2" width="45%"', lang('config_credit')), array('class="bg1" width="10%" align="center"', '->'), array('class="bg2" width="45%"', '<select name="extcredits[credit]">' . $extcredits . '</select>')), 'bg1'); show_table_row(array(array('class="bg2" width="45%"', lang('config_experience')), array('class="bg1" width="10%" align="center"', '->'), array('class="bg2" width="45%"', '<select name="extcredits[experience]">' . $extcredits . '</select>')), 'bg1'); show_table_footer(); echo '<br/>'; show_table_header(); show_table_row(array(array('colspan="3"', lang('config_convert_forum'))), 'header title'); //vot show_table_row(array(lang('config_from_data'), array('class="bg1" width="10%" align="center"', '->'), lang('config_target_forum'))); show_table_row(array(array('class="bg2" width="45%"', lang('config_poll')), array('class="bg1" width="10%" align="center"', '->'), array('class="bg2" width="45%"', '<select name="forum[poll]"><option value="0" selected>' . lang('config_auto_create') . '</option>' . $forumoption . '</select>')), 'bg1'); show_table_row(array(array('class="bg2" width="45%"', lang('config_event')), array('class="bg1" width="10%" align="center"', '->'), array('class="bg2" width="45%"', '<select name="forum[event]"><option value="0" selected>' . lang('config_auto_create') . '</option>' . $forumoption . '</select>')), 'bg1'); show_table_footer(); show_form_footer('submit', 'config_convert'); exit; }
$table_source = str_replace('.php', '', $db_source->tablepre . $entry); $source_exist = $db_source->result_first("SHOW TABLES LIKE '" . substr($table_source, strpos($table_source, '.') + 1) . "'"); if (empty($source_exist)) { continue; } } $tablelist[] = $entry; } } $cdir->close(); if ($tablelist) { sort($tablelist); show_table_row(array('<span style="float: left">数据表转换程序</span>'), 'bg1'); echo "<tr class=bg2><td colspan=2>\n<ul id=\"ulist\">"; foreach ($tablelist as $entry) { echo "<li><label><input type=\"checkbox\" class=\"checkbox\" name=\"prgs[]\" value=\"{$entry}\" checked> " . basename($entry, '.php') . "</label></li>"; } echo "</ul>\n</td></tr>"; } if ($setting['steps']) { show_table_row(array('其他辅助转换程序'), 'bg1'); echo "<tr class=bg2><td colspan=2>\n<ul id=\"ulist\">"; foreach ($setting['steps'] as $key => $value) { echo "<li><label><input type=\"checkbox\" class=\"checkbox\" name=\"prgs[]\" value=\"s_prg_{$key}.php\" checked> {$key}({$value})</label></li>"; } echo "</ul>\n</td></tr>"; } show_table_footer(); show_form_footer('submit', '开始转换'); showfooter(); exit;
<?php $datadir = DISCUZ_ROOT . './source/'; showtips('<li><strong>在开始转换之前,请确保本程序目录下的 data 目录为可写权限,否则无法存储转换设置</strong></li><li><strong>如果有Discuz!和UChome同时需要升级,请务必先升级Discuz!论坛</strong></li><li>请正确选择转换程序,否则可能造成无法转换成功</li><li>本转换程序不会破坏原始数据,所以转换需要2倍于原始数据空间</li>'); if (is_dir($datadir)) { $cdir = dir($datadir); show_table_header(); show_table_row(array('原始版本', '目标版本', array('width="50%"', '简介'), array('width="5%"', '说明'), array('width="5%"', '设置'), array('width="5%"', '')), 'header title'); while (($entry = $cdir->read()) !== false) { if ($entry != '.' && $entry != '..' && is_dir($datadir . $entry)) { $settingfile = $datadir . $entry . '/setting.ini'; $readmefile = $datadir . $entry . '/readme.txt'; $readme = file_exists($readmefile) ? '<a target="_blank" href="source/' . $entry . '/readme.txt">查看</a>' : ''; if (file_exists($settingfile) && ($setting = loadsetting($entry))) { $trclass = $trclass == 'bg1' ? 'bg2' : 'bg1'; show_table_row(array($setting['program']['source'], $setting['program']['target'], $setting['program']['introduction'], array('align="center"', $readme), array('align="center"', '<a href="index.php?a=setting&source=' . rawurlencode($entry) . '">修改</a>'), array('align="center"', '<a href="index.php?a=config&source=' . rawurlencode($entry) . '">开始</a>')), $trclass); } } } $cdir->close(); show_table_footer(); } else { showmessage('config_child_error'); }
echo "</ul>\n</td></tr>"; } $tablelist = array(); $cdir = dir($prgdir); while (($entry = $cdir->read()) !== false) { if ($entry != '.' && $entry != '..' && is_file($prgdir . $entry)) { $tablelist[] = $entry; } } $cdir->close(); if ($tablelist) { sort($tablelist); show_table_row(array('<span style="float: left">' . lang('update', 'table_convert') . '</span>'), 'bg1'); echo "<tr class=bg2><td colspan=2>\n<ul id=\"ulist\">"; foreach ($tablelist as $entry) { echo "<li><label><input type=\"checkbox\" class=\"checkbox\" name=\"prgs[]\" value=\"{$entry}\" checked> " . basename($entry, '.php') . "</label></li>"; } echo "</ul>\n</td></tr>"; } if ($setting['steps']) { show_table_row(array(lang('update', 'other_convert')), 'bg1'); echo "<tr class=bg2><td colspan=2>\n<ul id=\"ulist\">"; foreach ($setting['steps'] as $key => $value) { echo "<li><label><input type=\"checkbox\" class=\"checkbox\" name=\"prgs[]\" value=\"s_prg_{$key}.php\" checked> {$key}({$value})</label></li>"; } echo "</ul>\n</td></tr>"; } show_table_footer(); show_form_footer('submit', lang('update', 'start_conversion')); showfooter(); exit;
$table_source = str_replace('.php', '', $db_source->tablepre . $entry); $source_exist = $db_source->result_first("SHOW TABLES LIKE '" . substr($table_source, strpos($table_source, '.') + 1) . "'"); if (empty($source_exist)) { continue; } } $tablelist[] = $entry; } } $cdir->close(); if ($tablelist) { sort($tablelist); show_table_row(array('<span style="float: left">數據表轉換程序</span>'), 'bg1'); echo "<tr class=bg2><td colspan=2>\n<ul id=\"ulist\">"; foreach ($tablelist as $entry) { echo "<li><label><input type=\"checkbox\" class=\"checkbox\" name=\"prgs[]\" value=\"{$entry}\" checked> " . basename($entry, '.php') . "</label></li>"; } echo "</ul>\n</td></tr>"; } if ($setting['steps']) { show_table_row(array('其他輔助轉換程序'), 'bg1'); echo "<tr class=bg2><td colspan=2>\n<ul id=\"ulist\">"; foreach ($setting['steps'] as $key => $value) { echo "<li><label><input type=\"checkbox\" class=\"checkbox\" name=\"prgs[]\" value=\"s_prg_{$key}.php\" checked> {$key}({$value})</label></li>"; } echo "</ul>\n</td></tr>"; } show_table_footer(); show_form_footer('submit', '開始轉換'); showfooter(); exit;