<?php require dirname(__FILE__).'/data/config.inc.php'; require dirname(__FILE__).'/lib/db.class.php'; $db = new ucserver_db(); $db->connect(UC_DBHOST, UC_DBUSER, UC_DBPW, UC_DBNAME, UC_DBCHARSET, UC_DBCONNECT, UC_DBTABLEPRE); $nomatch = true; $applist = $db->fetch_all("SELECT appid, name FROM ".UC_DBTABLEPRE."applications"); $table_columns = loadtable('notelist'); foreach($applist as $app) { $appid = $app['appid']; if(empty($appid)) continue; if(!isset($table_columns['app'.$appid])) { $nomatch = false; if($db->query("ALTER TABLE ".UC_DBTABLEPRE."notelist ADD COLUMN app$appid tinyint NOT NULL")) { echo "补充notelist表字段成功: $appid <br />"; } else { echo "补充notelist表字段失败,请刷新重试<br />"; } } } if($nomatch) { echo '没有需要补充的字段<br />'; } if(!unlink(__FILE__)) {
echo "<script>setTimeout(\"redirect('{$url_forward}');\", 1250);</script>"; } else { echo "Entering the short message other data Processing"; $url_forward = "upgrade_1.5.2_1.6.0.php?action=pmstats&forward=" . urlencode($forward); echo "<br /><br /><br /><a href=\"{$url_forward}\">Browser will automatically reload the page, without human intervention. If your browser does not redirect for a long time, please click here</a>"; echo "<script>setTimeout(\"redirect('{$url_forward}');\", 1250);</script>"; } } else { @touch($lock_file); echo "<font style='font-size:20px;'>The upgrade is completed</font>.<br>Original short message form (" . UC_DBTABLEPRE . "pms Table) No longer in use, we recommend that you test the function of short message and data is no problem, delete the table.<br>Will advanced/uc_client The file overwrite your uc_client Client."; } showfooter(); } elseif ($action == 'pmstats') { showheader(); echo "<h4>Processing Other short message data</h4>"; $db = new ucserver_db(); $db->connect(UC_DBHOST, UC_DBUSER, UC_DBPW, UC_DBNAME, UC_DBCHARSET); $total = getgpc('total'); $start = getgpc('start') ? getgpc('start') : 0; $limit = 1000; $next = 0; if (!$total) { $total = $db->result_first("SELECT MAX(plid) FROM " . UC_DBTABLEPRE . "pm_lists"); } if ($total) { $query = $db->query("SELECT * FROM " . UC_DBTABLEPRE . "pm_lists WHERE plid>'{$start}' ORDER BY plid LIMIT {$limit}"); while ($data = $db->fetch_array($query)) { $next = $data['plid']; $users = explode('_', $data['min_max']); $pmsarr = $db->fetch_first("SELECT * FROM " . UC_DBTABLEPRE . "pms WHERE msgfromid IN ('{$users['0']}','{$users['1']}') AND msgtoid IN ('{$users['0']}', '{$users['1']}') ORDER BY dateline DESC LIMIT 1"); $pmsarr['msgfrom'] = addslashes($pmsarr['msgfrom']);
} } $random = $match[1]; }; $dump_file = UC_ROOT.'./data/upgsecques/secques_'.$random.'_'.$num.'.sql'; if(!file_exists($dump_file)) {//note 升级完毕 @touch($lock_file); dir_clear(UC_ROOT.'./data/upgsecques'); setcookie('uc_authcode', ''); showheader(); echo '安全提问升级完成,感谢您使用本程序'; } else { showheader(); $sql = file_get_contents($dump_file); $db = new ucserver_db(); $db->connect(UC_DBHOST, UC_DBUSER, UC_DBPW, UC_DBNAME, UC_DBCHARSET); runquery($sql); $num++; echo "安全提问正在导入"; $url_forward = "upgrade_1.0.0_1.5.0.php?action=upgsecques&num=$num&random=$random"; echo "<br /><br /><br /><a href=\"$url_forward\">浏览器会自动跳转页面,无需人工干预。除非当您的浏览器长时间没有自动跳转时,请点击这里</a>"; echo "<script>setTimeout(\"redirect('$url_forward');\", 1250);</script>"; } showfooter(); } function dir_clear($dir) { $directory = dir($dir);