function main() { global $_G; if ($_GET['onsubmit'] && check()) { foreach ($_GET[ids] as $k => $v) { $id = intval($v); if ($_GET[del][$k] == 0) { continue; } if ($_GET['_del_all'] == 1 && $_GET['del'][$k]) { DB::delete(__CLASS__, "id=" . intval($id)); } } cpmsg('操作成功', 'success', 'm=' . __CLASS__ . '&a=' . __FUNCTION__); return false; } $size = 30; $start = ($_G['page'] - 1) * $size; $url = ''; $and = ''; if ($_GET['uid']) { $uid = intval($_GET[uid]); $and .= " AND uid =" . $uid; $url .= "&uid=" . $uid; } if ($_GET['username']) { $username = urldecode_utf8(trim($_GET[username])); $and .= " AND username ='******'"; $url .= "&username="******" AND ip ='" . $ip . "'"; $url .= "&ip=" . $ip; } if ($_GET['jf_down']) { $jf_down = intval($_GET[jf_down]); $and .= " AND org_jf >='" . $jf_down . "'"; $url .= "&jf_down=" . $jf_down; } if ($_GET['jf_up']) { $jf_up = intval($_GET[jf_up]); $and .= " AND org_jf <='" . $jf_up . "'"; $url .= "&jf_up=" . $jf_up; } if ($_GET[type] && array_key_exists($_GET[type], $_G['setting']['jf_type'])) { $type = addslashes(trim($_GET[type])); $and .= " AND type='{$type}'"; $url .= "&type=" . $type; } $sign_list = DB::fetch_all("SELECT * FROM " . DB::table(__CLASS__) . " where 1 {$and} ORDER BY id DESC LIMIT {$start},{$size}"); $count = getcount(__CLASS__, $and); $showpage = multi($count, $size, $_G[page], URL . "m=sign&a=main" . $url); foreach ($sign_list as $k => $v) { $sign_list[$k][username_url] = urlencode_utf8($v[username]); $sign_list[$k][dateline] = dgmdate($v[dateline], 'u'); } $this->add(array('count' => $count, 'sign_list' => $sign_list, 'showpage' => $showpage)); $this->show('sign/main'); }
function transfer_list() { $page = max(1, MooGetGPC('page', 'integer', 'G')); $limit = 16; $offset = ($page - 1) * $limit; $uid = MooGetGPC('uid', 'integer', 'P'); $sid = MooGetGPC('sid', 'integer', 'P'); $s_str = $and = ''; if ($uid > 0) { $s_str .= 'uid like \'%' . $uid . '%\''; $and = ' AND '; } if ($sid > 0) { $s_str .= $and . 'sid=' . $sid; } if (!empty($s_str)) { $s_str = ' WHERE ' . $s_str; } $sql = "SELECT * FROM {$GLOBALS['dbTablePre']}members_transfer {$s_str} ORDER BY id DESC LIMIT {$offset},{$limit}"; $transfer = $GLOBALS['_MooClass']['MooMySQL']->getAll($sql); $total = getcount('members_transfer', $s_str); $currenturl = "index.php?action=other_members_transfer&h=list"; $pages = multipage($total, $limit, $page, $currenturl); require_once adminTemplate('transfer_list'); }
function GetInfo() { $body = "<table><tr><td>"; $body .= "<img src='../images/rasp_title.gif' /></td>"; $body .= "<tr collspan='2'><td></td></tr></table>"; $body .= "<blockquote>"; $body .= "<font class='news_text'>В таблице \"Расписание\" базы данных содержится <b>" . getcount("select count(id) as sm from as_persones") . "</b> записей.<br /><br />В данную таблицу вносят данные по каждой учебной группе, указывая ее номер (1, 2, ...). Для того, чтобы внести информацию для повторно сдающих учащихся, создают специальную группу, с указанием в поле номера группы - \"Повторники\". Предусмотрена возможность внесения произвольной информации - поле \"Примечание\".</font><br><br>"; $body .= "</blockquote>"; $body .= "<table><tr><td>"; $body .= "<img src='../images/person_title.gif' /></td>"; $body .= "<tr collspan='2'><td></td></tr></table>"; $body .= "<blockquote>"; $body .= "<font class='news_text'>В таблице \"Персонал\" базы данных содержится <b>" . getcount("select count(id) as sm from as_persones") . "</b> записей.<br /><br />В данную таблицу вносят данные о преподавателях: фотография, Ф.И.О., звание/должность.</font><br><br>"; $body .= "</blockquote>"; $body .= "<table><tr><td>"; $body .= "<img src='../images/otz_title.gif' /></td>"; $body .= "<tr collspan='2'><td></td></tr></table>"; $body .= "<blockquote>"; $body .= "<font class='news_text'>Таблица отзывов содержит <b>" . getcount("select count(id) as sm from as_board") . " </b> записей </font>"; $body .= "<font class='news_text'>, из них не обработано <b>" . getcount("select count(id) as sm from as_board where visibled = 'N' or visibled is NULL") . "</b> записей.<br /><br />Эта таблица содержит отзывы о преподавателях, сделанные посетителями сайта. Данные из этой таблицы появяться на сайте для обозрения посетителей только после того, как администратор сайта установит соответствующий флаг. При необходимости, содержание отзыва можно отредактировать.</font>"; $body .= "</blockquote>"; $body .= "<br>"; $body .= "<div align='center'><font class='news_text'>Для управления содержанием разделов выберите необходимую Вам ссылку </font></div>"; return $body; }
function post() { global $_G; $type = trim_html($_GET['type'], 1); $type_arr = array('message', 'feedback'); if (!$type || !in_array($type, $type_arr)) { $type = 'message'; } $arr = array(); $arr['type'] = $type; $arr['content'] = trim_html($_GET['content'], 1); $arr['name'] = trim_html($_GET['name'], 1); $arr['contact'] = trim_html($_GET['contact'], 1); $arr['company_name'] = trim_html($_GET['company_name'], 1); $arr['url'] = trim_html($_GET['url'], 1); $arr['check'] = 0; $arr['dateline'] = TIMESTAMP; if ($_G['uid'] > 0 && !$arr['name']) { $arr['name'] = $_G['username']; } if ($arr['email'] && !is_email($arr['email'])) { msg('邮箱格式不正确'); } $count = getcount('message', "content = '" . $arr['content'] . "'"); if ($count > 0) { msg('您的信息我们已收到,感谢提交'); } DB::insert('message', $arr); msg('提交成功', 'success'); }
function csc($task = array()) { global $_G; if (getcount('home_blog', array('uid' => $_G['uid']))) { return true; } return array('csc' => 0, 'remaintime' => 0); }
function existdomain($domain, $domainroot) { global $_G; $exist = false; if (getcount('common_domain', array('domain' => $domain, 'domainroot' => $domainroot))) { $exist = true; } return $exist; }
function getFriendInfo($uId, $num = MY_FRIEND_NUM_LIMIT, $isExtra = false) { $users = $this->getUsers(array($uId), false, true, $isExtra, true, $num, false, true); $where = array('uId' => $uId, 'status' => 1); $totalNum = getcount('friend', $where); $friends = $users[0]['friends']; unset($users[0]['friends']); $result = array('totalNum' => $totalNum, 'friends' => $friends, 'me' => $users[0]); return new APIResponse($result); }
function active_rightbottom_message() { $type = MooGetGPC('type', 'string'); $sql_where = ' WHERE 1=1 '; //note 显示全部 if (isset($_GET['type']) == 'all') { $sql_where .= ""; //note 显示已处理过的 } else { if ((isset($_GET['type']) ? $_GET['type'] : '') == 'dealed') { $sql_where .= " AND dealstate = '1'"; //note 显示未处理过的 } else { $sql_where .= " AND dealstate = '0'"; } } //分页 $page_per = 20; $page = max(1, MooGetGPC('page', 'integer', 'G')); $limit = 20; $offset = ($page - 1) * $limit; //所管理的客服id列表 $myservice_idlist = get_myservice_idlist(); if (empty($myservice_idlist)) { $sql_where .= " AND sid IN({$GLOBALS['adminid']})"; } elseif ($myservice_idlist == 'all') { //all为客服主管能查看所有的 } else { $sql_where .= " AND sid IN({$myservice_idlist})"; } if (isset($_GET['id'])) { $id = MooGetGPC('id', 'integer', 'G'); $sql = "UPDATE {$GLOBALS['dbTablePre']}admin_remark SET status=1 WHERE id='{$id}'"; $GLOBALS['_MooClass']['MooMySQL']->query($sql); salert('操作成功', 'index.php?action=other_rightbottom&h=message'); } $total = getcount('admin_remark', $sql_where); $sql = "SELECT * FROM {$GLOBALS['dbTablePre']}admin_remark {$sql_where} ORDER BY id DESC LIMIT {$offset},{$limit}"; $remark_list = $GLOBALS['_MooClass']['MooMySQL']->getAll($sql); //note 获得当前的url 去除多余的参数 /* $currenturl = 'http://'.$_SERVER['SERVER_NAME'].':'.$_SERVER["SERVER_PORT"].$_SERVER["REQUEST_URI"]; $currenturl = preg_replace("/(&page=\d+)/","",$currenturl); $currenturl = preg_replace("/(&type=undealed)/","",$currenturl); $currenturl = preg_replace("/(&type=dealed)/","",$currenturl); $currenturl = preg_replace("/(&type=all)/","",$currenturl); $currenturl2 = $currenturl; $currenturl = $currenturl."&type=$type"; echo $currenturl; */ $currenturl = "index.php?action=other_rightbottom&h=message&type={$type}"; //note 跳转到某一页 $page_num = ceil($total / $limit); $page_links = multipage($total, $page_per, $page, $currenturl); //note 调用模板 require adminTemplate('other_rightbottom_message'); }
function generate_dropdown($id, $gid, $pid) { $c = getcount("groups", "WHERE creator = '{$id}' AND group_id != '{$gid}'"); if ($c == 0) { return false; } $e = '<select name="move_' . $pid . '"><option>Verschieben nach...</option>'; $h = get_group($id, $gid); while (list($key, $val) = each($h)) { $e .= '<option value="' . $val['group_id'] . '">' . $val['title'] . '</option>'; } $e .= '</select>'; return $e; }
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; }
function getAllUsers($from, $userNum, $friendNum = MY_FRIEND_NUM_LIMIT, $isExtra = false) { global $_SGLOBAL; $totalNum = getcount('space', ''); // space $sql = 'SELECT s.* FROM %s s ORDER BY s.uid LIMIT %d, %d'; $sql = sprintf($sql, tname('space'), $from, $userNum); $query = $_SGLOBAL['db']->query($sql); $spaces = $uIds = array(); while ($row = $_SGLOBAL['db']->fetch_array($query)) { $spaces[$row['uid']] = $row; $uIds[] = $row['uid']; } $users = $this->getUsers($uIds, $spaces, true, $isExtra, true, $friendNum, true); $result = array('totalNum' => $totalNum, 'users' => $users); return new APIResponse($result); }
function getAllUsers($from, $num) { global $_SGLOBAL; $totalNum = getcount('space', ''); $sql = 'SELECT s.*, sf.* FROM %s s LEFT JOIN %s sf ON s.uid = sf.uid ORDER BY s.uid LIMIT %d, %d'; $sql = sprintf($sql, tname('space'), tname('spacefield'), $from, $num); $query = $_SGLOBAL['db']->query($sql); $users = array(); while ($space = $_SGLOBAL['db']->fetch_array($query)) { $user = $this->_space2user($space); $user['friends'] = $this->_getFriends($space['uid']); $user['action'] = 'add'; $users[] = $user; } $result = array('totalNum' => $totalNum, 'users' => $users); return new APIResponse($result); }
function updatestat($type, $primary = 0) { global $_G; if (empty($_G['uid']) || empty($_G['setting']['updatestat'])) { return false; } $nowdaytime = dgmdate($_G['timestamp'], 'Ymd'); if ($primary) { $setarr = array('uid' => $_G['uid'], 'daytime' => $nowdaytime, 'type' => $type); if (getcount('common_statuser', $setarr)) { return false; } else { DB::insert('common_statuser', $setarr); } } if (getcount('common_stat', array('daytime' => $nowdaytime))) { DB::query("UPDATE " . DB::table('common_stat') . " SET `{$type}`=`{$type}`+1 WHERE daytime='{$nowdaytime}'"); } else { DB::query("DELETE FROM " . DB::table('common_statuser') . " WHERE daytime != '{$nowdaytime}'"); DB::insert('common_stat', array('daytime' => $nowdaytime, $type => '1')); } }
function shop_list() { global $_G, $assign; $shop_list = array(); foreach ($assign[goods] as $k => $v) { $nick = $v['nick']; if (!$nick) { continue; } $and = "nick='{$nick}'" . ' AND hide = 0 AND `check`=1 '; //$and_time .= " AND start_time < ".TIMESTAMP; //$and_time .= " AND ( end_time = 0 or end_time > ".TIMESTAMP.")"; //$and .= ' AND `check` = 1 AND `hide`=0 AND num>0 ' .$and_time; $count = getcount('goods', $and); $arr = $v; $arr[desc] = cutstr(trim_html($v[desc], 1), 150); $arr[goods] = D(array('and' => $and, 'limit' => 4, 'all' => true)); $arr['count'] = $count; $shop_list[] = $arr; } return array('shop_list' => $shop_list); }
showmessage('对不起,您的邀请码已经过期!'); } } if ($bp['isactive'] == 1) { showmessage('users_have_actived', 'index.php', 2); } if (!@(include_once S_ROOT . './uc_client/client.php')) { showmessage('system_error'); } //邮箱 $email = isemail(trim($_POST['email'])) ? trim($_POST['email']) : ''; if (empty($email)) { showmessage('email_format_is_wrong'); } if ($_SCONFIG['checkemail']) { if ($count = getcount('spacefield', array('email' => $email))) { showmessage('email_has_been_registered'); } } $num = strpos($email, '@'); $num = $num > 15 ? 15 : $num; $username = substr($email, 0, $num); //创建新用户 $newuid = uc_user_register($username, $password, $email); if ($newuid <= 0) { if ($newuid == -1) { showmessage('user_name_is_not_legitimate'); } elseif ($newuid == -2) { showmessage('include_not_registered_words'); } elseif ($newuid == -3) { showmessage('user_name_already_exists');
function onUsersGetFriendInfo($uId, $num = MY_FRIEND_NUM_LIMIT, $isExtra = false) { $users = $this->getUsers(array($uId), false, true, $isExtra, true, $num, false, true); $where = array('uid' => $uId); $totalNum = getcount('home_friend', $where); $friends = $users[0]['friends']; unset($users[0]['friends']); $result = array('totalNum' => $totalNum, 'friends' => $friends, 'me' => $users[0]); return $result; }
$wherearr[] = "ue.uid IN ($space[feedfriend])"; } else { $wherearr[] = "ue.uid = '$space[uid]'"; } if($type=="follow") { $wherearr[] = "ue.status IN (0,1)"; $theurl .= "&type=follow"; } elseif($type=="org") { $wherearr[] = "ue.status IN (3,4)"; $theurl .= "&type=org"; } elseif($type=="join") { $wherearr[] = "ue.status IN (2,3,4)"; $theurl .= "&type=join"; } elseif($type=="self") { $needquery = false; $count = getcount('event', array('uid'=>$space['uid'])); //更新统计 if($space['eventnum'] != $count) { updatetable('space', array('eventnum' => $count), array('uid'=>$space['uid'])); } $sql = "SELECT * FROM ".tname('event')." e WHERE e.uid='$space[uid]' ORDER BY e.dateline DESC LIMIT $start, $perpage"; } if($_GET['classid'] || $_GET['date'] || $_GET['province'] || $_GET['city']) { $fromsql = tname("userevent")." ue, ".tname('event')." e"; $wherearr[] = " ue.eventid = e.eventid"; $joinsql = ""; } }
showmessage('that_should_at_least_write_things'); } } if ($_GET['op'] == 'delete') { //删除 if (submitcheck('deletesubmit')) { include_once S_ROOT . './source/function_delete.php'; if (deleteblogs(array($blogid))) { showmessage('do_success', "space.php?uid={$blog['uid']}&do=blog&view=me"); } else { showmessage('failed_to_delete_operation'); } } } elseif ($_GET['op'] == 'goto') { $id = intval($_GET['id']); $uid = $id ? getcount('blog', array('blogid' => $id), 'uid') : 0; showmessage('do_success', "space.php?uid={$uid}&do=blog&id={$id}", 0); } elseif ($_GET['op'] == 'edithot') { //权限 if (!checkperm('manageblog')) { showmessage('no_privilege'); } if (submitcheck('hotsubmit')) { $_POST['hot'] = intval($_POST['hot']); updatetable('blog', array('hot' => $_POST['hot']), array('blogid' => $blog['blogid'])); if ($_POST['hot'] > 0) { include_once S_ROOT . './source/function_feed.php'; feed_publish($blog['blogid'], 'blogid'); } else { updatetable('feed', array('hot' => $_POST['hot']), array('id' => $blog['blogid'], 'idtype' => 'blogid')); }
function isblacklist($touid) { global $_G; return getcount('home_blacklist', array('uid' => $touid, 'buid' => $_G['uid'])); }
function show_credit() { global $_SGLOBAL, $space; $showcredit = getcount('show', array('uid' => $space['uid']), 'credit'); if ($showcredit > 0) { if ($showcredit == 1) { //ᅬᅡᄚᅪ뛹 notification_add($space['uid'], 'show', cplang('note_show_out')); } $_SGLOBAL['db']->query("UPDATE " . tname('show') . " SET credit=credit-1 WHERE uid='{$space['uid']}' AND credit>0"); } }
function mtag_out($mtag, $uids) { global $_SGLOBAL; $_SGLOBAL['db']->query("DELETE FROM ".tname('tagspace')." WHERE tagid='$mtag[tagid]' AND uid IN (".simplode($uids).")"); //更新成员数 $count = getcount('tagspace', array('tagid'=>$mtag['tagid'])); if($count > 0) { updatetable('mtag', array('membernum'=>$count), array('tagid'=>$mtag['tagid'])); } else { $_SGLOBAL['db']->query("DELETE FROM ".tname('tagspace')." WHERE tagid='$mtag[tagid]'"); $_SGLOBAL['db']->query("DELETE FROM ".tname('mtag')." WHERE tagid='$mtag[tagid]'"); $_SGLOBAL['db']->query("DELETE FROM ".tname('thread')." WHERE tagid='$mtag[tagid]'"); $_SGLOBAL['db']->query("DELETE FROM ".tname('post')." WHERE tagid='$mtag[tagid]'"); $_SGLOBAL['db']->query("DELETE FROM ".tname('mtaginvite')." WHERE tagid='$mtag[tagid]'"); //删除举报 $_SGLOBAL['db']->query("DELETE FROM ".tname('report')." WHERE id='$mtag[tagid]' AND idtype='tagid'"); } }
function updatestat($type, $primary=0) { global $_SGLOBAL, $_SCONFIG; if(empty($_SGLOBAL['supe_uid']) || empty($_SCONFIG['updatestat'])) return false; $nowdaytime = sgmdate('Ymd', $_SGLOBAL['timestamp']); if($primary) { //去重 $setarr = array( 'uid' => $_SGLOBAL['supe_uid'], 'daytime' => '$nowdaytime', 'type' => $type ); if(getcount('statuser', $setarr)) { return false; } else { inserttable('statuser', $setarr);//插入当天数据 } } if(getcount('stat', array('daytime'=>$nowdaytime))) { $_SGLOBAL['db']->query("UPDATE ".tname('stat')." SET `$type`=`$type`+1 WHERE daytime='$nowdaytime'"); } else { //删除昨天的防重数据 $_SGLOBAL['db']->query("DELETE FROM ".tname('statuser')." WHERE daytime != '$nowdaytime'"); //插入统计 inserttable('stat', array('daytime'=>$nowdaytime, $type=>'1')); } }
$article['commentnum'] = C::t('home_comment')->count_by_id_idtype($article['id'], 'blogid'); if ($article['commentnum']) { $query = C::t('home_comment')->fetch_all_by_id_idtype($article['id'], 'blogid', 0, 20, '', 'DESC'); foreach ($query as $value) { if ($value['status'] == 0 || $_G['adminid'] == 1 || $value['uid'] == $_G['uid']) { $commentlist[] = $value; } } } } elseif ($article['idtype'] == 'tid') { $common_url = "forum.php?mod=viewthread&tid={$article['id']}"; $form_url = "forum.php?mod=post&action=reply&tid={$article['id']}&replysubmit=yes&infloat=yes&handlekey=fastpost"; require_once libfile('function/discuzcode'); $posttable = empty($thread['posttable']) ? getposttablebytid($article['id']) : $thread['posttable']; $_G['tid'] = $article['id']; $article['commentnum'] = getcount($posttable, array('tid' => $article['id'], 'first' => '0')); if ($article['allowcomment'] && $article['commentnum']) { $attachpids = $attachtags = array(); $_G['group']['allowgetattach'] = $_G['group']['allowgetimage'] = 1; foreach (C::t('forum_post')->fetch_all_by_tid('tid:' . $article['id'], $article['id'], true, 'ASC', 0, 20, null, 0) as $value) { $value['uid'] = $value['authorid']; $value['username'] = $value['author']; if ($value['status'] != 1 && !$value['first']) { $value['message'] = discuzcode($value['message'], $value['smileyoff'], $value['bbcodeoff'], $value['htmlon']); $value['cid'] = $value['pid']; $commentlist[$value['pid']] = $value; if ($value['attachment']) { $attachpids[] = $value['pid']; if (preg_match_all("/\\[attach\\](\\d+)\\[\\/attach\\]/i", $value['message'], $matchaids)) { $attachtags[$value['pid']] = $matchaids[1]; }
function getcount() { $result = 1; $amount = $this->curadmin . getcount(); if (intval($amount / $this->onpage) > $amount / $this->onpage) { $result = intval($amount / $this->onpage) + 1; } else { $result = intval($amount / $this->onpage); } return result; }
@(include S_ROOT . './data/data_convert.php'); if ($set) { $tpre = '`' . $set['dbname'] . '`.' . $set['tablepre']; } $lockfile = './data/convert.lock'; if (file_exists($lockfile)) { show_msg('警告!您已经转换过数据<br> 为了保证数据安全,请立即手动删除 convert.php 文件<br> 如果您想重新转换数据,请删除 data/convert.lock 文件,再次运行本文件'); } if (submitcheck('setsubmit')) { include_once S_ROOT . './source/function_cache.php'; cache_write('convert', "set", $_POST['set']); show_msg('数据库保存完成', $turl . '?step=300'); } elseif (submitcheck('opensubmit')) { $uid = getcount('member', array('username' => $_POST['username']), 'uid'); if (!$uid) { show_msg('指定的用户名不存在,请谨慎填写管理员用户名', 'convert.php?step=18'); } //写log if (@($fp = fopen($lockfile, 'w'))) { fwrite($fp, 'UCenter Home'); fclose($fp); } updatetable('space', array('groupid' => 1), array('uid' => $uid)); show_msg('设置管理员成功,数据转换全部完成!<br> <font color=blue>请立即删除本转换文件!</font><br> <a href="space.php">登录全新的 UCenter Home 吧</a><br> 登录后,推荐你进行一下操作:<br> 进入 管理平台 => 统计更新 页面,对各项统计数据进行一下重新统计。'); }
if ($filtrate) { $filtrate--; } else { if ($count < $perpage) { if ($type && $value['appid'] == $type) { $list[$key][] = $value; $count++; } elseif (!$type) { $list[$key][] = $value; $count++; } } } } //统计更新 $myinvitenum = getcount('myinvite', array('touid' => $space['uid'])); if ($myinvitenum != $space['myinvitenum']) { updatetable('space', array('myinvitenum' => $myinvitenum), array('uid' => $space['uid'])); } //分页 $multi = smulti($start, $perpage, $count, "space.php?do={$do}&view=userapp"); } else { if (!empty($_GET['ignore'])) { updatetable('notification', array('new' => '0'), array('new' => '1', 'uid' => $_SGLOBAL['supe_uid'])); updatetable('space', array('notenum' => 0), array('uid' => $_SGLOBAL['supe_uid'])); $space['notenum'] = 0; } //通知类型 $noticetypes = array('wall' => lang('wall'), 'piccomment' => lang('pic_comment'), 'blogcomment' => lang('blog_comment'), 'clickblog' => lang('clickblog'), 'clickpic' => lang('clickpic'), 'clickthread' => lang('clickthread'), 'sharecomment' => lang('share_comment'), 'sharenotice' => lang('share_notice'), 'doing' => lang('doing_comment'), 'friend' => lang('friend_notice'), 'post' => lang('thread_comment'), 'credit' => lang('credit'), 'mtag' => lang('mtag'), 'event' => lang('event'), 'eventcomment' => lang('event_comment'), 'eventmember' => lang('event_member'), 'eventmemberstatus' => lang('event_memberstatus'), 'poll' => lang('poll'), 'pollcomment' => lang('poll_comment'), 'pollinvite' => lang('poll_invite'), 'clickbwzt' => lang('clickbwzt'), 'bwztcomment' => lang('bwzt_comment')); $type = trim($_GET['type']); $typesql = $type ? "AND type='{$type}'" : '';
if ($page < 1) { $page = 1; } $perpage = 6; $perpage = mob_perpage($perpage); $start = ($page - 1) * $perpage; ckstart($start, $perpage); $albumlist = array(); $query = DB::query("SELECT * FROM " . DB::table('home_album') . " WHERE uid='{$space['uid']}' ORDER BY updatetime DESC"); while ($value = DB::fetch($query)) { if (!isset($_GET['albumid']) && empty($albumid)) { $albumid = $value['albumid']; } $albumlist[$value['albumid']] = $value; } $count = getcount('home_pic', array('albumid' => 0, 'uid' => $space['uid'])); $albumlist[0] = array('uid' => $space['uid'], 'albumid' => 0, 'albumname' => lang('space', 'default_albumname'), 'picnum' => $count); if ($albumid > 0) { if (!isset($albumlist[$albumid])) { showmessage('to_view_the_photo_does_not_exist'); } $wheresql = "albumid='{$albumid}'"; $count = $albumlist[$albumid]['picnum']; } else { $wheresql = "albumid='0' AND uid='{$space['uid']}'"; } $list = array(); if ($count) { $query = DB::query("SELECT * FROM " . DB::table('home_pic') . " WHERE {$wheresql} ORDER BY dateline DESC LIMIT {$start},{$perpage}"); while ($value = DB::fetch($query)) { $value['pic'] = pic_get($value['filepath'], 'album', $value['thumb'], $value['remote']);
$fuids = array(); $count = 0; $now_pos = 0; if (!in_array($_GET['view'], array('online', 'mm', 'gg', 'credit', 'experience', 'friendnum', 'viewnum', 'updatetime'))) { $_GET['view'] = 'show'; } if ($_GET['view'] == 'show') { $c_sql = "SELECT COUNT(*) FROM " . tname('show'); $sql = "SELECT space.*, field.*, main.* FROM " . tname('show') . " main\r\n\t\tLEFT JOIN " . tname('space') . " space ON space.uid=main.uid\r\n\t\tLEFT JOIN " . tname('spacefield') . " field ON field.uid=main.uid\r\n\t\tORDER BY main.credit DESC"; //清理 if (substr($_SGLOBAL['timestamp'], -1) == '0') { $_SGLOBAL['db']->query("DELETE FROM " . tname('show') . " WHERE credit<1"); //清理小于1的数据 } //我的竞价 points $space['showcredit'] = getcount('show', array('uid' => $space['uid']), 'credit'); $space['showcredit'] = intval($space['showcredit']); //我的位置 $cookie_name = 'space_top_' . $_GET['view']; if ($_SCOOKIE[$cookie_name]) { $now_pos = $_SCOOKIE[$cookie_name]; } else { $now_pos = $_SGLOBAL['db']->result($_SGLOBAL['db']->query("SELECT COUNT(*) FROM " . tname('show') . " WHERE credit>'{$space['showcredit']}'"), 0); $now_pos++; ssetcookie($cookie_name, $now_pos); } } elseif ($_GET['view'] == 'mm') { if ($multi_mode) { $c_sql = "SELECT COUNT(*) FROM " . tname('spacefield') . " WHERE sex='2'"; } else { $count = 100;
public function update($cachename) { global $_G; $sys = true; //$syn = false,代表不写入缓存,每次都读取 if (strpos($cachename, '_cate') !== false) { $tmp = explode('_', $cachename); $cate = new cate($tmp[0], $tmp[0]); $cache_data = $cate->get_cate(); $this->set($cachename, $cache_data, true, 1); return $cache_data; } switch ($cachename) { case 'all_channel': $all_channel = DB::fetch_all("SELECT * FROM " . DB::table('channel') . " ORDER BY `sort` DESC,fid ASC ", 'fid'); $tmp = array(); foreach ($all_channel as $k => $v) { $v[org_url] = $v[url]; $v[url] = '/index.php?fid=' . $v[fid]; $tmp['k' . $k] = $v; } $cache_data = $tmp; break; case 'channels': $all_channel = DB::fetch_all("SELECT * FROM " . DB::table('channel') . " ORDER BY `sort` DESC,fid ASC ", 'fid'); $channel = array(); //一级 foreach ($all_channel as $k => $v) { if ($v[fup] == 0) { //$v[count] = getcount('goods'," AND fid = ".$v[fid]); $v[org_url] = $v[url]; $v[url] = '/index.php?fid=' . $v[fid]; $channel[$k] = $v; } } //二级 $tmps = $all_channel; foreach ($channel as $k => $v) { $sub = array(); $fid_in = array(); unset($tmps[$v[fid]]); foreach ($all_channel as $kk => $vv) { if ($vv['fup'] == $k) { //$vv[count] = getcount('goods'," AND fid = ".$vv[fid]); $vv[org_url] = $vv[url]; $vv[url] = '/index.php?fid=' . $vv[fid]; $sub[$kk] = $vv; //二级栏目 $fid_in2 = array(); unset($tmps[$vv[fid]]); foreach ($all_channel as $k3 => $v3) { if ($v3['fup'] == $kk) { $v3[org_url] = $v3[url]; $v3[url] = '/index.php?fid=' . $v3[fid]; //$v3[count] = getcount('goods'," AND fid = ".$v3[fid]); unset($tmps[$v3[fid]]); $sub[$kk]['sub'][$k3] = $v3; //三级栏目 $fid_in2[] = $v3['fid']; $fid_in[] = $v3['fid']; $sub[$kk]['sub'][$k3]['fid_in'] = $v3['fid']; } } $fid_in[] = $vv['fid']; $fid_in2[] = $vv['fid']; $sub[$kk]['fid_in'] = implode(',', $fid_in2); } } $fid_in[] = $v['fid']; $channel[$k]['fid_in'] = implode(',', $fid_in); if ($sub) { $channel[$k]['sub'] = $sub; } } if (count($tmps) > 0) { foreach ($tmps as $k => $v) { if (!array_key_exists($k)) { $v[fid_in] = $v[fid]; $channel[$k] = $v; } } } $cache_data = $channel; break; case 'setting': set_setting('time', TIMESTAMP); $st = DB::fetch_all("SELECT * FROM " . DB::table('setting')); foreach ($st as $k => $v) { $setting[$v['name']] = $v['value']; } if ($setting['qq']) { $setting['qq'] = explode(',', $setting['qq']); } if ($setting['flag']) { $setting['flag'] = explode(',', $setting['flag']); $setting['flag'] = array_filter($setting['flag']); } if ($setting['shop_tag']) { $setting['shop_tag'] = explode(',', $setting['shop_tag']); $setting['shop_tag'] = array_filter($setting['shop_tag']); } if ($setting['goods_tag']) { $setting['goods_tag'] = explode(',', $setting['goods_tag']); $setting['goods_tag'] = array_filter($setting['goods_tag']); } if ($setting['article_tag']) { $setting['article_tag'] = explode(',', $setting['article_tag']); $setting['article_tag'] = array_filter($setting['article_tag']); } if ($setting['filter_field']) { $setting['filter_field'] = explode(',', $setting['filter_field']); } if ($setting['shiyong_status']) { $setting['shiyong_status'] = explode(',', $setting['shiyong_status']); } if ($setting['duihuan_status']) { $setting['duihuan_status'] = explode(',', $setting['duihuan_status']); } if ($setting['shiyong_tags']) { $setting['shiyong_tags'] = explode(',', $setting['shiyong_tags']); } if ($setting['activity_tags']) { $setting['activity_tags'] = explode(',', $setting['activity_tags']); } if ($setting['style_tags']) { $setting['style_tags'] = explode(',', $setting['style_tags']); } if ($setting['movie_tags']) { $setting['movie_tags'] = explode(',', $setting['movie_tags']); } if ($setting['zj_tags']) { $setting['zj_tags'] = explode(',', $setting['zj_tags']); } if ($setting['shishang_flag']) { $setting['shishang_flag'] = explode(',', $setting['shishang_flag']); } if ($setting['tags']) { $setting['tags'] = explode(',', $setting['tags']); $tags = array(); foreach ($setting['tags'] as $k => $v) { $uname = urlencode_utf8($v); $tags[$uname] = $v; } $setting['tags'] = $tags; } if ($setting['sign_jf']) { $setting['sign_jf'] = (array) dunserialize($setting['sign_jf']); } if ($setting['sign_tb']) { $setting['sign_tb'] = (array) dunserialize($setting['sign_tb']); } if ($setting['syn_table']) { $setting['syn_table'] = explode(',', $setting['syn_table']); } if ($setting['syn_domain']) { $setting['syn_domain'] = explode("\r\n", $setting['syn_domain']); } if ($setting['uz_tag']) { $setting['uz_tag'] = explode(',', $setting['uz_tag']); } if ($setting['uz_type']) { $setting['uz_type'] = explode(',', $setting['uz_type']); } $setting['time'] = TIMESTAMP; if ($setting['email']) { $setting['email'] = (array) dunserialize($setting['email']); } $cache_data = $setting; break; case 'friend_link': //友情链接 $friend_link = DB::fetch_all("SELECT * FROM " . DB::table('friend_link') . " ORDER BY sort DESC,id DESC", 'id'); foreach ($friend_link as $k => $v) { $friend_link[$k]['dateline'] = dgmdate($v['dateline'], 'u'); } $cache_data = $friend_link; break; case 'pics_type': $cache_data = DB::fetch_all("SELECT * FROM " . DB::table('pics_type') . " ORDER BY id DESC", 'id'); break; case 'pics': $pics_type = DB::fetch_all("SELECT * FROM " . DB::table('pics_type') . " ORDER BY id DESC", 'id'); $pics_tmp = DB::fetch_all("SELECT * FROM " . DB::table('pics') . " ORDER BY sort ASC,id DESC ", 'id'); $pics = array(); foreach ($pics_type as $k => $v) { $pics[$k] = array(); foreach ($pics_tmp as $k1 => $v1) { $v1['org_dateline'] = $v1['dateline']; $v1['dateline'] = dgmdate($v1['dateline'], 'u'); if ($v1['fup'] == $k) { $pics[$k][$k1] = $v1; } } } $cache_data = set_key($pics); break; case 'ad': $ad = DB::fetch_all("SELECT * FROM " . DB::table('ad') . " ORDER BY id DESC ", 'id'); foreach ($ad as $k => $v) { $ad[$k]['org_dateline'] = $v[dateline]; $ad[$k]['dateline'] = dgmdate($v[dateline], 'u'); $ad[$k]['start_time'] = dgmdate($v[start_time], 'dt'); $ad[$k]['end_time'] = dgmdate($v[end_time], 'dt'); $ad[$k]['show'] = false; $ad[$k]['show_html'] = ''; //先判断是否在显示时间内 $show = 0; if ($v['start_time'] < TIMESTAMP && ($v['end_time'] == 0 || $v['end_time'] > TIMESTAMP)) { $show = 1; } if ($show == true && $v['hide'] == 0) { $html = ''; if ($v['type'] == 1) { $html = $v['content']; } elseif ($v['type'] == 2) { $width = $v['width'] > 0 ? "width='" . $v['width'] . "'" : ''; $height = $v['height'] > 0 ? "height='" . $v['height'] . "'" : ''; $img = "<img class='ads_" . $k . "' src='" . $v['picurl'] . "' " . $width . "" . $height . " />"; if ($v['url']) { $target = $v['target'] == 1 ? "target='_blank'" : ''; $html = "<a href='" . $v['url'] . "' " . $target . " >" . $img . "</a>"; } else { $html = $img; } } else { $html = $v['html']; } if (!empty($html)) { $ad[$k]['show'] = true; $ad[$k]['show_html'] = $html; } else { $ad[$k]['show_html'] = ''; } } } $cache_data = set_key($ad); break; case 'goods_cate': $cate = new cate('goods', 'goods'); $cache_data = $cate->get_cate(); break; case 'shop': $shop = DB::fetch_all("SELECT * FROM " . DB::table('shop') . " ORDER BY sort DESC,id DESC", 'id'); foreach ($shop as $k => $v) { $shop[$k] = parse('shop', $v); } $cache_data = $shop; break; case 'shop_cate': $cate = new cate('shop', 'shop'); $cache_data = $cate->get_cate(); break; case 'prize': $rs = DB::fetch_all("SELECT * FROM " . DB::table('prize') . " ORDER BY sort DESC ,id DESC ", 'id'); foreach ($rs as $k => $v) { //统计每个分类,还未中奖的中奖码.. $rs[$k][num] = $rs[$k][count] = getcount('ticket', "prizeid = " . $v[id] . " AND is_use=0"); $rs[$k][total] = getcount('ticket', "prizeid = " . $v[id]); } $cache_data = $rs; break; case 'table': $cache_data = update_table(); break; case 'group': $rs = DB::fetch_all("SELECT * FROM " . DB::table('group') . " ORDER BY id ASC", 'id'); foreach ($rs as $k => $v) { $rs[$k][power] = dunserialize($v['power']); } $cache_data = $rs; break; case 'rank': $rs = DB::fetch_all("SELECT * FROM " . DB::table('rank') . " ORDER BY id ASC", 'id'); $cache_data = $rs; break; default: $sys = false; $cache_data = ''; break; } if ($sys == true) { $this->set($cachename, $cache_data, true, 1); } return $cache_data; }
$sql = "SELECT * FROM et_messages WHERE senduid='{$user['user_id']}' order by message_id desc limit {$start},10"; } $query = $db->query($sql); while ($data = $db->fetch_array($query)) { $messagebody = wapreplace($data['messagebody']); if ($pmtp == "my") { echo "<li>来自:"; } else { echo "<li>发给:"; } echo "<a href='index.php?op=home&uid={$data[senduid]}'>{$data[sendnickname]}</a> {$messagebody} <span class='stamp'>" . timeop($data['sendtime']) . " <a href='index.php?op=privatemsg&act=delpmsg&mid={$data[message_id]}'>删除</a></span></li>"; } echo "</ul>"; //分页 if ($pmtp == "my") { $total = getcount('et_messages', array('sendtouid' => $user[user_id])); } else { $total = getcount('et_messages', array('senduid' => $user[user_id])); } $pg_num = ceil($total / 10); if ($pg_num > 1) { echo "<div class='page'>"; if ($page - 1 > 0) { echo "<a href='index.php?op=privatemsg&pmtp={$pmtp}&page=" . ($page - 1) . "'>上页</a> "; } if ($page + 1 <= $pg_num) { echo "<a href='index.php?op=privatemsg&pmtp={$pmtp}&page=" . ($page + 1) . "'>下页</a> "; } echo "| " . $page . "/" . $pg_num; echo "</div>"; }