static function _init_global() { global $_G; include_once ROOT_PATH . 'inc/config/db.config.php'; $_G = array('uid' => 0, 'adminid' => 0, 'siteurl' => 'http://' . $_SERVER['HTTP_HOST'] . '/', 'clientip' => get_client_ip(), 'referer' => $_SERVER['HTTP_REFERER'], 'host' => $_SERVER['HTTP_HOST'], 'domain' => $_SERVER['HTTP_HOST'], 'username' => '', 'is_show' => false, 'cpmsg' => false, 'login_img' => '', 'cache_type' => 'auto', 'today' => dgmdate(TIMESTAMP, 'd'), 'dateline' => dgmdate(TIMESTAMP, 'dt'), 'authkey' => $_config[authkey], 'inajax' => intval($_GET['inajax']) > 0 ? true : false, 'id' => isset($_GET['id']) && $_GET['id'] > 0 ? intval($_GET['id']) : 0, 'aid' => isset($_GET['aid']) && $_GET['aid'] > 0 ? intval($_GET['aid']) : 0, 'fid' => isset($_GET['fid']) && $_GET['fid'] > 0 ? intval($_GET['fid']) : 0, 'cate' => $_GET['cate'] > 0 ? intval($_GET['cate']) : 0, 'page' => $_GET['page'] > 0 ? intval($_GET['page']) : 1, 'page_end' => '', 'qq_zone' => 0, 'mobile' => false, 'pad' => false, '_config' => $_config, 'goods_sql' => array(), 'memory_list' => array(), 'goods_cache' => array(), 'member' => array(), 'user' => array(), 'setting' => array(), 'api_list' => array(), 'channel' => array(), 'channels' => array(), 'friend_link' => array(), 'goods' => array(), 'pics_type' => array(), 'pics' => array(), 'ad' => array(), 'table' => array(), 'showpage' => '', 'keywords' => '', 'description' => '', 'TOP' => NULL); if (DEBUG) { $_G['starttime'] = microtime(true); $_G['runtime'] = 0; } //缓存类型 $cache = $_config['cache_type']; if ($cache == 'auto') { if (TAE) { $cache = 'baichuan'; } else { if (class_exists('Memcache')) { $cache = 'memcache'; } else { $cache = 'file'; } } } $_G['cache_type'] = $cache; if (isset($_SERVER['HTTP_X_REQUESTED_WITH']) && $_SERVER['HTTP_X_REQUESTED_WITH'] == 'XMLHttpRequest') { $_G[inajax] = 1; } $_G['siteurl'] = get_siteurl(); $_G['siteurl2'] = $_G['siteurl']; //$host = explode('.',$_G[host]); //$len = count($host)-2; //$_G[domain] = $host[$len] .'.'. end($host); unset($_config); }
function viewthread_sidetop_output($a) { //var_dump($a); global $_G, $postlist; if ($a["template"] == "viewthread") { $aid = $_G['forum_thread']['authorid']; $return = array(); $tid = $_G['tid']; if ($postlist && $aid) { foreach ($postlist as $value) { if ($value['first']) { $amu_query = DB::fetch_first("SELECT * FROM " . DB::table("plugin_dsuampper") . " WHERE uid= '{$aid}'"); if ($amu_query) { $today = $this->vars['today']; $lasttime = dgmdate($query['lasttime'], 'Ymd', $this->vars['offset']); } if (!$amu_query['addup'] || $today != $lasttime) { $addup = $amu_query['addup'] ? $amu_query['addup'] : 0; $return[0] = '<dl class="pil cl"><dt><a href="plugin.php?id=dsu_amupper:list" target="_blank" class="xi2">' . lang('plugin/dsu_amupper', 'vw') . '</a></dt><dd>' . $addup . '</dd></dl>'; } if ($amu_query && $today == $lasttime) { $addup = $amu_query['addup'] ? $amu_query['addup'] : 0; $return[0] = '<dl class="pil cl"><dt><a href="plugin.php?id=dsu_amupper:list" target="_blank" class="xi2">' . lang('plugin/dsu_amupper', 'vw') . '</a></dt><dd><b>' . $addup . '</b></dd></dl>'; } } } } } else { $return = array(); } return $return; }
function usesubmit() { global $_G; if (empty($_G['gp_tid'])) { showmessage(lang('magic/sofa', 'sofa_info_nonexistence')); } $thread = getpostinfo($_G['gp_tid'], 'tid', array('fid', 'authorid', 'dateline', 'subject')); $this->_check($thread); $firstsofa = DB::result_first("SELECT COUNT(*) FROM " . DB::table('forum_threadmod') . " WHERE magicid='" . $this->magic['magicid'] . "' AND tid='{$_G['gp_tid']}'"); if ($firstsofa >= 1) { showmessage(lang('magic/sofa', 'sofa_info_sofaexistence'), '', array(), array('login' => 1)); } $sofamessage = lang('magic/sofa', 'sofa_text', array('actor' => $_G['member']['username'], 'time' => dgmdate(TIMESTAMP), 'magicname' => $this->magic['name'])); $dateline = $thread['dateline'] + 1; insertpost(array('fid' => $thread['fid'], 'tid' => $_G['gp_tid'], 'first' => '0', 'author' => $_G['username'], 'authorid' => $_G['uid'], 'dateline' => $dateline, 'message' => $sofamessage, 'useip' => $_G['clientip'], 'usesig' => '1')); DB::query("UPDATE " . DB::table('forum_thread') . " SET replies=replies+1, moderated='1' WHERE tid='{$_G['tid']}'", 'UNBUFFERED'); DB::query("UPDATE " . DB::table('forum_forum') . " SET posts=posts+1, todayposts=todayposts+1 WHERE fid='{$post['fid']}'", 'UNBUFFERED'); usemagic($this->magic['magicid'], $this->magic['num']); updatemagiclog($this->magic['magicid'], '2', '1', '0', 0, 'tid', $_G['gp_tid']); updatemagicthreadlog($_G['gp_tid'], $this->magic['magicid']); if ($thread['authorid'] != $_G['uid']) { notification_add($thread['authorid'], 'magic', lang('magic/sofa', 'sofa_notification'), array('tid' => $_G['gp_tid'], 'subject' => $thread['subject'], 'magicname' => $this->magic['name'])); } showmessage(lang('magic/sofa', 'sofa_succeed'), dreferer(), array(), array('showdialog' => 1, 'locationtime' => 1)); }
function output() { global $_G; $noticelang = lang('notification', 'reppost_noticeauthor'); $noticepreg = '/^' . str_replace(array('\\{actor\\}', '\\{subject\\}', '\\{tid\\}', '\\{pid\\}'), array('(.+?)', '(.+?)', '(\\d+)', '(\\d+)'), preg_quote($noticelang, '/')) . '$/'; $actorlang = '<a href="home.php?mod=space&uid={actoruid}">{actorusername}</a>'; $actorpreg = '/^' . str_replace(array('\\{actoruid\\}', '\\{actorusername\\}'), array('(\\d+)', '(.+?)'), preg_quote($actorlang, '/')) . '$/'; foreach ($GLOBALS['list'] as $_k => $_v) { if (preg_match($noticepreg, $_v['note'], $_r)) { list(, $actor, $tid, $pid, $subject) = $_r; if (preg_match($actorpreg, $actor, $_r)) { list(, $actoruid, $actorusername) = $_r; } //取出回帖的内容 include_once libfile('function/forum'); require_once libfile('function/discuzcode'); loadforum(null, $tid); if ($pid) { $postlist = $this->post = get_post_by_pid($pid, 'message'); $GLOBALS['list'][$_k]['message'] = discuzcode($postlist['message']); } $GLOBALS['list'][$_k]['dateline'] = dgmdate($GLOBALS['list'][$_k]['dateline']); $GLOBALS['list'][$_k]['dbdateline'] = $GLOBALS['list'][$_k]['dateline']; $GLOBALS['list'][$_k]['notevar'] = array('tid' => $tid, 'pid' => $pid, 'subject' => $subject, 'actoruid' => $actoruid, 'actorusername' => $actorusername); } } $variable = array('hash' => md5(substr(md5($_G['config']['security']['authkey']), 8) . $_G['uid']), 'list' => mobile_core::getvalues(array_values($GLOBALS['list']), array('/^\\d+$/'), array('id', 'uid', 'type', 'new', 'authorid', 'author', 'note', 'dateline', 'from_id', 'from_idtype', 'from_num', 'style', 'rowid', 'notevar', 'message')), 'count' => $GLOBALS['count'], 'perpage' => $GLOBALS['perpage'], 'page' => intval($GLOBALS['page'])); mobile_core::result(mobile_core::variable($variable)); }
function build_cache_forumrecommend() { $data = array(); $fids = C::t('forum_forum')->fetch_all_fids(); foreach ($fids as $row) { require_once libfile('function/group'); $recommendlist = C::t('forum_forum')->fetch_all_recommend_by_fid($row['fid']); foreach ($recommendlist as $info) { $group = array('fid' => $info['fid'], 'name' => $info['name'], 'threads' => $info['threads'], 'lastpost' => $info['lastpost'], 'icon' => $info['icon'], 'membernum' => $info['membernum'], 'description' => $info['description']); $group['icon'] = get_groupimg($group['icon'], 'icon'); $lastpost = array(0, 0, '', ''); $group['lastpost'] = is_string($group['lastpost']) ? explode("\t", $group['lastpost']) : $group['lastpost']; $group['lastpost'] = count($group['lastpost']) != 4 ? $lastpost : $group['lastpost']; list($lastpost['tid'], $lastpost['subject'], $lastpost['dateline'], $lastpost['author']) = $group['lastpost']; if ($lastpost['tid']) { $lastpost['dateline'] = dgmdate($lastpost['dateline'], 'Y-m-d H:i:s'); if ($lastpost['author']) { $lastpost['encode_author'] = rawurlencode($lastpost['author']); } $group['lastpost'] = $lastpost; } else { $group['lastpost'] = ''; } $data[$row['fid']][] = $group; } } savecache('forumrecommend', $data); }
function global_header_mobile() { global $_G, $show_message; function dsu_signtz() { dheader('Location: plugin.php?id=dsu_paulsign:sign&mobile=yes'); } $var = $_G['cache']['plugin']['dsu_paulsign']; if (defined('IN_dsu_paulsign') || $show_message || defined('IN_dsu_paulsc') || !$_G['uid'] || !$var['ifopen'] || !$var['wap_sign']) { return ''; } $tdtime = gmmktime(0, 0, 0, dgmdate($_G['timestamp'], 'n', $var['tos']), dgmdate($_G['timestamp'], 'j', $var['tos']), dgmdate($_G['timestamp'], 'Y', $var['tos'])) - $var['tos'] * 3600; $allowmem = memory('check'); if ($var['ftopen'] && in_array($_G['groupid'], unserialize($var['tzgroupid'])) && !in_array($_G['uid'], explode(",", $var['ban'])) && in_array($_G['groupid'], unserialize($var['groups']))) { if ($allowmem && $var['mcacheopen']) { $signtime = memory('get', 'dsu_pualsign_' . $_G['uid']); } if (!$signtime) { $qiandaodb = DB::fetch_first("SELECT time FROM " . DB::table('dsu_paulsign') . " WHERE uid='{$_G['uid']}'"); $signtime = $qiandaodb['time']; $htime = dgmdate($_G['timestamp'], 'H', $var['tos']); if ($qiandaodb) { if ($allowmem && $var['mcacheopen']) { memory('set', 'dsu_pualsign_' . $_G['uid'], $qiandaodb['time'], 86400); } if ($qiandaodb['time'] < $tdtime) { if ($var['timeopen']) { if (!($htime < $var['stime']) && !($htime > $var['ftime'])) { return dsu_signtz(); } } else { return dsu_signtz(); } } } else { $ttps = DB::fetch_first("SELECT posts FROM " . DB::table('common_member_count') . " WHERE uid='{$_G['uid']}'"); if ($var['mintdpost'] <= $ttps['posts']) { if ($var['timeopen']) { if (!($htime < $var['stime']) && !($htime > $var['ftime'])) { return dsu_signtz(); } } else { return dsu_signtz(); } } } } else { if ($signtime < $tdtime) { if ($var['timeopen']) { if (!($htime < $var['stime']) && !($htime > $var['ftime'])) { return dsu_signtz(); } } else { return dsu_signtz(); } } } } return '<a href="plugin.php?id=dsu_paulsign:sign">' . lang('plugin/dsu_paulsign', 'name') . '</a>'; }
private function _getAnnouncementInfo($res, $id) { global $_G; require_once libfile('function/discuzcode'); $announce = DzForumAnnouncement::getAnnouncementByUid($id); if (!count($announce)) { $res = $this->makeErrorInfo($res, 'announcement_nonexistence'); } else { $tempAnnounce = array(); $tempAnnounce['author'] = $announce['author']; $tmp = explode('.', dgmdate($announce['starttime'], 'Y.m')); $months[$tmp[0] . $tmp[1]] = $tmp; if (!empty($_GET['m']) && $_GET['m'] != dgmdate($announce['starttime'], 'Ym')) { continue; } $tempAnnounce['starttime'] = dgmdate($announce['starttime'], 'd'); $tempAnnounce['endtime'] = $announce['endtime'] ? dgmdate($announce['endtime'], 'd') : ''; $tempAnnounce['title'] = WebUtils::emptyHtml($announce['subject']); $uid = DzCommonMember::getUidByUsername($announce['author']); $tempAnnounce['icon'] = UserUtils::getUserAvatar($uid); $announceMessage = $announce['type'] == 1 ? "{$announce[message]}" : $announceMessage; $announceMessage = nl2br(discuzcode($announce['message'], 0, 0, 1, 1, 1, 1, 1)); $announceType = array(); $announceType['infor'] = WebUtils::emptyHtml($announceMessage); $announce['type'] == 1 ? $announceType['type'] = 'url' : ($announceType['type'] = 'text'); $tempAnnounce['content'] = $announceType; $res['body']['list'] = $tempAnnounce; } return $res; }
public function fetch_all_will_birthday_by_uid($uids) { $birthlist = array(); if (!empty($uids)) { $uids = explode(',', (string) $uids); $uids = dimplode(dintval($uids, true)); list($s_month, $s_day) = explode('-', dgmdate(TIMESTAMP - 3600 * 24 * 3, 'n-j')); list($n_month, $n_day) = explode('-', dgmdate(TIMESTAMP, 'n-j')); list($e_month, $e_day) = explode('-', dgmdate(TIMESTAMP + 3600 * 24 * 7, 'n-j')); if ($e_month == $s_month) { $wheresql = "sf.birthmonth='{$s_month}' AND sf.birthday>='{$s_day}' AND sf.birthday<='{$e_day}'"; } else { $wheresql = "(sf.birthmonth='{$s_month}' AND sf.birthday>='{$s_day}') OR (sf.birthmonth='{$e_month}' AND sf.birthday<='{$e_day}' AND sf.birthday>'0')"; } $query = DB::query("SELECT sf.uid,sf.birthyear,sf.birthmonth,sf.birthday,s.username\n\t\t\t\tFROM " . DB::table('common_member_profile') . " sf\n\t\t\t\tLEFT JOIN " . DB::table('common_member') . " s USING(uid)\n\t\t\t\tWHERE (sf.uid IN ({$uids})) AND ({$wheresql})"); while ($value = DB::fetch($query)) { $value['istoday'] = 0; if ($value['birthmonth'] == $n_month && $value['birthday'] == $n_day) { $value['istoday'] = 1; } $key = sprintf("%02d", $value['birthmonth']) . sprintf("%02d", $value['birthday']); $birthlist[$key][] = $value; ksort($birthlist); } } return $birthlist; }
function album_creat_by_id($albumid) { global $_G, $space; preg_match("/^new\\:(.+)\$/i", $albumid, $matchs); if (!empty($matchs[1])) { $albumname = dhtmlspecialchars(trim($matchs[1])); if (empty($albumname)) { $albumname = dgmdate($_G['timestamp'], 'Ymd'); } $albumid = album_creat(array('albumname' => $albumname)); } else { $albumid = intval($albumid); if ($albumid) { $query = DB::query("SELECT albumname,friend FROM " . DB::table('home_album') . " WHERE albumid='{$albumid}' AND uid='{$_G['uid']}'"); if ($value = DB::fetch($query)) { $albumname = addslashes($value['albumname']); $albumfriend = $value['friend']; } else { $albumname = dgmdate($_G['timestamp'], 'Ymd'); $albumid = album_creat(array('albumname' => $albumname)); } } } return $albumid; }
public function fetch_all_by_bid($bid, $isverified = 1, $start = 0, $limit = 0, $bannedids = array(), $format = true) { $data = array(); if ($bid = dintval($bid, true)) { $addsql = $bannedids = dintval($bannedids, true) ? ' AND id NOT IN (' . dimplode($bannedids) . ')' : ''; $query = DB::query('SELECT * FROM %t WHERE ' . DB::field('bid', $bid) . ' AND isverified=%d' . $addsql . ' ORDER BY stickgrade DESC, displayorder DESC, verifiedtime DESC, dataid DESC ' . DB::limit($start, $limit), array($this->_table, $isverified)); while ($value = DB::fetch($query)) { if ($format) { $value['fields'] = unserialize($value['fields']); $value['fields']['timestamp'] = $value['fields']['dateline']; $value['fields']['dateline'] = dgmdate($value['fields']['dateline']); $value['pic'] = $value['pic'] !== STATICURL . 'image/common/nophoto.gif' ? $value['pic'] : ''; if ($value['pic'] && $value['picflag'] == '1') { $value['pic'] = getglobal('setting/attachurl') . $value['pic']; } elseif ($value['picflag'] == '2') { $value['pic'] = getglobal('setting/ftp/attachurl') . $value['pic']; } $value['dateline'] = dgmdate($value['dateline'], 'u'); $value['verifiedtime'] = dgmdate($value['verifiedtime'], 'u'); } $data[$value['id']] = $value; } } return $data; }
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 sanree_brand_mobile() { if ($this->chkwap()) { define('IN_SANREE_MOBILE', TRUE); $GLOBALS['curtime'] = dgmdate(TIMESTAMP); } }
function huxcity() { global $_G; $citysetting = $_G['cache']['plugin']['huxcity']; $uid = $_G['uid']; $username = $_G['username']; if (($citysetting['powtobbs'] == '1' || $citysetting['bantobbs'] == '1') && $uid) { $uidnum = C::t('#huxcity#hux_city_user')->fetch_by_uid($uid, 'power,bantime'); if (!$uidnum) { $setarr = array('uid' => $uid, 'username' => $username, 'power' => 100, 'regtime' => TIMESTAMP); C::t('hux_city_user')->insert($setarr); } else { $userpow = $uidnum['power']; } } if ($citysetting['powtobbs'] == '1' && $uid && $uidnum && $userpow <= 0) { $nopow_msg = lang('plugin/huxcity', 'no_pow'); $pow_yes = lang('plugin/huxcity', 'pow_yes'); $pow_no = lang('plugin/huxcity', 'pow_no'); include template('huxcity:powtobbs'); return $return; } elseif ($citysetting['bantobbs'] == '1' && $uid && $uidnum && $uidnum['bantime'] != 0) { $ban_msg = lang('plugin/huxcity', 'baned') . dgmdate($uidnum['bantime']); $ban_yes = lang('plugin/huxcity', 'ban_yes'); $ban_no = lang('plugin/huxcity', 'ban_no'); include template('huxcity:bantobbs'); return $returnb; } else { return ''; } }
function build_cache_forumrecommend() { $data = array(); $query = DB::query("SELECT fid FROM " . DB::table('forum_forum') . " WHERE type<>'group' AND status<>3"); while ($row = DB::fetch($query)) { require_once libfile('function/group'); $squery = DB::query("SELECT f.fid, f.name, f.threads, f.lastpost, ff.icon, ff.membernum, ff.description FROM " . DB::table('forum_forum') . " f LEFT JOIN " . DB::table('forum_forumfield') . " ff ON ff.fid=f.fid WHERE recommend='{$row['fid']}'"); while ($group = DB::fetch($squery)) { $group['icon'] = get_groupimg($group['icon'], 'icon'); $lastpost = array(0, 0, '', ''); $group['lastpost'] = is_string($group['lastpost']) ? explode("\t", $group['lastpost']) : $group['lastpost']; $group['lastpost'] = count($group['lastpost']) != 4 ? $lastpost : $group['lastpost']; list($lastpost['tid'], $lastpost['subject'], $lastpost['dateline'], $lastpost['author']) = $group['lastpost']; if ($lastpost['tid']) { $lastpost['dateline'] = dgmdate($lastpost['dateline'], 'Y-m-d H:i:s'); if ($lastpost['author']) { $lastpost['encode_author'] = rawurlencode($lastpost['author']); } $group['lastpost'] = $lastpost; } else { $group['lastpost'] = ''; } $data[$row['fid']][] = $group; } } save_syscache('forumrecommend', $data); }
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 album_creat_by_id($albumid, $catid = 0) { global $_G, $space; preg_match("/^new\\:(.+)\$/i", $albumid, $matchs); if (!empty($matchs[1])) { $albumname = dhtmlspecialchars(trim($matchs[1])); if (empty($albumname)) { $albumname = dgmdate($_G['timestamp'], 'Ymd'); } $albumarr = array('albumname' => $albumname); if ($catid) { $albumarr['catid'] = $catid; } $albumid = album_creat($albumarr); } else { $albumid = intval($albumid); if ($albumid) { $value = C::t('home_album')->fetch_all_by_uid($_G['uid'], false, 0, 0, $albumid); if ($value = $value[0]) { $albumname = addslashes($value['albumname']); $albumfriend = $value['friend']; } else { $albumname = dgmdate($_G['timestamp'], 'Ymd'); $albumarr = array('albumname' => $albumname); if ($catid) { $albumarr['catid'] = $catid; } $albumid = album_creat($albumarr); } } } return $albumid; }
public static function writelog($file, $log) { global $_G; $yearmonth = dgmdate(TIMESTAMP, 'Ym', $_G['setting']['timeoffset']); $logdir = DZZ_ROOT . './data/log/'; $logfile = $logdir . $yearmonth . '_' . $file . '.php'; if (@filesize($logfile) > 2048000) { $dir = opendir($logdir); $length = strlen($file); $maxid = $id = 0; while ($entry = readdir($dir)) { if (strpos($entry, $yearmonth . '_' . $file) !== false) { $id = intval(substr($entry, $length + 8, -4)); $id > $maxid && ($maxid = $id); } } closedir($dir); $logfilebak = $logdir . $yearmonth . '_' . $file . '_' . ($maxid + 1) . '.php'; @rename($logfile, $logfilebak); } if ($fp = @fopen($logfile, 'a')) { @flock($fp, 2); if (!is_array($log)) { $log = array($log); } foreach ($log as $tmp) { fwrite($fp, "<?PHP exit;?>\t" . str_replace(array('<?', '?>'), '', $tmp) . "\n"); } fclose($fp); } }
function usesubmit() { global $_G; if (empty($_GET['username'])) { showmessage(lang('magic/checkonline', 'checkonline_info_nonexistence')); } $member = getuserinfo($_GET['username']); $this->_check($member['groupid']); $online = C::app()->session->fetch_by_uid($member['uid']); usemagic($this->magic['magicid'], $this->magic['num']); updatemagiclog($this->magic['magicid'], '2', '1', '0', 0, 'uid', $member['uid']); if ($member['uid'] != $_G['uid']) { notification_add($member['uid'], 'magic', lang('magic/checkonline', 'checkonline_notification'), array('magicname' => $this->magic['name']), 1); } if ($online) { $time = dgmdate($online['lastactivity'], 'u'); if ($online['invisible']) { showmessage(lang('magic/checkonline', 'checkonline_hidden_message'), '', array('username' => $_GET['username'], 'time' => $time), array('alert' => 'info', 'showdialog' => 1)); } else { showmessage(lang('magic/checkonline', 'checkonline_online_message'), '', array('username' => $_GET['username'], 'time' => $time), array('alert' => 'info', 'showdialog' => 1)); } } else { showmessage(lang('magic/checkonline', 'checkonline_offline_message'), '', array('username' => $_GET['username']), array('alert' => 'info', 'showdialog' => 1)); } }
function usesubmit() { global $_G; if (empty($_G['gp_username'])) { showmessage(lang('magic/checkonline', 'checkonline_info_nonexistence')); } $member = getuserinfo($_G['gp_username'], array('uid', 'groupid')); $this->_check($member['groupid']); $online = DB::fetch_first("SELECT action, lastactivity, invisible FROM " . DB::table('common_session') . " WHERE uid='{$member['uid']}'"); usemagic($this->magic['magicid'], $this->magic['num']); updatemagiclog($this->magic['magicid'], '2', '1', '0', 0, 'uid', $member['uid']); if ($member['uid'] != $_G['uid']) { notification_add($member['uid'], 'magic', lang('magic/checkonline', 'checkonline_notification'), array('magicname' => $this->magic['name']), 1); } if ($online) { $time = dgmdate($online['lastactivity'], 'u'); if ($online['invisible']) { showmessage(lang('magic/checkonline', 'checkonline_hidden_message'), '', array('username' => stripslashes($_G['gp_username']), 'time' => $time), array('showdialog' => 1)); } else { showmessage(lang('magic/checkonline', 'checkonline_online_message'), '', array('username' => stripslashes($_G['gp_username']), 'time' => $time), array('showdialog' => 1)); } } else { showmessage(lang('magic/checkonline', 'checkonline_offline_message'), '', array('username' => stripslashes($_G['gp_username'])), array('showdialog' => 1)); } }
function home() { global $_G; $today = dgmdate(TIMESTAMP, 'dt'); $sign = D(array('table' => 'sign', 'and' => "AND uid = " . $_G[uid] . " AND type ='sign' "), array('url' => 'm=home', 'size' => 10)); $sign[today] = $today; return $sign; }
function viewthread_posttop_output() { global $_G, $postlist; if (empty($postlist) || !is_array($postlist)) { return; } foreach ($postlist as $posts) { $pids[] = $posts['pid']; $return[$posts['pid']] = ''; } $query = DB::query("SELECT * FROM " . DB::table('forum_post') . " WHERE pid in(" . dimplode($pids) . ") AND first=1"); while ($table = DB::fetch($query)) { $tiddb = DB::fetch_first("SELECT * FROM " . DB::table('dsu_marcopostview') . " WHERE tid='{$_G['tid']}'"); $thread_view = '<font color=' . $this->view_color . '>' . $_G['forum_thread']['views'] . '</font>'; if ($tiddb['last_view'] == '(' . lang('plugin/dsu_marcopostview', 'class_php_6') . ')') { $view = "'" . lang('plugin/dsu_marcopostview', 'class_php_1') . "{$tiddb[guest]}" . lang('plugin/dsu_marcopostview', 'class_php_2') . "<br/>" . lang('plugin/dsu_marcopostview', 'class_php_3') . "{$tiddb[member]}" . lang('plugin/dsu_marcopostview', 'class_php_2') . "<br/>" . lang('plugin/dsu_marcopostview', 'class_php_4') . "{$tiddb[last_view]}'"; } else { $view = "'" . lang('plugin/dsu_marcopostview', 'class_php_1') . "{$tiddb[guest]}" . lang('plugin/dsu_marcopostview', 'class_php_2') . "<br/>" . lang('plugin/dsu_marcopostview', 'class_php_3') . "{$tiddb[member]}" . lang('plugin/dsu_marcopostview', 'class_php_2') . "<br/>" . lang('plugin/dsu_marcopostview', 'class_php_4') . "<a href=\\'{$_G['siteurl']}home.php?mod=space&username="******"\\' target=\\'_blank\\'>{$tiddb[last_view]}</a>'"; } if ($tiddb['guest'] + $tiddb['member'] <= 0) { $view_info = $thread_view; } else { $view_info = '<a href="javascript:;" onclick="showDialog(' . $view . ', \'notice\', \'' . lang('plugin/dsu_marcopostview', 'class_php_5') . '\', null, 0)">' . $thread_view . '</a>'; } $_G['forum_thread']['dateline'] = dgmdate($_G['forum_thread']['dateline'], 'dt', $_G['setting']['timeoffset']); $find = array("{bbname}", "{author}", "{dateline}", "{view_info}"); $replace = array($_G['setting']['bbname'], $_G['forum_thread']['author'], $_G['forum_thread']['dateline'], $view_info); $view_info = str_replace($find, $replace, $this->your_template); if ($this->open == 1) { if (!in_array($_G['fid'], $this->forums)) { if (!$tiddb) { DB::query("INSERT INTO " . DB::table('dsu_marcopostview') . " (tid,guest,member,last_view) VALUES ('{$_G['tid']}','0','0','{$_G['username']}')"); } else { if ($_G['uid'] && $_G['session']['invisible'] == 0) { DB::query("UPDATE " . DB::table('dsu_marcopostview') . " SET member=member+1,last_view='{$_G['username']}' WHERE tid='{$_G['tid']}'"); } elseif ($_G['uid'] && $_G['session']['invisible'] == 1) { DB::query("UPDATE " . DB::table('dsu_marcopostview') . " SET member=member+1,last_view='(" . lang('plugin/dsu_marcopostview', 'class_php_6') . ")' WHERE tid='{$_G['tid']}'"); } elseif (!$_G['uid']) { DB::query("UPDATE " . DB::table('dsu_marcopostview') . " SET guest=guest+1 WHERE tid='{$_G['tid']}'"); } } } } if ($this->open == 1) { if ($this->forums == '') { $return[$table['pid']] = ""; } elseif (in_array($_G['fid'], $this->forums)) { $return[$table['pid']] = ""; } else { $return[$table['pid']] = "{$view_info}<br />"; } } else { $return[$table['pid']] = ""; } return array_values($return); } }
function _istoday($time) { global $_G; $time = empty($time) ? 0 : $time; $today = dgmdate($_G['timestamp'], 'Ymd', $this->vars['offset']); $lastday = dgmdate($time, 'Ymd', $this->vars['offset']); $days = $lastday - $today; return $days; }
function get_user_level() { global $_G; $status = 0; $name = milu_lang('free_user'); $file_name = PICK_DIR . '/data/pick_auth.txt'; $msg_arr = array(); $vip_show = '<img border="0" src="' . PICK_URL . '/static/image/vip.gif" /> ' . milu_lang('vip_user') . ' '; $msg_arr = get_user_pick_info(); if ($msg_arr < 0) { $status = -1; $name = milu_lang('no_query_info'); } $web_qq = get_contents(GET_URL . 'plugin.php?id=pick_user:upgrade&myac=get_qq&tpl=no', array('cache' => 3600 * 24 * 2)); $msg_arr = unserialize($msg_arr); extract($msg_arr); $show_use_time = $exp_dateline ? " " . milu_lang('no_user_dateline') . ":<font style='color:#09C'>" . dgmdate($exp_dateline) . '</font>' : ''; if ($msg == 'succeed') { dsetcookie('pick_auth', $msg, -1); $show_use_time = $show_use_time ? $show_use_time : milu_lang('forever_use'); $name = $vip_show . $show_use_time; $status = 1; } else { if ($msg == 'timeout') { @unlink($file_name); $name = milu_lang('no_free_use'); $status = -2; } else { if ($msg == 'free' || $msg == 'first') { //如果是免费版本 if (VIP) { $status = 2; $name = milu_lang('free_use') . ' ' . $show_use_time; } } else { $status = -3; if ($msg == 'error') { $why = milu_lang('lan_network'); } else { $why = milu_lang('no_conn_server'); } $name = milu_lang('user_no_query') . ' (' . $why . ')'; } } } if ($status < 0) { $show_upgrade = ''; //服务器网络限制,无法检测升级 } else { $show_upgrade = VIP ? '<a href="?' . PICK_GO . 'pick_info&ac=pick_check">' . milu_lang('check_new') . '</a>' : '<a href="?' . PICK_GO . 'pick_info&ac=pick_check">' . milu_lang('up_to_vip') . '</a>'; } $re['show_user_name'] = $name; $re['show_upgrade'] = $show_upgrade; $re['status'] = $status; $re['web_qq'] = $web_qq; return $re; }
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); } }
function show() { $id = intval($_GET['id']); $idtype = $_GET['idtype']; $blog = magic_check_idtype($id, $idtype); magicshowtips(lang('magic/downdateline', 'downdateline_info')); $time = dgmdate($blog['dateline'], 'Y-m-d H:i'); $op = 'use'; include template('home/magic_downdateline'); }
public function check() { global $_G; $dateline = C::t('common_cache')->fetch('db_export'); $dateline = dunserialize($dateline['cachevalue']); $dateline = $dateline['dateline']; if ($_G['timestamp'] - $dateline > 86400 * 90) { $return = array('status' => 1, 'type' => 'header', 'lang' => lang('optimizer', 'optimizer_dbbackup_advice')); } else { $return = array('status' => 0, 'type' => 'header', 'lang' => lang('optimizer', 'optimizer_dbbackup_lastback') . dgmdate($dateline)); } return $return; }
public function check() { global $_G, $lang; loadcache(array('membersplitdata', 'userstats')); $membercount = $_G['cache']['userstats']['totalmembers']; if ($membercount < 20000) { $color = 'green'; $msg = $lang['membersplit_without_optimization']; } else { $color = empty($_G['cache']['membersplitdata']) || $_G['cache']['membersplitdata']['dateline'] < TIMESTAMP - 86400 * 10 ? 'red' : 'green'; $msg = empty($_G['cache']['membersplitdata']) ? $lang['membersplit_has_no_check'] : dgmdate($_G['cache']['membersplitdata']['dateline']); } return array('status' => $color == 'red' ? 1 : 0, 'type' => 'header', 'lang' => $msg); }
function output() { global $_G; foreach ($GLOBALS['list'] as $_k => $_v) { if ($_v['lastdateline']) { $GLOBALS['list'][$_k]['vdateline'] = dgmdate($_v['lastdateline'], 'u'); } elseif ($_v['dateline']) { $GLOBALS['list'][$_k]['vdateline'] = dgmdate($_v['dateline'], 'u'); } } $variable = array('list' => mobile_core::getvalues($GLOBALS['list'], array('/^\\d+$/'), array('plid', 'isnew', 'vdateline', 'subject', 'pmid', 'msgfromid', 'msgfrom', 'message', 'touid', 'tousername')), 'count' => $GLOBALS['count'], 'perpage' => $GLOBALS['perpage'], 'page' => intval($GLOBALS['page'])); if ($_GET['subop']) { $variable = array_merge($variable, array('pmid' => $GLOBALS['pmid'])); } mobile_core::result(mobile_core::variable($variable)); }
function credit_payurl($price, &$orderid) { global $_G; $orderid = dgmdate(TIMESTAMP, 'YmdHis') . random(18); $args = array('subject' => $_G['setting']['bbname'] . ' - ' . $_G['member']['username'] . ' - ' . lang('forum/misc', 'credit_payment'), 'body' => lang('forum/misc', 'credit_forum_payment') . ' ' . $_G['setting']['extcredits'][$_G['setting']['creditstrans']]['title'] . ' ' . intval($price * $_G['setting']['ec_ratio']) . ' ' . $_G['setting']['extcredits'][$_G['setting']['creditstrans']]['unit'] . ' (' . $_G['clientip'] . ')', 'service' => 'trade_create_by_buyer', 'partner' => DISCUZ_PARTNER, 'notify_url' => $_G['siteurl'] . 'api/trade/notify_credit.php', 'return_url' => $_G['siteurl'] . 'api/trade/notify_credit.php', 'show_url' => $_G['siteurl'], '_input_charset' => CHARSET, 'out_trade_no' => $orderid, 'price' => $price, 'quantity' => 1, 'seller_email' => $_G['setting']['ec_account']); if (DISCUZ_DIRECTPAY) { $args['service'] = 'create_direct_pay_by_user'; $args['payment_type'] = '1'; } else { $args['logistics_type'] = 'EXPRESS'; $args['logistics_fee'] = 0; $args['logistics_payment'] = 'SELLER_PAY'; $args['payment_type'] = 1; } return trade_returnurl($args); }
function common() { global $_G; $start = !empty($_GET['start']) ? $_GET['start'] : 0; $limit = !empty($_GET['limit']) ? $_GET['limit'] : 20; $variable['data'] = C::t('forum_newthread')->fetch_all_by_fids(dintval(explode(',', $_GET['fids']), true), $start, $limit); foreach (C::t('forum_thread')->fetch_all_by_tid(array_keys($variable['data']), 0, $limit) as $thread) { $thread['dbdateline'] = $thread['dateline']; $thread['dblastpost'] = $thread['lastpost']; $thread['dateline'] = dgmdate($thread['dateline'], 'u'); $thread['lastpost'] = dgmdate($thread['lastpost'], 'u'); $variable['data'][$thread['tid']] = mobile_core::getvalues($thread, array('tid', 'author', 'authorid', 'subject', 'subject', 'dbdateline', 'dateline', 'dblastpost', 'lastpost', 'lastposter', 'attachment', 'replies', 'readperm', 'views', 'digest')); } $variable['data'] = array_values($variable['data']); mobile_core::result(mobile_core::variable($variable)); }