function getstatistics() { global $_SGLOBAL, $_SC, $_SCONFIG; $dbsize = 0; $query = $_SGLOBAL['db']->query("SHOW TABLE STATUS LIKE '{$_SC['tablepre']}%'", 'SILENT'); while ($table = $_SGLOBAL['db']->fetch_array($query)) { $dbsize += $table['Data_length'] + $table['Index_length']; } $sitekey = trim($_SCONFIG['sitekey']); if (empty($sitekey)) { $sitekey = mksitekey(); $_SGLOBAL['db']->query("REPLACE INTO " . tname('settings') . " (variable, value) VALUES ('sitekey', '{$sitekey}')"); include_once S_ROOT . './function/cache.func.php'; updatesettingcache(); } $statistics = array('sitekey' => $sitekey, 'version' => S_VER, 'release' => S_RELEASE, 'php' => PHP_VERSION, 'mysql' => $_SGLOBAL['db']->result($_SGLOBAL['db']->query("SELECT VERSION()"), 0), 'dbsize' => $dbsize, 'charset' => $_SC['charset'], 'sitename' => preg_replace('/[\'\\"\\s]/s', '', $_SCONFIG['sitename']), 'adnum' => getcount('ads', array()), 'announcementnum' => getcount('announcements', array()), 'attachmentnum' => getcount('attachments', array()), 'forumnum' => getcount('forums', array()), 'categorynum' => getcount('categories', array()), 'channelnum' => getcount('channels', array()), 'friendlinknum' => getcount('friendlinks', array()), 'membernum' => getcount('members', array()), 'modelnum' => getcount('models', array()), 'pollnum' => getcount('polls', array()), 'reportnum' => getcount('reports', array()), 'robotnum' => getcount('robots', array()), 'spacecommentnum' => getcount('spacecomments', array()), 'spaceitemnum' => getcount('spaceitems', array()), 'tagnum' => getcount('tags', array()), 'usergroupnum' => getcount('usergroups', array())); $statistics['update'] = rawurlencode(serialize($statistics)) . '&h=' . substr(md5($_SERVER['HTTP_USER_AGENT'] . '|' . implode('|', $statistics)), 8, 8); return $statistics; }
$_SGLOBAL['db']->query("TRUNCATE TABLE " . tname('crons')); $_SGLOBAL['db']->query("INSERT INTO " . tname('crons') . " (available, type, name, filename, lastrun, nextrun, weekday, day, hour, minute) VALUES (" . implode('),(', $datas) . ")"); //styles $datas = array("'系统分类名称列表', '显示数据: 系统分类名\r\n显示方式: 以 <li>名称</li> 的方式循环显示', 'category', 'name_li'", "'资讯标题列表', '显示数据: 资讯标题\r\n显示方式: 以 <li>标题</li> 的方式循环显示', 'spacenews', 'subject_li'", "'模型文章标题列表', '显示数据: 模型标题\r\n显示方式: 以 <li>标题</li> 的方式循环显示', 'model', 'subject_li'", "'投票表单', '显示数据: 投票表单\r\n显示方式: 以 <form>投票具体选项</form> 的方式循环显示', 'poll', 'poll_form'", "'TAG名列表', '显示数据: TAG名\r\n显示方式: 以 <li>TAG名</li> 的方式循环显示', 'tag', 'tagname_li'", "'文章标题列表', '显示数据: 信息标题、作者\r\n显示方式: 以 <li>标题(作者)</li> 的方式循环显示', 'spacetag', 'subject_username_li'", "'回复内容列表', '显示数据: 标题、内容\r\n显示方式: 以 <li><p>标题</p><p>内容</p></li> 的方式循环显示', 'spacecomment', 'subject_message_li'", "'公告标题列表', '显示数据: 标题\r\n显示方式: 以 <li>标题</li> 的方式循环显示', 'announcement', 'subject_li'", "'友情链接名列表', '显示数据: 标题\r\n显示方式: 以 <li>标题</li> 的方式循环显示', 'friendlink', 'name_li'", "'主题列表', '显示数据: 标题\r\n显示方式: 以 <li>标题</li> 的方式循环显示', 'bbsthread', 'subject_li'", "'论坛公告列表', '显示数据: 标题\r\n显示方式: 以 <li>标题</li> 的方式循环显示', 'bbsannouncement', 'subject_li'", "'论坛版块名列表', '显示数据: 版块名\r\n显示方式: 以 <li>版块名</li> 的方式循环显示', 'bbsforum', 'name_li'", "'友情链接名列表', '显示数据: 链接名\r\n显示方式: 以 <li>链接名</li> 的方式循环显示', 'bbslink', 'name_li'", "'会员名列表', '显示数据: 会员名\r\n显示方式: 以 <li>会员名</li> 的方式循环显示', 'bbsmember', 'username_li'", "'附件名列表', '显示数据: 附件名\r\n显示方式: 以 <li>附件名</li> 的方式循环显示', 'bbsattachment', 'filename_li'", "'帖子内容列表', '显示数据: 标题、内容(包含附件)\r\n显示方式: 以 <li><p>标题</p><p>内容</p></li> 的方式循环显示', 'bbspost', 'post_subject_message_li'"); $_SGLOBAL['db']->query("TRUNCATE TABLE " . tname('styles')); $_SGLOBAL['db']->query("INSERT INTO " . tname('styles') . " (tplname, tplnote, tpltype, tplfilepath) VALUES (" . implode('),(', $datas) . ")"); //usergroups $datas = array("'1', '管理员', '0', '1', '0', '1', '1', '1', '1', '1', '1', '1', '1', '1', '1', '1', '1', '1', '1', '1', '1', '1', '1', '1', '1', '1', '1', '1', '1', '1', '1', '1', '1', '1', '1', '1', '1', '1', '1', '1', '1', '1', '1', '1', '1', '1', '0', '1', '1'", "'2', '普通用户组', '0', '1', '1', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '1', '0', '0', '0', '1', '0', '0'"); $_SGLOBAL['db']->query("TRUNCATE TABLE " . tname('usergroups')); $_SGLOBAL['db']->query("INSERT INTO " . tname('usergroups') . " (groupid, grouptitle, system, managespacenews, needcheck, managerobots, managerobotmessages, managecategories, managesettings, manageusergroups, manageannouncements, managead, manageblocks, managebbs, managebbsforums, managethreads, manageuchome, managemodels, managechannel, managemember, managedelmembers, managehtml, managecache, managewords, manageattachmenttypes, managedatabase, managetpl, managecrons, managecheck, managecss, managefriendlinks, manageprefields, managesitemap, manageitems, managecomments, manageattachments, managetags, managereports, managepolls, managecustomfields, managestyles, managestyletpl, managemodelmanages, managemodelfolders, managemodelcategories, allowundelete, modelneedcheck, allowmodelundelete, closeignore) " . " VALUES (" . implode('),(', $datas) . ")"); show_msg('系统默认数据添加完毕,进入下一步操作', $step + 1, 1); } elseif ($step == 5) { //更新缓存 dbconnect(); include_once S_ROOT . './function/cache.func.php'; updatesettingcache(); //用户组缓存 updategroupcache(); //广告缓存 updateadcache(); //crons列表 updatecronscache(); //计划任务 updatecroncache(); //分类 updatecategorycache(); //缓存语言屏蔽 updatecensorcache(); $msg = <<<EOF \t<form method="post" action="{$theurl}"> \t<table>
function brandinformation() { global $_G, $_SGLOBAL, $_SERVER; if (empty($_G['setting']['siteuniqueid']) || bstrlen($_G['setting']['siteuniqueid']) < 8 || strpos($_G['setting']['siteuniqueid'], 'PK') !== 0) { $_G['setting']['siteuniqueid'] = DB::result_first('SELECT value FROM ' . tname('settings') . " WHERE variable='siteuniqueid'"); if (empty($_G['setting']['siteuniqueid']) || bstrlen($_G['setting']['siteuniqueid']) < 8 || strpos($_G['setting']['siteuniqueid'], 'PK') !== 0) { $chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyz'; $_G['setting']['siteuniqueid'] = 'PK' . $chars[date('y') % 60] . $chars[date('n')] . $chars[date('j')] . $chars[date('G')] . $chars[date('i')] . $chars[date('s')] . substr(md5($_G['clientip'] . $_G['username'] . $_G['timestamp']), 0, 4) . random(4); DB::query('REPLACE INTO ' . tname('settings') . " (variable, value) VALUES ('siteuniqueid', '{$_G['setting']}[siteuniqueid]')"); require_once B_ROOT . './source/function/cache.func.php'; updatesettingcache(); } } $update = array('id' => $_G['setting']['siteuniqueid'], 'version' => B_VER, 'release' => B_RELEASE, 'php' => PHP_VERSION, 'mysql' => DB::version(), 'charset' => $_G['charset'], 'siteurl' => $_G['setting']['siteurl'], 'sitename' => $_G['setting']['wwwname'] . '->' . $_G['setting']['sitename'], 'email' => $_G['member']['email']); $updatetime = @filemtime(B_ROOT . './data/updatetime.lock'); if (empty($updatetime) || $_G['timestamp'] - $updatetime > 3600 * 4) { @touch(B_ROOT . './data/updatetime.lock'); $update['members'] = DB::result_first('SELECT COUNT(*) FROM ' . tname('members')); $update['shops'] = DB::result_first('SELECT COUNT(*) FROM ' . tname('shopitems')); $update['discounts'] = DB::result_first('SELECT COUNT(*) FROM ' . tname('shopitems') . " WHERE isdiscount='1'"); $update['goods'] = DB::result_first('SELECT COUNT(*) FROM ' . tname('gooditems')); $update['notices'] = DB::result_first('SELECT COUNT(*) FROM ' . tname('noticeitems')); $update['consumes'] = DB::result_first('SELECT COUNT(*) FROM ' . tname('consumeitems')); $update['albums'] = DB::result_first('SELECT COUNT(*) FROM ' . tname('albumitems')); $update['albumsbbs'] = DB::result_first('SELECT COUNT(*) FROM ' . tname('albumitems') . " WHERE frombbs='1'"); $update['photos'] = DB::result_first('SELECT COUNT(*) FROM ' . tname('photoitems')); $update['comments'] = DB::result_first('SELECT COUNT(*) FROM ' . tname('spacecomments')); $update['commentscores'] = DB::result_first('SELECT COUNT(*) FROM ' . tname('commentscores')); $update['links'] = DB::result_first('SELECT COUNT(*) FROM ' . tname('brandlinks')); $update['reportlog'] = DB::result_first('SELECT COUNT(*) FROM ' . tname('reportlog')); foreach (array('shop', 'good', 'notice', 'consume', 'album') as $value) { $update[$value . 'cates'] = count($_SGLOBAL[$value . 'cates']); } } $data = ''; foreach ($update as $key => $value) { $data .= $key . '=' . rawurlencode($value) . '&'; } return 'os=pk&update=' . rawurlencode(base64_encode($data)) . '&md5hash=' . substr(md5($_SERVER['HTTP_USER_AGENT'] . implode('', $update) . $_G['timestamp']), 8, 8) . '×tamp=' . $_G['timestamp']; }