<?php

if (!defined('IN_DISCUZ')) {
    exit('Access Denied');
}
if ($_GET['formhash'] != FORMHASH) {
    exit(json_encode(array('status' => 0, 'message' => lang('undefined_action'), 'checkin' => 0)));
}
if ($_G['uid']) {
    $thisvars = $_G['cache']['plugin']['dsu_amupper'];
    $thisvars['offset'] = $_G['setting']['timeoffset'];
    $thisvars['gids'] = (array) unserialize($thisvars['gids']);
    $thisvars['today'] = dgmdate($_G['timestamp'], 'Ymd', $thisvars['offset']);
    $thisvars['uid'] = C::t('#dsu_amupper#plugin_dsuamupper')->fetch($_G['uid']);
    $this_time = istoday($thisvars['uid']['lasttime']);
    $this_Hs = isH($thisvars['uid']['lasttime']);
    $this_H = $this_Hs['return'];
    $ptjfname = $_G['setting']['extcredits'][$thisvars['ptjf']]['title'];
} else {
    exit(json_encode(array('status' => 0, 'message' => '没有登录!', 'checkin' => 0)));
}
if (!in_array($_G['groupid'], $thisvars['gids'])) {
    exit(json_encode(array('status' => 0, 'message' => '你所在的组暂时不支持签到!', 'checkin' => 0)));
}
//普通奖励积分的计算与是否连续签到的判断
if ($this_time == -1 || $thisvars['sz']) {
    //昨天打卡了或者默认允许连续打卡
    $cons = $thisvars['uid']['cons'] == "" ? 1 : $thisvars['uid']['cons'] + 1;
    $addup = $thisvars['uid']['addup'] + 1;
} elseif ($this_time == 0) {
    //今天打过卡了
Beispiel #2
0
function renderdir($rootdir, $dir)
{
    global $ignore;
    $ret = '';
    $r = $fnlist = $dirlist = array();
    $r['index'] = null;
    if (($dir = safepath($rootdir, $dir)) === false) {
        redirect('index.php');
    }
    $r['dir'] = $dir;
    $list = (array) uscandir(pathjoin($rootdir, $dir));
    if ($list === false) {
        redirect('index.php?base=' . $_GET['base']);
    }
    foreach ($list as $e) {
        if ($e == '.' || $e == '..' || in_array(strtolower($e), $ignore)) {
            continue;
        }
        if (uis_dir(pathjoin($rootdir, $dir, $e))) {
            $dirlist[] = $e;
        } else {
            $fnlist[] = $e;
        }
    }
    $index_file = tryindex($fnlist, $dir);
    if (!empty($index_file)) {
        $r['index'] = pathjoin($rootdir, $dir, $index_file);
    }
    natsort($dirlist);
    natsort($fnlist);
    foreach ($dirlist as $e) {
        $cfg = loadcfg(pathjoin($rootdir, $dir, $e));
        if (isset($cfg['index'])) {
            $idx = pathjoin($dir, $e, upath($cfg['index']));
            $ahref = urlenc(pathjoin($rootdir, $idx));
            $img = 'thumb.php?base=' . $_GET['base'] . '&file=' . urlencode($idx);
        } else {
            $ahref = 'index.php?base=' . $_GET['base'] . '&dir=' . urlencode(pathjoin($dir, $e));
            $img = 'images/dir.gif';
        }
        if (isset($cfg['icon'])) {
            $img = 'thumb.php?base=' . $_GET['base'] . '&file=' . urlencode(pathjoin($dir, $e, upath($cfg['icon'])));
        }
        $ret .= mkitem($e, $e, $e, '<a href="' . $ahref . '"' . ($cfg['target'] == '_blank' ? ' target="_blank"' : '') . '>', $img, istoday(pathjoin($rootdir, $dir, $e)), ($dz = udirsize(pathjoin($rootdir, $dir, $e))) > 0 ? '<br /><a name="pack" style="visibility: hidden; float:right;" href="pack.php?base=' . $_GET['base'] . '&dir=' . urlencode(pathjoin($dir, $e)) . '"><img alt="Download" title="Download - ' . fsize($dz) . '" src="images/pack.gif" /></a>' : '');
    }
    foreach ($fnlist as $e) {
        if (isvideo($e) || isaudio($e)) {
            $ahref = '<a href="flowplayer.php?base=' . $_GET['base'] . '&file=' . urlencode(pathjoin($dir, $e)) . '">';
        } elseif (isimage($e)) {
            $ahref = '<a href="image.php?base=' . $_GET['base'] . '&file=' . urlencode(pathjoin($dir, $e)) . '">';
        } elseif (isweb($e)) {
            $ahref = '<a href="' . urlenc(pathjoin($rootdir, $dir, $e)) . '">';
        } elseif (isdocument($e)) {
            $ahref = '<a href="document.php?base=' . $_GET['base'] . '&file=' . urlencode(pathjoin($dir, $e)) . '">';
        } elseif (iscode($e)) {
            $ahref = '<a href="code.php?base=' . $_GET['base'] . '&file=' . urlencode(pathjoin($dir, $e)) . '">';
        } else {
            $ahref = '<a href="' . urlenc(pathjoin($rootdir, $dir, $e)) . '">';
        }
        #		echo $dir.$e."\t".urlencode($dir.$e)."\n";
        $ret .= mkitem($e, $e, $e . ' - (' . fsize(ufilesize(pathjoin($rootdir, $dir, $e))) . ')', $ahref, 'thumb.php?base=' . $_GET['base'] . '&file=' . urlencode(pathjoin($dir, $e)), istoday(pathjoin($rootdir, $dir, $e)), null);
    }
    $r['html'] = $ret;
    return $r;
}