function pick_count() { //clear_pick_cache(1);//缓存定期清理 //clear_search_index(1);//清除索引 clear_log(1); //清除日志 pload('C:cache'); $arr['search_index']['name'] = milu_lang('rules_search_index'); $arr['search_index']['msg'] = milu_lang('search_index_notice'); $arr['search_index']['show'] = '<span style=" width:120px; float:left">' . milu_lang('search_index_c') . '<hr>'; $type_arr = array('1' => milu_lang('fast_pick_rules'), '2' => milu_lang('dxc_system_rules'), '3' => milu_lang('fastpick_evo')); $type_arr2 = array('3' => milu_lang('server_'), '4' => milu_lang('local_')); foreach ($type_arr as $k => $v) { foreach ($type_arr2 as $k2 => $v2) { $type = $k . $k2; $show_name = '<span style=" width:120px; float:left">' . $type_arr[$k] . $type_arr2[$k2] . '</span>'; $search_index_count = DB::result(DB::query("SELECT COUNT(*) FROM " . DB::table('strayer_searchindex') . " WHERE type='{$type}'"), 0); $arr['search_index']['show'] .= $show_name . ' ' . $search_index_count . '<br />'; } } $log_info = IO::info(PICK_DIR . '/data/log'); $arr['log']['name'] = milu_lang('log_size'); $arr['log']['msg'] = milu_lang('auto_pick_notice'); $arr['log']['show'] = sizecount($log_info['size']); $cache_info = IO::info(PICK_CACHE, 1, 1); $arr['cache']['name'] = milu_lang('cache_file_size'); $arr['cache']['show'] = milu_lang('cache_size_value', array('s' => sizecount($cache_info['size']), 'p' => PICK_CACHE_SIZE)); $arr['cache']['msg'] = milu_lang('cache_notice'); return $arr; }
function getattach_row($attach, &$attachs, &$imgattachs) { global $_G; $attach['filename'] = cutstr($attach['filename'], $_G['setting']['allowattachurl'] ? 25 : 30); $attach['attachsize'] = sizecount($attach['filesize']); $attach['dateline'] = dgmdate($attach['dateline']); $attach['filetype'] = attachtype($attach['ext'] . "\t" . $attach['filetype']); if ($attach['isimage'] < 1) { if ($attach['isimage']) { $attach['url'] = $attach['remote'] ? $_G['setting']['ftp']['attachurl'] : $_G['setting']['attachurl']; $attach['width'] = $attach['width'] > 300 ? 300 : $attach['width']; } if ($attach['pid']) { $attachs['used'][] = $attach; } else { $attachs['unused'][] = $attach; } } else { $attach['url'] = ($attach['remote'] ? $_G['setting']['ftp']['attachurl'] : $_G['setting']['attachurl']) . '/forum'; $attach['width'] = $attach['width'] > 300 ? 300 : $attach['width']; if ($attach['pid']) { $imgattachs['used'][] = $attach; } else { $imgattachs['unused'][] = $attach; } } }
function dbbackup() { // 加载数据库工具类 $this->load->dbutil(); // 备份整个数据库并将其赋值给一个变量 $backup =& $this->dbutil->backup(); // 加载文件辅助函数并将文件写入你的服务器 $this->load->helper('file'); $path = dirname(BASEPATH) . DIRECTORY_SEPARATOR . 'upload' . DIRECTORY_SEPARATOR . 'dbbackup' . DIRECTORY_SEPARATOR . date('Y.m.d_H.i.s') . '_smart.zip'; $relpath = str_replace(dirname(BASEPATH), "", $path); $writeResult = write_file($path, $backup); if ($writeResult && file_exists($path)) { $path_parts = pathinfo($path); $fileName = $path_parts["basename"]; $size = filesize($path); $this->load->model('dbbackup_model'); $data = array('uid' => $this->tank_auth->get_user_id(), 'fileName' => $fileName, 'fileSize' => $size, 'path' => $relpath, 'backupdate' => time()); $id = $this->dbbackup_model->addRes($data); $delString = '<a class="backup_dld" href="#">下载</a> ' . '<input type="hidden" id="backup_del_' . $id . '" name="backup_del_' . $id . '" value="' . $id . '">' . '<a class="backup_delete" href="#">删除</a>'; $jsonData = array('uid' => $this->tank_auth->get_user_id(), 'fileName' => $fileName, 'fileSize' => sizecount($size), 'path' => $relpath, 'backupdate' => date('Y-m-d H:i:s', time()), 'opt' => $delString); echo '{"result":"true","msg":' . json_encode($jsonData) . '}'; } else { echo '{"result":"false","msg":"' . lang('admin_tools_add_backup_failed') . '"}'; } }
public function right() { $this->member_db = pc_base::load_model('member_model'); $this->messagequeue_db = pc_base::load_model('messagequeue_model'); $total_member = $this->member_db->count(); //会员总数 $todaytime = strtotime(date('Y-m-d', SYS_TIME)); //今日会员数 $today_member = $this->member_db->count("`regdate` > '{$todaytime}'"); $total_messagequeue = $this->messagequeue_db->count(); //消息总数 $mysql_version = $this->member_db->get_version(); //mysql版本 $mysql_table_status = $this->member_db->get_table_status(); $mysql_table_size = $mysql_table_index_size = ''; foreach ($mysql_table_status as $table) { $mysql_table_size += $table['Data_length']; $mysql_table_index_size += $table['Index_length']; } $mysql_table_size = sizecount($mysql_table_size); $mysql_table_index_size = sizecount($mysql_table_index_size); //应用个数 $applist = getcache('applist'); $appnum = empty($applist) ? 0 : count($applist); include $this->admin_tpl('right'); }
function parseattach($attachpids, $attachtags, &$postlist, $showimages = 1, $skipaids = array()) { global $db, $tablepre, $discuz_uid, $skipaidlist, $readaccess, $attachlist, $attachimgpost, $maxchargespan, $timestamp, $forum, $ftp, $attachurl, $dateformat, $timeformat, $timeoffset, $hideattach, $thread, $tradesaids, $trades, $exthtml, $tagstatus, $sid, $authkey, $exempt; $query = $db->query("SELECT a.*, af.description, ap.aid AS payed FROM {$tablepre}attachments a LEFT JOIN {$tablepre}attachmentfields af ON a.aid=af.aid LEFT JOIN {$tablepre}attachpaymentlog ap ON ap.aid=a.aid AND ap.uid='{$discuz_uid}' WHERE a.pid IN ({$attachpids})"); $attachexists = FALSE; while ($attach = $db->fetch_array($query)) { $attachexists = TRUE; $exthtml = ''; if ($skipaids && in_array($attach['aid'], $skipaids)) { continue; } $attached = 0; $extension = strtolower(fileext($attach['filename'])); $attach['ext'] = $extension; $attach['attachicon'] = attachtype($extension . "\t" . $attach['filetype']); $attach['attachsize'] = sizecount($attach['filesize']); $attach['attachimg'] = $showimages && $attachimgpost && $attach['isimage'] && (!$attach['readperm'] || $readaccess >= $attach['readperm']) ? 1 : 0; if ($attach['price']) { if ($maxchargespan && $timestamp - $attach['dateline'] >= $maxchargespan * 3600) { $db->query("UPDATE {$tablepre}attachments SET price='0' WHERE aid='{$attach['aid']}'"); $attach['price'] = 0; } else { if (!$discuz_uid || !$forum['ismoderator'] && $attach['uid'] != $discuz_uid && !$attach['payed']) { $attach['unpayed'] = 1; } } } $exemptattachpay = $exempt & 8 ? 1 : 0; $attach['payed'] = $attach['payed'] || $forum['ismoderator'] || $attach['uid'] == $discuz_uid ? 1 : 0; $attach['url'] = $attach['remote'] ? $ftp['attachurl'] : $attachurl; $attach['dateline'] = dgmdate("{$dateformat} {$timeformat}", $attach['dateline'] + $timeoffset * 3600); $postlist[$attach['pid']]['attachments'][$attach['aid']] = $attach; if (is_array($attachtags[$attach['pid']]) && in_array($attach['aid'], $attachtags[$attach['pid']])) { $findattach[$attach['pid']][] = "/\\[attach\\]{$attach['aid']}\\[\\/attach\\]/i"; $replaceattach[$attach['pid']][] = $hideattach[$attach['pid']] ? '[attach]***[/attach]' : attachtag($attach['pid'], $attach['aid'], $postlist); $attached = 1; } if (!$attached || $attach['unpayed']) { if ($attach['isimage']) { $postlist[$attach['pid']]['imagelist'] .= attachlist($attach); } else { if (!$skipaidlist || !in_array($attach['aid'], $skipaidlist)) { $postlist[$attach['pid']]['attachlist'] .= attachlist($attach); } } } } if ($attachexists) { foreach ($attachtags as $pid => $aids) { if ($findattach[$pid]) { $postlist[$pid]['message'] = preg_replace($findattach[$pid], $replaceattach[$pid], $postlist[$pid]['message'], 1); $postlist[$pid]['message'] = preg_replace($findattach[$pid], '', $postlist[$pid]['message']); } } } else { $db->query("UPDATE {$tablepre}posts SET attachment='0' WHERE pid IN ({$attachpids})", 'UNBUFFERED'); } }
function parseattach($attachpids, $attachtags, &$postlist, $skipaids = array()) { global $_G; $query = DB::query("SELECT a.*, af.description, l.relatedid AS payed\n\t\tFROM " . DB::table('forum_attachment') . " a\n\t\tLEFT JOIN " . DB::table('forum_attachmentfield') . " af ON a.aid=af.aid\n\t\tLEFT JOIN " . DB::table('common_credit_log') . " l ON l.relatedid=a.aid AND l.uid='{$_G['uid']}' AND l.operation='BAC'\n\t\tWHERE a.pid IN ({$attachpids})"); $attachexists = FALSE; while ($attach = DB::fetch($query)) { $attachexists = TRUE; if ($skipaids && in_array($attach['aid'], $skipaids)) { continue; } $attached = 0; $extension = strtolower(fileext($attach['filename'])); $attach['ext'] = $extension; $attach['attachicon'] = attachtype($extension . "\t" . $attach['filetype']); $attach['attachsize'] = sizecount($attach['filesize']); $attach['attachimg'] = $_G['setting']['attachimgpost'] && $attach['isimage'] && (!$attach['readperm'] || $_G['group']['readaccess'] >= $attach['readperm']) ? 1 : 0; if ($attach['price']) { if ($_G['setting']['maxchargespan'] && TIMESTAMP - $attach['dateline'] >= $_G['setting']['maxchargespan'] * 3600) { DB::query("UPDATE " . DB::table('forum_attachment') . " SET price='0' WHERE aid='{$attach['aid']}'"); $attach['price'] = 0; } else { if (!$_G['uid'] || !$_G['forum']['ismoderator'] && $attach['uid'] != $_G['uid'] && !$attach['payed']) { $attach['unpayed'] = 1; } } } $exemptattachpay = $_G['group']['exempt'] & 8 ? 1 : 0; $attach['payed'] = $attach['payed'] || $_G['forum']['ismoderator'] || $attach['uid'] == $_G['uid'] ? 1 : 0; $attach['url'] = ($attach['remote'] ? $_G['setting']['ftp']['attachurl'] . '/' : $_G['setting']['attachurl']) . 'forum/'; $attach['dateline'] = dgmdate($attach['dateline'], 'u'); $postlist[$attach['pid']]['attachments'][$attach['aid']] = $attach; if (!empty($attachtags[$attach['pid']]) && is_array($attachtags[$attach['pid']]) && in_array($attach['aid'], $attachtags[$attach['pid']])) { $findattach[$attach['pid']][] = "/\\[attach\\]{$attach['aid']}\\[\\/attach\\]/i"; $replaceattach[$attach['pid']][] = attachtag($attach['pid'], $attach['aid'], $postlist); $attached = 1; } if (!$attached) { if ($attach['isimage']) { $postlist[$attach['pid']]['imagelist'] .= attachlist($attach); } else { if (!$_G['forum_skipaidlist'] || !in_array($attach['aid'], $_G['forum_skipaidlist'])) { $postlist[$attach['pid']]['attachlist'] .= attachlist($attach); } } } } if ($attachexists) { foreach ($attachtags as $pid => $aids) { if ($findattach[$pid]) { $postlist[$pid]['message'] = preg_replace($findattach[$pid], $replaceattach[$pid], $postlist[$pid]['message'], 1); $postlist[$pid]['message'] = preg_replace($findattach[$pid], '', $postlist[$pid]['message']); } } } else { updatepost(array('attachment' => '0'), "pid IN ({$attachpids})", true); } }
public static function gettablestatus($tablename, $formatsize = true) { $status = DB::fetch_first("SHOW TABLE STATUS LIKE '" . str_replace('_', '\\_', $tablename) . "'"); if ($formatsize) { $status['Data_length'] = sizecount($status['Data_length']); $status['Index_length'] = sizecount($status['Index_length']); } return $status; }
public function ajax_clear() { /*写入应用列表缓存*/ $applist = $this->applications_db->listinfo('', '', 1, 100, 'appid'); setcache('applist', $applist); $applistinfo = getcacheinfo('applist'); $return['filesize'] = sizecount($applistinfo['filesize']); $return['filemtime'] = date('Y-m-d H:i:s', $applistinfo['filemtime']); exit(json_encode($return)); }
function forumdisplay_thread_subject_output() { global $_G; $tids = ""; $arr = array(); $j = 0; foreach ($_G['forum_threadlist'] as $v) { $arr[$j]['tid'] = $v['tid']; $tids .= "," . $v['tid']; $j++; } $tids = substr($tids, 1); if ($tids == "") { $tids = "0"; } $query = DB::query("select tid,seeds,leechers,finished,size from " . DB::table('xbtit_files') . " where tid in ({$tids})"); while ($row = DB::fetch($query)) { for ($i = 0; $i < count($arr); $i++) { if ($row['tid'] == $arr[$i]['tid']) { $arr[$i]['seeds'] = $row['seeds']; break; } } } foreach ($arr as $row) { if ($row['seeds'] == "") { $return[] = ""; } else { $size = sizecount($row['size']); include './xbt/config.inc.php'; $tid = $row['tid']; $query = DB::query("select displayorder,highlight,digest from " . DB::table('forum_thread') . " where tid= ({$tid})"); $rs = DB::fetch($query); if ($rs['displayorder'] > 0 or $rs['digest'] > 0 or $rs['highlight'] > 0) { if ($rs['displayorder'] > 0) { $up = $upload_weight['top']; $down = $down_weight['top'] * 100; } elseif ($rs['digest'] > 0) { $up = $upload_weight['digest']; $down = $down_weight['digest'] * 100; } else { $up = $upload_weight['highlight']; $down = $down_weight['highlight'] * 100; } $return[] = "[<span style='color:#F00;'>↓{$down}%</span> <span style='color:#00F;'>↑{$up}x</span>]"; } else { $return[] = ""; } } } return $return; }
function getattach($pid, $posttime = 0) { global $_G; require_once libfile('function/attachment'); $attachs = $imgattachs = array(); $sqladd1 = $posttime > 0 ? "AND a.dateline>'{$posttime}'" : ''; $sqladd2 = $pid > 0 ? "OR a.pid='{$pid}'" : ''; $query = DB::query("SELECT a.*, af.description\r\n\t\tFROM " . DB::table('forum_attachment') . " a\r\n\t\tLEFT JOIN " . DB::table('forum_attachmentfield') . " af USING(aid)\r\n\t\tWHERE (a.uid='{$_G['uid']}' AND a.tid='0' {$sqladd1}) {$sqladd2} ORDER BY a.aid DESC"); if (!empty($_G['fid']) && $_G['forum']['attachextensions']) { $allowext = str_replace(' ', '', $_G['forum']['attachextensions']); $allowext = explode(',', $allowext); } else { $allowext = ''; } while ($attach = DB::fetch($query)) { $attach['filenametitle'] = $attach['filename']; $attach['ext'] = fileext($attach['filename']); if ($allowext && !in_array($attach['ext'], $allowext)) { continue; } $attach['filename'] = cutstr($attach['filename'], $_G['setting']['allowattachurl'] ? 25 : 30); $attach['attachsize'] = sizecount($attach['filesize']); $attach['dateline'] = dgmdate($attach['dateline']); $attach['filetype'] = attachtype($attach['ext'] . "\t" . $attach['filetype']); if ($attach['isimage'] < 1) { if ($attach['isimage']) { $attach['url'] = $attach['remote'] ? $_G['setting']['ftp']['attachurl'] : $_G['setting']['attachurl']; $attach['width'] = $attach['width'] > 300 ? 300 : $attach['width']; } if ($attach['pid']) { $attachs['used'][] = $attach; } else { $attachs['unused'][] = $attach; } } else { $attach['url'] = ($attach['remote'] ? $_G['setting']['ftp']['attachurl'] : $_G['setting']['attachurl']) . '/forum'; $attach['width'] = $attach['width'] > 300 ? 300 : $attach['width']; if ($attach['pid']) { $imgattachs['used'][] = $attach; } else { $imgattachs['unused'][] = $attach; } } } return array('attachs' => $attachs, 'imgattachs' => $imgattachs); }
/** * swfupload上传附件 */ public function swfupload(){ $grouplist = getcache('grouplist','member'); if(isset($_POST['dosubmit'])){ if( $_POST['swf_auth_key'] != md5(pc_base::load_config('system','auth_key').$_POST['SWFUPLOADSESSID']) || ($_POST['isadmin']==0 && !$grouplist[$_POST['groupid']]['allowattachment'])) exit(); pc_base::load_sys_class('attachment','',0); $attachment = new attachment($_POST['module'],$_POST['catid'],$_POST['siteid']); $attachment->set_userid($_POST['userid']); $aids = $attachment->upload('Filedata',$_POST['filetype_post'],'','',array($_POST['thumb_width'],$_POST['thumb_height']),$_POST['watermark_enable']); if($aids[0]) { $filename= (strtolower(CHARSET) != 'utf-8') ? iconv('gbk', 'utf-8', $attachment->uploadedfiles[0]['filename']) : $attachment->uploadedfiles[0]['filename']; if($attachment->uploadedfiles[0]['isimage']) { echo $aids[0].','.$this->upload_url.$attachment->uploadedfiles[0]['filepath'].','.$attachment->uploadedfiles[0]['isimage'].','.$filename; } else { $fileext = $attachment->uploadedfiles[0]['fileext']; if($fileext == 'zip' || $fileext == 'rar') $fileext = 'rar'; elseif($fileext == 'doc' || $fileext == 'docx') $fileext = 'doc'; elseif($fileext == 'xls' || $fileext == 'xlsx') $fileext = 'xls'; elseif($fileext == 'ppt' || $fileext == 'pptx') $fileext = 'ppt'; elseif ($fileext == 'flv' || $fileext == 'swf' || $fileext == 'rm' || $fileext == 'rmvb') $fileext = 'flv'; else $fileext = 'do'; echo $aids[0].','.$this->upload_url.$attachment->uploadedfiles[0]['filepath'].','.$fileext.','.$filename; } exit; } else { echo '0,'.$attachment->error(); exit; } } else { if($this->isadmin==0 && !$grouplist[$this->groupid]['allowattachment']) showmessage(L('att_no_permission')); $args = $_GET['args']; $authkey = $_GET['authkey']; if(upload_key($args)!=$authkey) showmessage(L('attachment_parameter_error')); extract(getswfinit($_GET['args'])); $siteid = $this->get_siteid(); $site_setting = get_site_setting($siteid); $file_size_limit = sizecount($site_setting['upload_maxsize']*1024); $att_not_used = param::get_cookie('att_json'); if(empty($att_not_used) || !isset($att_not_used)) $tab_status = ' class="on"'; if(!empty($att_not_used)) $div_status = ' hidden'; //获取临时未处理文件列表 $att = $this->att_not_used(); include $this->admin_tpl('swfupload'); } }
function getswfattach($getcount = 1) { global $db, $tablepre, $discuz_uid, $dateformat, $timeformat, $timeoffset; require_once DISCUZ_ROOT . './include/attachment.func.php'; $swfattachs = array(); if ($getcount) { $swfattachs = $db->result_first("SELECT count(*) FROM {$tablepre}attachments WHERE tid='0' AND pid='0' AND uid='{$discuz_uid}' ORDER BY dateline"); } else { $query = $db->query("SELECT aid, filename, description, isimage, thumb, attachment, dateline, filesize, width FROM {$tablepre}attachments WHERE tid='0' AND pid='0' AND uid='{$discuz_uid}' ORDER BY dateline"); while ($swfattach = $db->fetch_array($query)) { $swfattach['filenametitle'] = $swfattach['filename']; $swfattach['filename'] = cutstr($swfattach['filename'], 30); $swfattach['attachsize'] = sizecount($swfattach['filesize']); $swfattach['dateline'] = gmdate("{$dateformat} {$timeformat}", $swfattach['dateline'] + $timeoffset * 3600); $swfattach['filetype'] = attachtype(fileext($swfattach['attachment']) . "\t" . $swfattach['filetype']); $swfattachs[] = $swfattach; } } return $swfattachs; }
public function index() { $m = new Model(); $list = $m->query("SHOW TABLE STATUS FROM " . "`" . C('DB_NAME') . "`"); $tables = array(); foreach ($list as $key => $val) { $tables[$key]['name'] = $val['Name']; //表名 $tables[$key]['rows'] = $val['Rows']; //记录数 $tables[$key]['engine'] = $val['Engine']; //引擎 $tables[$key]['data_length'] = sizecount($val['Data_length']); //表大小 $tables[$key]['create_time'] = $val['Create_time']; //表创建时间 $tables[$key]['collation'] = $val['Collation']; //编码类型 } $this->assign('list', $tables); $this->display(); }
function getattach($pid, $posttime = 0) { global $_G; require_once libfile('function/attachment'); $attachs = $imgattachs = array(); $sqladd1 = $posttime > 0 ? "AND a.dateline>'{$posttime}'" : ''; $sqladd2 = $pid > 0 ? "OR a.pid='{$pid}'" : ''; $query = DB::query("SELECT a.*, af.description\n\t\tFROM " . DB::table('forum_attachment') . " a\n\t\tLEFT JOIN " . DB::table('forum_attachmentfield') . " af ON a.aid=af.aid\n\t\tWHERE (a.uid='{$_G['uid']}' AND a.tid='0' {$sqladd1}) {$sqladd2} ORDER BY dateline"); while ($attach = DB::fetch($query)) { $attach['filenametitle'] = $attach['filename']; $attach['ext'] = fileext($attach['filename']); $attach['filename'] = cutstr($attach['filename'], $_G['setting']['allowattachurl'] ? 25 : 30); $attach['attachsize'] = sizecount($attach['filesize']); $attach['dateline'] = dgmdate($attach['dateline']); $attach['filetype'] = attachtype($attach['ext'] . "\t" . $attach['filetype']); if ($attach['isimage'] < 1) { if ($attach['isimage']) { $attach['url'] = $attach['remote'] ? $_G['setting']['ftp']['attachurl'] : $_G['setting']['attachurl']; $attach['width'] = $attach['width'] > 110 ? 110 : $attach['width']; } if ($attach['pid']) { $attachs['used'][] = $attach; } else { $attachs['unused'][] = $attach; } } else { $attach['url'] = ($attach['remote'] ? $_G['setting']['ftp']['attachurl'] : $_G['setting']['attachurl']) . '/forum'; $attach['width'] = $attach['width'] > 110 ? 110 : $attach['width']; if ($attach['pid']) { $imgattachs['used'][] = $attach; } else { $imgattachs['unused'][] = $attach; } } } return array('attachs' => $attachs, 'imgattachs' => $imgattachs); }
public function public_index() { $this->html = pc_base::load_app_class('html'); $size = $this->html->index(); showmessage(L('index_create_finish', array('size' => sizecount($size)))); }
function movedate($query) { global $sourcesize, $tableid, $movesize, $targettableid, $hash, $tableindex, $threadtableids, $fieldstr, $fromtableid, $posttable_info; $tids = array(); while ($value = DB::fetch($query)) { $tids[$value['tid']] = $value['tid']; } $fromtable = getposttable($fromtableid, true); $condition = " tid IN(" . dimplode($tids) . ")"; DB::query("INSERT INTO " . DB::table(getposttable($targettableid)) . " ({$fieldstr}) SELECT {$fieldstr} FROM {$fromtable} WHERE {$condition}", 'SILENT'); if (DB::errno()) { DB::delete(getposttable($targettableid), $condition); } else { foreach ($threadtableids as $threadtableid) { $table = $threadtableid ? "forum_thread_{$threadtableid}" : 'forum_thread'; DB::update($table, array('posttableid' => $targettableid), $condition); if (DB::affected_rows() == count($tids)) { break; } } DB::delete(getposttable($fromtableid), $condition); } $status = gettablestatus(DB::table(getposttable($targettableid)), false); $targetsize = $sourcesize + $movesize * 1048576; $nowdatasize = $targetsize - $status['Data_length']; if ($status['Data_length'] >= $targetsize) { cpmsg('postsplit_done', 'action=postsplit&operation=optimize&tableid=' . $fromtableid, 'form'); } cpmsg('postsplit_doing', 'action=postsplit&operation=movepost&fromtable=' . $tableid . '&movesize=' . $movesize . '&targettable=' . $targettableid . '&hash=' . $hash . '&tindex=' . $tableindex, 'loadingform', array('datalength' => sizecount($status['Data_length']), 'nowdatalength' => sizecount($nowdatasize))); }
/** * 数据库导入 */ public function import() { $database = pc_base::load_config('database'); if ($_GET['dosubmit']) { $admin_founders = explode(',', pc_base::load_config('system', 'admin_founders')); if (!in_array($this->userid, $admin_founders)) { showmessage(L('only_fonder_operation')); } $this->pdo_name = $_GET['pdoname']; $pre = trim($_GET['pre']); $this->fileid = trim($_GET['fileid']); $this->db_charset = $database[$this->pdo_name]['charset']; $this->db_tablepre = $database[$pdo_name]['tablepre']; $this->db = db_factory::get_instance($database)->get_database($this->pdo_name); $this->import_database($pre); } else { ${$pdos} = $others = array(); foreach ($database as $name => $value) { $pdos[$name] = $value['database'] . '[' . $value['hostname'] . ']'; } $pdoname = $_GET['pdoname'] ? $_GET['pdoname'] : key($pdos); $sqlfiles = glob(CACHE_PATH . 'bakup/' . $pdoname . '/*.sql'); if (is_array($sqlfiles)) { asort($sqlfiles); $prepre = ''; $info = $infos = $other = $others = array(); foreach ($sqlfiles as $id => $sqlfile) { //老的数据库备份文件转换为新格式 if (preg_match("/([phpcmstables_|db_][0-9]{8}_[0-9a-z]{20}_)([0-9]+)\\.sql/i", basename($sqlfile), $num)) { list($tem_pre, $temp_date, $temp_string, $temp_end) = explode('_', basename($sqlfile)); rename($sqlfile, CACHE_PATH . 'bakup/' . $pdoname . '/' . $temp_string . '_' . $tem_pre . '_' . $temp_date . '_' . $temp_end); } if (preg_match("/([0-9a-z]{20}_[phpcmstables_|db_]+[0-9]{8}_)([0-9]+)\\.sql/i", basename($sqlfile), $num)) { $info['filename'] = basename($sqlfile); $info['filesize'] = sizecount(filesize($sqlfile)); $info['maketime'] = date('Y-m-d H:i:s', filemtime($sqlfile)); $info['pre'] = $num[1]; $info['number'] = $num[2]; if (!$id) { $prebgcolor = '#CFEFFF'; } if ($info['pre'] == $prepre) { $info['bgcolor'] = $prebgcolor; } else { $info['bgcolor'] = $prebgcolor == '#CFEFFF' ? '#F1F3F5' : '#CFEFFF'; } $prebgcolor = $info['bgcolor']; $prepre = $info['pre']; $infos[] = $info; } else { $other['filename'] = basename($sqlfile); $other['filesize'] = sizecount(filesize($sqlfile)); $other['maketime'] = date('Y-m-d H:i:s', filemtime($sqlfile)); $others[] = $other; } } } $show_validator = true; include $this->admin_tpl('database_import'); } }
} if ($do == 'optimize') { $_W['page']['title'] = '优化 - 数据库 - 系统管理'; $sql = "SHOW TABLE STATUS LIKE '{$_W['config']['db']['tablepre']}%'"; $tables = pdo_fetchall($sql); $totalsize = 0; $ds = array(); foreach ($tables as $ss) { if (!empty($ss) && !empty($ss['Data_free'])) { $row = array(); $row['title'] = $ss['Name']; $row['type'] = $ss['Engine']; $row['rows'] = $ss['Rows']; $row['data'] = sizecount($ss['Data_length']); $row['index'] = sizecount($ss['Index_length']); $row['free'] = sizecount($ss['Data_free']); $ds[$row['title']] = $row; } } if (checksubmit()) { foreach ($_GPC['select'] as $t) { if (!empty($ds[$t])) { $sql = "OPTIMIZE TABLE {$t}"; pdo_fetch($sql); } } message('数据表优化成功.', 'refresh'); } } if ($do == 'run') { $_W['page']['title'] = '运行SQL - 数据库 - 系统管理';
$page = max(1, intval($page)); $query = $db->query("SELECT a.*, af.description, p.fid, p.author, t.tid, t.tid, t.subject, f.name AS fname\r\n\t\t\tFROM {$tablepre}attachments a LEFT JOIN {$tablepre}attachmentfields af ON a.aid=af.aid, {$tablepre}posts p, {$tablepre}threads t, {$tablepre}forums f\r\n\t\t\tWHERE t.tid=a.tid AND f.fid=p.fid AND t.displayorder>='0' AND p.invisible='0' AND {$sql} LIMIT " . ($page - 1) * $ppp . ',' . $ppp); while ($attachment = $db->fetch_array($query)) { if (!$attachment['remote']) { $matched = file_exists($attachdir . '/' . $attachment['attachment']) ? '' : lang('attach_lost'); $attachment['url'] = $attachurl; } else { @set_time_limit(0); if (@fclose(@fopen($ftp['attachurl'] . '/' . $attachment['attachment'], 'r'))) { $matched = ''; } else { $matched = lang('attach_lost'); } $attachment['url'] = $ftp['attachurl']; } $attachsize = sizecount($attachment['filesize']); if (!$nomatched || $nomatched && $matched) { $attachments .= showtablerow('', array('class="td25"', 'title="' . $attachment['description'] . '" class="td21"'), array("<input class=\"checkbox\" type=\"checkbox\" name=\"delete[]\" value=\"{$attachment['aid']}\" />", $attachment['remote'] ? "<span class=\"diffcolor3\">{$attachment['filename']}" : $attachment['filename'], "<a href=\"{$attachment['url']}/{$attachment['attachment']}\" class=\"smalltxt\" target=\"_blank\">" . cutstr($attachment['attachment'], 30) . "</a>", $attachment['author'], "<a href=\"viewthread.php?tid={$attachment['tid']}\" target=\"_blank\">" . cutstr($attachment['subject'], 20) . "</a>", $attachsize, $attachment['downloads'], $matched ? "<em class=\"error\">{$matched}<em>" : "<a href=\"attachment.php?aid=" . aidencode($attachment['aid']) . "&noupdate=yes\" target=\"_blank\" class=\"act nomargin\">{$lang['download']}</a>"), TRUE); } } $attachmentcount = $db->result_first("SELECT count(*) FROM {$tablepre}attachments a LEFT JOIN {$tablepre}attachmentfields af ON a.aid=af.aid, {$tablepre}posts p, {$tablepre}threads t, {$tablepre}forums f\r\n\t\t\tWHERE t.tid=a.tid AND f.fid=p.fid AND t.displayorder>='0' AND p.invisible='0' AND {$sql}"); $multipage = multi($attachmentcount, $ppp, $page, "{$BASESCRIPT}?action=attachments"); $multipage = preg_replace("/href=\"{$BASESCRIPT}\\?action=attachments&page=(\\d+)\"/", "href=\"javascript:page(\\1)\"", $multipage); $multipage = str_replace("window.location={$BASESCRIPT}.'?action=attachments&page='+this.value", "page(this.value)", $multipage); echo <<<EOT <script type="text/JavaScript"> \tfunction page(number) { \t\t\$('attachmentforum').page.value=number; \t\t\$('attachmentforum').searchsubmit.click(); \t} </script>
?> </td> <td><?php echo $info['engine']; ?> </td> <td><?php echo $info['collation']; ?> </td> <td><?php echo $info['rows']; ?> </td> <td><?php echo sizecount($info['size']); ?> </td> <td><?php echo $info['data_free']; ?> </td> <td> <a href="?m=database&f=index&v=public_repair&operation=optimize&tables=<?php echo $info['name']; echo $this->su(); ?> " class="btn btn-primary btn-xs">优化</a> <a href="?m=database&f=index&v=public_repair&operation=repair&tables=<?php echo $info['name']; echo $this->su();
$fileupload = ini_get('upload_max_filesize'); } else { $fileupload = '<font color="red">' . $lang['no'] . '</font>'; } $dbsize = 0; $query = DB::query("SHOW TABLE STATUS LIKE '{$_G['config']['db'][1]['tablepre']}%'", 'SILENT'); while ($table = DB::fetch($query)) { $dbsize += $table['Data_length'] + $table['Index_length']; } $dbsize = $dbsize ? sizecount($dbsize) : $lang['unknown']; if (isset($_G['gp_attachsize'])) { $attachsize = 0; for ($i = 0; $i < 10; $i++) { $attachsize += intval(DB::result_first("SELECT SUM(filesize) FROM " . DB::table('forum_attachment_' . $i))); } $attachsize = is_numeric($attachsize) ? sizecount($attachsize) : $lang['unknown']; } else { $attachsize = '<a href="' . ADMINSCRIPT . '?action=index&attachsize">[ ' . $lang['detail'] . ' ]</a>'; } $membersmod = DB::result_first("SELECT COUNT(*) FROM " . DB::table('common_member_validate') . " WHERE status='0'"); $threadsdel = DB::result_first("SELECT COUNT(*) FROM " . DB::table('forum_thread') . " WHERE displayorder='-1'"); $query = DB::query("SELECT idtype, COUNT(*) AS count FROM " . DB::table('common_moderate') . " WHERE status='0' GROUP BY idtype"); $modcount = array(); while ($value = DB::fetch($query)) { $modcount[$value['idtype']] = $value['count']; } $medalsmod = DB::result_first("SELECT COUNT(*) FROM " . DB::table('forum_medallog') . " WHERE type='2'"); $threadsmod = $modcount['tid']; $postsmod = $modcount['pid']; $blogsmod = $modcount['blogid']; $doingsmod = $modcount['doid'];
$page_title = L('clean_cache'); include $this->admin_tpl('header'); ?> <div class="subnav"> <h2 class="title-1 line-x f14 fb blue lh28"><?php echo L('clean_cache'); ?> </h2> <div class="content-menu ib-a blue line-x"> <em> <?php echo L('cache_size'); ?> :<span id='filesize'><?php echo sizecount($applistinfo['filesize']); ?> </span> | <?php echo L('last_modify_time'); ?> :<span id='filemtime'><?php echo date('Y-m-d H:i:s', $applistinfo['filemtime']); ?> </span> </em> <a href="javascript:clearcache('applist');" class="on"> <em><?php echo L('clean_applist_cache'); ?> </em></a>
function GetSFileList($dir, $content, $re = 0) { global $filedata, $j, $nowpath, $writabledb; !$j && ($j = 1); if ($dh = opendir($dir)) { while ($file = readdir($dh)) { $ext = getextension($file); $f = str_replace('//', '/', $dir . '/' . $file); if ($file != '.' && $file != '..' && is_dir($f)) { GetSFileList($f, $content, $re = 0); } elseif ($file != '.' && $file != '..' && is_file($f) && in_array($ext, explode(',', $writabledb))) { $find = 0; if ($re) { if (preg_match('@' . $content . '@', $file) || preg_match('@' . $content . '@', @file_get_contents($f))) { $find = 1; } } else { if (strstr($file, $content) || strstr(@file_get_contents($f), $content)) { $find = 1; } } if ($find) { $filedata[$j]['filename'] = str_replace($nowpath, '', $f); $filedata[$j]['size'] = sizecount(@filesize($f)); $filedata[$j]['mtime'] = @date('Y-m-d H:i:s', filemtime($f)); $filedata[$j]['filechmod'] = getChmod($f); $filedata[$j]['fileperm'] = getPerms($f); $filedata[$j]['fileowner'] = getUser($f); $filedata[$j]['dirlink'] = $dir; $filedata[$j]['server_link'] = $f; $filedata[$j]['client_link'] = ue($f); $j++; } } } closedir($dh); clearstatcache(); return $filedata; } else { return array(); } }
$db->query("OPTIMIZE TABLE $table[Name]"); } echo "<tr>\n". "<td class=\"altbg1\" align=\"center\">".$lang['yes']."</td>\n". "<td class=\"altbg2\" align=\"center\">$table[Name]</td>\n". "<td class=\"altbg1\" align=\"center\">".($db->version() > '4.1' ? $table['Engine'] : $table['Type'])."</td>\n". "<td class=\"altbg2\" align=\"center\">$table[Rows]</td>\n". "<td class=\"altbg1\" align=\"center\">$table[Data_length]</td>\n". "<td class=\"altbg2\" align=\"center\">$table[Index_length]</td>\n". "<td class=\"altbg1\" align=\"center\">0</td>\n". "</tr>\n"; $totalsize += $table['Data_length'] + $table['Index_length']; } } echo "<tr><td colspan=\"7\" align=\"right\">$lang[database_optimize_used] ".sizecount($totalsize)."</td></tr></table>"; } echo '</table></form>'; } function fetchtablelist($tablepre = '') { global $db; $arr = explode('.', $tablepre); $dbname = $arr[1] ? $arr[0] : ''; $sqladd = $dbname ? " FROM $dbname LIKE '$arr[1]%'" : "LIKE '$tablepre%'"; !$tablepre && $tablepre = '*'; $tables = $table = array(); $query = $db->query("SHOW TABLE STATUS $sqladd"); while($table = $db->fetch_array($query)) { $table['Name'] = ($dbname ? "$dbname." : '').$table['Name'];
function getattach($posttime = 0) { global $db, $tablepre, $discuz_uid, $dateformat, $timeformat, $timeoffset, $pid, $ftp, $attachurl; require_once DISCUZ_ROOT . './include/attachment.func.php'; $attachs = $imgattachs = array(); $sqladd1 = $posttime > 0 ? "AND a.dateline>'{$posttime}'" : ''; $sqladd2 = $pid > 0 ? "OR a.pid='{$pid}'" : ''; $query = $db->query("SELECT a.*, af.description\r\n\t\tFROM {$tablepre}attachments a\r\n\t\tLEFT JOIN {$tablepre}attachmentfields af ON a.aid=af.aid\r\n\t\tWHERE (a.uid='{$discuz_uid}' AND a.tid='0' {$sqladd1}) {$sqladd2} ORDER BY dateline"); while ($attach = $db->fetch_array($query)) { $attach['filenametitle'] = $attach['filename']; $attach['ext'] = fileext($attach['filename']); $attach['filename'] = cutstr($attach['filename'], 30); $attach['attachsize'] = sizecount($attach['filesize']); $attach['dateline'] = gmdate("{$dateformat} {$timeformat}", $attach['dateline'] + $timeoffset * 3600); $attach['filetype'] = attachtype($attach['ext'] . "\t" . $attach['filetype']); if ($attach['isimage'] < 1) { if ($attach['isimage']) { $attach['url'] = $attach['remote'] ? $ftp['attachurl'] : $attachurl; $attach['width'] = $attach['width'] > 110 ? 110 : $attach['width']; } if ($attach['pid']) { $attachs['used'][] = $attach; } else { $attachs['unused'][] = $attach; } } else { $attach['url'] = $attach['remote'] ? $ftp['attachurl'] : $attachurl; $attach['width'] = $attach['width'] > 110 ? 110 : $attach['width']; if ($attach['pid']) { $imgattachs['used'][] = $attach; } else { $imgattachs['unused'][] = $attach; } } } return array('attachs' => $attachs, 'imgattachs' => $imgattachs); }
function recyclebinpostshowpostlist($fid, $authors, $starttime, $endtime, $keywords, $start_limit, $lpp) { global $_G, $lang, $posttableid, $security; $tids = $fids = array(); if ($security) { $postlist = C::t('#security#security_evilpost')->fetch_all_by_search($posttableid, null, $keywords, -5, $fid, null, $authors ? explode(',', str_replace(' ', '', $authors)) : null, strtotime($starttime), strtotime($endtime), null, null, $start_limit, $lpp); } else { $postlist = C::t('forum_post')->fetch_all_by_search($posttableid, null, $keywords, -5, $fid, null, $authors ? explode(',', str_replace(' ', '', $authors)) : null, strtotime($starttime), strtotime($endtime), null, null, $start_limit, $lpp); } if (empty($postlist)) { return false; } foreach ($postlist as $key => $post) { $tids[$post['tid']] = $post['tid']; $fids[$post['fid']] = $post['fid']; } foreach (C::t('forum_thread')->fetch_all_by_tid($tids) as $thread) { $thread['tsubject'] = $thread['subject']; $threadlist[$thread['tid']] = $thread; } $query = C::t('forum_forum')->fetch_all_by_fid($fids); foreach ($query as $val) { $forum = array('fid' => $val['fid'], 'forumname' => $val['name'], 'allowsmilies' => $val['allowsmilies'], 'allowhtml' => $val['allowhtml'], 'allowbbcode' => $val['allowbbcode'], 'allowimgcode' => $val['allowimgcode']); $forumlist[$forum['fid']] = $forum; } foreach ($postlist as $key => $post) { $post['message'] = discuzcode($post['message'], $post['smileyoff'], $post['bbcodeoff'], sprintf('%00b', $post['htmlon']), $forumlist[$post['fid']]['allowsmilies'], $forumlist[$post['fid']]['allowbbcode'], $forumlist[$post['fid']]['allowimgcode'], $forumlist[$post['fid']]['allowhtml']); $post['dateline'] = dgmdate($post['dateline']); if ($post['attachment']) { require_once libfile('function/attachment'); foreach (C::t('forum_attachment_n')->fetch_all_by_id('tid:' . $post['tid'], 'pid', $post['pid']) as $attach) { $_G['setting']['attachurl'] = $attach['remote'] ? $_G['setting']['ftp']['attachurl'] : $_G['setting']['attachurl']; $attach['url'] = $attach['isimage'] ? " {$attach['filename']} (" . sizecount($attach['filesize']) . ")<br /><br /><img src=\"" . $_G['setting']['attachurl'] . "forum/{$attach['attachment']}\" onload=\"if(this.width > 100) {this.resized=true; this.width=100;}\">" : "<a href=\"" . $_G['setting']['attachurl'] . "forum/{$attach['attachment']}\" target=\"_blank\">{$attach['filename']}</a> (" . sizecount($attach['filesize']) . ")"; $post['message'] .= "<br /><br />{$lang['attachment']}: " . attachtype(fileext($attach['filename']) . "\t") . $attach['url']; } } showtablerow("id=\"mod_{$post['pid']}_row1\"", array('rowspan="3" class="rowform threadopt" style="width:80px;"', 'class="threadtitle"'), array("<ul class=\"nofloat\"><li><input class=\"radio\" type=\"radio\" name=\"moderate[{$post['pid']}]\" id=\"mod_{$post['pid']}_1\" value=\"delete\" checked=\"checked\" /><label for=\"mod_{$post['pid']}_1\">{$lang['delete']}</label></li><li><input class=\"radio\" type=\"radio\" name=\"moderate[{$post['pid']}]\" id=\"mod_{$post['pid']}_2\" value=\"undelete\" /><label for=\"mod_{$post['pid']}_2\">{$lang['undelete']}</label></li><li><input class=\"radio\" type=\"radio\" name=\"moderate[{$post['pid']}]\" id=\"mod_{$post['pid']}_3\" value=\"ignore\" /><label for=\"mod_{$post['pid']}_3\">{$lang['ignore']}</label></li></ul>", "<h3><a href=\"forum.php?mod=forumdisplay&fid={$post['fid']}\" target=\"_blank\">" . $forumlist[$post['fid']]['forumname'] . "</a> » <a href=\"forum.php?mod=viewthread&tid={$post['tid']}\" target=\"_blank\">" . $threadlist[$post['tid']]['tsubject'] . "</a>" . ($post['subject'] ? ' » ' . $post['subject'] : '') . "</h3><p><span class=\"bold\">{$lang['author']}:</span> <a href=\"home.php?mod=space&uid={$post['authorid']}\" target=\"_blank\">{$post['author']}</a> <span class=\"bold\">{$lang['time']}:</span> {$post['dateline']} IP: {$post['useip']}</p>")); showtablerow("id=\"mod_{$post['pid']}_row2\"", 'colspan="2" style="padding: 10px; line-height: 180%;"', '<div style="overflow: auto; overflow-x: hidden; max-height:120px; height:auto !important; height:120px; word-break: break-all;">' . $post['message'] . '</div>'); showtablerow("id=\"mod_{$post['pid']}_row3\"", 'class="threadopt threadtitle" colspan="2"', "{$lang['isanonymous']}: " . ($post['anonymous'] ? $lang['yes'] : $lang['no']) . " {$lang['ishtmlon']}: " . ($post['htmlon'] ? $lang['yes'] : $lang['no'])); } return true; }
function parseforumattach(&$post, $aids) { global $_G; if ($aids = array_unique($aids)) { require_once libfile('function/attachment'); $finds = $replaces = array(); foreach (C::t('forum_attachment_n')->fetch_all_by_id('tid:' . $post['tid'], 'aid', $aids) as $attach) { $attach['url'] = ($attach['remote'] ? $_G['setting']['ftp']['attachurl'] : $_G['setting']['attachurl']) . 'forum/'; $attach['dateline'] = dgmdate($attach['dateline'], 'u'); $extension = strtolower(fileext($attach['filename'])); $attach['ext'] = $extension; $attach['imgalt'] = $attach['isimage'] ? strip_tags(str_replace('"', '\\"', $attach['description'] ? $attach['description'] : $attach['filename'])) : ''; $attach['attachicon'] = attachtype($extension . "\t" . $attach['filetype']); $attach['attachsize'] = sizecount($attach['filesize']); $attach['refcheck'] = !$attach['remote'] && $_G['setting']['attachrefcheck'] || $attach['remote'] && ($_G['setting']['ftp']['hideurl'] || $attach['isimage'] && $_G['setting']['attachimgpost'] && strtolower(substr($_G['setting']['ftp']['attachurl'], 0, 3)) == 'ftp'); $aidencode = packaids($attach); $widthcode = attachwidth($attach['width']); $is_archive = $_G['forum_thread']['is_archived'] ? "&fid=" . $_G['fid'] . "&archiveid=" . $_G['forum_thread']['archiveid'] : ''; if ($attach['isimage']) { $attachthumb = getimgthumbname($attach['attachment']); if ($_G['setting']['thumbstatus'] && $attach['thumb']) { $replaces[$attach['aid']] = "<a href=\"javascript:;\"><img id=\"_aimg_{$attach['aid']}\" aid=\"{$attach['aid']}\" onclick=\"zoom(this, this.getAttribute('zoomfile'), 0, 0, '{$_G[forum][showexif]}')\"\n\t\t\t\t\t\tzoomfile=\"" . ($attach['refcheck'] ? "forum.php?mod=attachment{$is_archive}&aid={$aidencode}&noupdate=yes¬humb=yes" : $attach['url'] . $attach['attachment']) . "\"\n\t\t\t\t\t\tsrc=\"" . ($attach['refcheck'] ? "forum.php?mod=attachment{$is_archive}&aid={$aidencode}" : $attach['url'] . $attachthumb) . "\" alt=\"{$attach['imgalt']}\" title=\"{$attach['imgalt']}\" w=\"{$attach['width']}\" /></a>"; } else { $replaces[$attach['aid']] = "<img id=\"_aimg_{$attach['aid']}\" aid=\"{$attach['aid']}\"\n\t\t\t\t\t\tzoomfile=\"" . ($attach['refcheck'] ? "forum.php?mod=attachment{$is_archive}&aid={$aidencode}&noupdate=yes¬humb=yes" : $attach['url'] . $attach['attachment']) . "\"\n\t\t\t\t\t\tsrc=\"" . ($attach['refcheck'] ? "forum.php?mod=attachment{$is_archive}&aid={$aidencode}&noupdate=yes " : $attach['url'] . $attach['attachment']) . "\" {$widthcode} alt=\"{$attach['imgalt']}\" title=\"{$attach['imgalt']}\" w=\"{$attach['width']}\" />"; } } else { $replaces[$attach['aid']] = "{$attach['attachicon']}<a href=\"forum.php?mod=attachment{$is_archive}&aid={$aidencode}\" onmouseover=\"showMenu({'ctrlid':this.id,'pos':'12'})\" id=\"aid{$attach['aid']}\" target=\"_blank\">{$attach['filename']}</a>"; } $finds[$attach['aid']] = '[attach]' . $attach['aid'] . '[/attach]'; } if ($finds && $replaces) { $post['message'] = str_ireplace($finds, $replaces, $post['message']); } } }
$updatetime = @filemtime(M_ROOT . './dynamic/cache/cmsinfos.cac.php'); load_cache('cmsinfos'); $lic_file = M_ROOT . './dynamic/license.cert'; $now_svr = strtolower($_SERVER["SERVER_NAME"]); $opsarr = array('ck' => "checked='1'", 'nock' => "checked='0'", 'm' => "createdate>'" . ($timestamp - 30 * 24 * 3600) . "'", 'w' => "createdate>'" . ($timestamp - 7 * 24 * 3600) . "'", 'd3' => "createdate>'" . ($timestamp - 3 * 24 * 3600) . "'", 'd1' => "createdate>'" . ($timestamp - 24 * 3600) . "'"); $tblarr = array('archive' => 'archives', 'comment' => 'comments', 'reply' => 'replys', 'offer' => 'offers', 'answer' => 'answers', 'orders' => 'orders', 'member' => 'members', 'amember' => 'members', 'mtran' => 'mtrans', 'utran' => 'utrans', 'mcomment' => 'mcomments', 'mreply' => 'mreplys'); if ($timestamp - $updatetime > 3600 * 4) { $cmsinfos['dbversion'] = $db->result_one("SELECT VERSION()"); $cmsinfos['dbsize'] = 0; $query = $db->query("SHOW TABLE STATUS LIKE '{$tblprefix}%'", 'SILENT'); while ($table = $db->fetch_array($query)) { $cmsinfos['dbsize'] += $table['Data_length'] + $table['Index_length']; } $cmsinfos['dbsize'] = $cmsinfos['dbsize'] ? sizecount($cmsinfos['dbsize']) : lang('unknow'); $cmsinfos['attachsize'] = $db->result_one("SELECT SUM(size) FROM {$tblprefix}userfiles"); $cmsinfos['attachsize'] = is_numeric($cmsinfos['attachsize']) ? sizecount($cmsinfos['attachsize']) : lang('unknow'); $cmsinfos['sys_mail'] = @ini_get('sendmail_path') ? 'Unix Sendmail ( Path: ' . @ini_get('sendmail_path') . ')' : (@ini_get('SMTP') ? 'SMTP ( Server: ' . ini_get('SMTP') . ')' : 'Disabled'); $cmsinfos['serverip'] = $_SERVER["SERVER_ADDR"]; $cmsinfos['servername'] = $_SERVER["SERVER_NAME"]; foreach ($tblarr as $k => $v) { foreach ($opsarr as $x => $y) { if ($k == 'orders') { $x == 'ck' && ($y = "state='1'"); $x == 'nock' && ($y = "state<>'1'"); } elseif ($k == 'member') { $x == 'm' && ($y = "regdate>'" . ($timestamp - 30 * 24 * 3600) . "'"); $x == 'w' && ($y = "regdate>'" . ($timestamp - 7 * 24 * 3600) . "'"); $x == 'd3' && ($y = "regdate>'" . ($timestamp - 3 * 24 * 3600) . "'"); $x == 'd1' && ($y = "regdate>'" . ($timestamp - 24 * 3600) . "'"); } elseif ($k == 'amember') { $x == 'ck' && ($y = "grouptype2<>0 AND checked='1'");
$disabledstr = ''; if (isset($issettids[$thread['tid']])) { $disabledstr = 'disabled'; } else { $issettids[$thread['tid']] = $thread['tid']; } $post = C::t('forum_post')->fetch_threadpost_by_tid_invisible($thread['tid']); $thread = array_merge($thread, $post); $thread['message'] = discuzcode($thread['message'], $thread['smileyoff'], $thread['bbcodeoff'], sprintf('%00b', $thread['htmlon']), $thread['allowsmilies'], $thread['allowbbcode'], $thread['allowimgcode'], $thread['allowhtml']); $thread['moddateline'] = dgmdate($thread['moddateline']); $thread['dateline'] = dgmdate($thread['dateline']); if ($thread['attachment']) { require_once libfile('function/attachment'); foreach (C::t('forum_attachment_n')->fetch_all_by_id('tid:' . $thread['tid'], 'tid', $thread['tid']) as $attach) { $_G['setting']['attachurl'] = $attach['remote'] ? $_G['setting']['ftp']['attachurl'] : $_G['setting']['attachurl']; $attach['url'] = $attach['isimage'] ? " {$attach['filename']} (" . sizecount($attach['filesize']) . ")<br /><br /><img src=\"" . $_G['setting']['attachurl'] . "forum/{$attach['attachment']}\" onload=\"if(this.width > 100) {this.resized=true; this.width=100;}\">" : "<a href=\"" . $_G['setting']['attachurl'] . "forum/{$attach['attachment']}\" target=\"_blank\">{$attach['filename']}</a> (" . sizecount($attach['filesize']) . ")"; $thread['message'] .= "<br /><br />{$lang['attachment']}: " . attachtype(fileext($attach['filename']) . "\t") . $attach['url']; } } showtablerow("id=\"mod_{$thread['tid']}_row1\"", array('rowspan="3" class="rowform threadopt" style="width:80px;"', 'class="threadtitle"'), array("<ul class=\"nofloat\"><li><input class=\"radio\" type=\"radio\" name=\"moderate[{$thread['tid']}]\" id=\"mod_{$thread['tid']}_1\" value=\"delete\" " . (empty($disabledstr) ? "checked=\"checked\"" : '') . " {$disabledstr} /><label for=\"mod_{$thread['tid']}_1\">{$lang['delete']}</label></li><li><input class=\"radio\" type=\"radio\" name=\"moderate[{$thread['tid']}]\" id=\"mod_{$thread['tid']}_2\" value=\"undelete\" {$disabledstr}/><label for=\"mod_{$thread['tid']}_2\">{$lang['undelete']}</label></li><li><input class=\"radio\" type=\"radio\" name=\"moderate[{$thread['tid']}]\" id=\"mod_{$thread['tid']}_3\" value=\"ignore\" {$disabledstr}/><label for=\"mod_{$thread['tid']}_3\">{$lang['ignore']}</label></li></ul>", "<h3><a href=\"forum.php?mod=forumdisplay&fid={$thread['fid']}\" target=\"_blank\">{$thread['forumname']}</a> » {$thread['subject']}</h3><p><span class=\"bold\">{$lang['author']}:</span> <a href=\"home.php?mod=space&uid={$thread['authorid']}\" target=\"_blank\">{$thread['author']}</a> <span class=\"bold\">{$lang['time']}:</span> {$thread['dateline']} {$lang['threads_replies']}: {$thread['replies']} {$lang['threads_views']}: {$thread['views']}</p>")); showtablerow("id=\"mod_{$thread['tid']}_row2\"", 'colspan="2" style="padding: 10px; line-height: 180%;"', '<div style="overflow: auto; overflow-x: hidden; max-height:120px; height:auto !important; height:120px; word-break: break-all;">' . $thread['message'] . '</div>'); showtablerow("id=\"mod_{$thread['tid']}_row3\"", 'class="threadopt threadtitle" colspan="2"', "{$lang['operator']}: <a href=\"home.php?mod=space&uid={$thread['moduid']}\" target=\"_blank\">{$thread['modusername']}</a> {$lang['recyclebin_delete_time']}: {$thread['moddateline']} {$lang['reason']}: {$thread['reason']}"); } } showsubmit('rbsubmit', 'submit', '', '<a href="#rb" onclick="checkAll(\'option\', $(\'rbform\'), \'delete\')">' . cplang('recyclebin_all_delete') . '</a> <a href="#rb" onclick="checkAll(\'option\', $(\'rbform\'), \'undelete\')">' . cplang('recyclebin_all_undelete') . '</a> <a href="#rb" onclick="checkAll(\'option\', $(\'rbform\'), \'ignore\')">' . cplang('recyclebin_all_ignore') . '</a> ', $multi); showtablefooter(); showformfooter(); echo '<iframe name="rbframe" style="display:none"></iframe>'; showtagfooter('div'); } } else {
} } } } } else { $query = q("SHOW TABLE STATUS"); $table_num = $table_rows = $data_size = 0; $tabledb = array(); while ($table = mysql_fetch_array($query)) { $data_size = $data_size + $table['Data_length']; $table_rows = $table_rows + $table['Rows']; $table['Data_length'] = sizecount($table['Data_length']); $table_num++; $tabledb[] = $table; } $data_size = sizecount($data_size); unset($table); p('<table border="0" cellpadding="0" cellspacing="0">'); p('<form action="' . $self . '" method="post">'); makehide('haz', 'sqladmin'); p($dbform); p('<tr class="head">'); p('<td width="2%" align="center"><input name="chkall" value="on" type="checkbox" onclick="CheckAll(this.form)" /></td>'); p('<td>Name</td>'); p('<td>Rows</td>'); p('<td>Data_length</td>'); p('<td>Create_time</td>'); p('<td>Update_time</td>'); if ($highver) { p('<td>Engine</td>'); p('<td>Collation</td>');