Пример #1
0
/**
 * 组装小名片数据
 *
 * @param int $uid 用户ID
 * @param int $winduid 当前用户id
 * @param bool $username 用户名
 * @return array
 */
function getCardData($uid, $winduid, $username)
{
    extract(pwCache::getData(R_P . "data/bbscache/level.php", false));
    if ($uid < 1 && !trim($username) || $username == '游客' || $username == '匿名') {
        return array('username' => '游客', 'memtitle' => $ltitle[2]);
    }
    $userService = L::loadClass('UserService', 'user');
    if ($uid) {
        $userInfo = $userService->get($uid, true, true);
    } elseif ($username) {
        $userInfo = $userService->getByUserName($username, true, true);
    }
    if (!S::isArray($userInfo)) {
        return array();
    }
    require_once R_P . 'require/showimg.php';
    list($faceimage) = showfacedesign($userInfo['icon'], 1, 's');
    $userInfo['groupid'] == '-1' && ($userInfo['groupid'] = $userInfo['memberid']);
    !array_key_exists($userInfo['groupid'], (array) $lpic) && ($userInfo['groupid'] = 8);
    $online = checkOnline($userInfo['thisvisit']);
    $onlineRead = $online ? getOnlineViewing($userInfo['uid'], $userInfo['username']) : array();
    $user = array('mine' => $userInfo['uid'] == $winduid || !$winduid ? 0 : 1, 'uid' => $userInfo['uid'], 'username' => $userInfo['username'], 'icon' => $faceimage, 'memtitle' => $ltitle[$userInfo['groupid']], 'genderClass' => $userInfo['gender'], 'viewTid' => isset($onlineRead['tid']) && $onlineRead['tid'] ? $onlineRead['tid'] : '', 'viewFid' => isset($onlineRead['fid']) && $onlineRead['fid'] ? $onlineRead['fid'] : '', 'online' => $online ? 1 : 0);
    $user['medals'] = getMedalsByUid($userInfo['uid']);
    // 勋章
    $memberTagsService = L::loadClass('memberTagsService', 'user');
    $user['memberTags'] = $memberTagsService->makeClassTags($memberTagsService->getMemberTagsByUid($userInfo['uid']));
    //标签
    $attentionSerivce = L::loadClass('Attention', 'friend');
    /* @var $attentionSerivce PW_Attention */
    $user['attention'] = $attentionSerivce->isFollow($winduid, $userInfo['uid']) ? 1 : 0;
    //关注
    return $user;
}
Пример #2
0
define('CAPTCHA', false);
if (!CAPTCHA) {
    $valid = true;
    if (!isset($_SESSION['captcha'])) {
        $_SESSION['captcha'] = 99;
    }
    $_POST['secure'] = $_SESSION['captcha'];
    $_SESSION['ENABLE_CAPTCHA'] = false;
}
if (isset($_POST['send-comment'])) {
    //reCaptcha
    $privatekey = oneQuery('comment_setting', 'name', "'recaptcha_privatekey'", 'value');
    $publickey = oneQuery('comment_setting', 'name', "'recaptcha_publickey'", 'value');
    if (checkOnline() and !empty($_POST["recaptcha_challenge_field"]) and !empty($_POST["recaptcha_response_field"])) {
        $capthca = recaptcha_check_answer($privatekey, $_SERVER["REMOTE_ADDR"], $_POST["recaptcha_challenge_field"], $_POST["recaptcha_response_field"]);
        if ($capthca->is_valid and checkOnline()) {
            $valid = true;
        }
    }
    if (empty($_POST['name']) or empty($_POST['email']) or empty($_POST['com'])) {
        $notice = alert("error", comment_Notice_Error, true);
    } else {
        if (!preg_match("/^.+@.+\\..+\$/", $_POST['email'])) {
            $notice = alert("error", comment_Notice_Error2, true);
        } else {
            if ($_POST['secure'] == $_SESSION['captcha'] or isset($valid)) {
                $name = oneQuery('comment_setting', 'name', "'name_filter'", 'value');
                $name = explode(",", $name);
                foreach ($name as $namef) {
                    if (strtolower($_POST['name']) == strtolower(trim($namef))) {
                        $name = 0;
Пример #3
0
function checkOnline($welive_onlines)
{
    foreach ($welive_onlines as $usergroup) {
        foreach ($usergroup['user'] as $user) {
            if ($user['isonline']) {
                return true;
            }
        }
    }
    return false;
}
header_nocache();
$online_cache_file = BASEPATH . "cache/online_cache.php";
@(include $online_cache_file);
if (isset($welive_onlines) && is_array($welive_onlines)) {
    $getone = checkOnline($welive_onlines);
} else {
    $getone = $DB->getOne("SELECT u.userid FROM " . TABLE_PREFIX . "usergroup ug LEFT JOIN " . TABLE_PREFIX . "user u ON ug.usergroupid = u.usergroupid WHERE  ug.usergroupid <>1 AND ug.activated = 1 AND u.activated = 1 AND u.isonline =1");
}
if ($_CFG['cActived']) {
    $thisUrl = urlencode(base64_encode($_SERVER['HTTP_REFERER']));
    $iframe_height = $_CFG['cPanalHeight'];
    echo 'var welive_tt = 0;
	function welive_intval(v){
		v = parseInt(v);
		return isNaN(v) ? 0 : v;
	}

	function welive_getpos(e){
		var l = 0;
		var t  = 0;
Пример #4
0
function fieldPlays($method, $target, $payload)
{
    switch ($method) {
        case "GET":
            checkNULL($target, 'device');
            checkDevice($target, 'has_device');
            $result = dbSelect('devices', 'devicetime', "tag='" . $target . "'");
            $response = $result->fetch_assoc();
            httpResponse($response, 200);
            break;
        case "POST":
            checkNULL($target, 'room');
            checkRoom($target, 'has_room');
            checkNULL($payload['user'], 'user');
            checkOnline($payload['user']);
            dbUpdate('devices', "command='" . $payload['cmd'] . "', timestamp='" . $payload['ts'] . "'", "location='" . $target . "'");
            echoSuccess("set_play");
            break;
        case "PUT":
            checkNULL($target, 'device');
            checkDevice($target, 'has_device');
            dbUpdate('devices', "devicetime='" . $payload['dt'] . "'", "tag='" . $target . "'");
            $result = dbSelect('devices', 'command, timestamp', "tag='" . $target . "'");
            $response = $result->fetch_assoc();
            httpResponse($response, 200);
            dbUpdate('devices', "command=''", "tag='" . $target . "'");
            break;
        case "DELETE":
            checkNULL($target, 'room');
            checkRoom($target, 'has_room');
            dbUpdate('devices', "command='', timestamp=''", "location='" . $target . "'");
            echoSuccess("reset_play");
            break;
        default:
            echoError('Invalid Method');
            break;
    }
}
Пример #5
0
/**
 * submit page to google
 */
function submitPageToGoogle()
{
    if (!checkOnline()) {
        return false;
    } else {
        global $SETTINGS, $LAYOUT;
        $LAYOUT->setTitle('Submit sitemap to google');
        $res = @fopen("http://www.google.com/webmasters/tools/ping?sitemap=" . urlencode($SETTINGS['website'] . $SETTINGS[PSNG_SITEMAP_URL]), "r");
        if ($res === FALSE) {
            $LAYOUT->addError('', 'Error while submitting ' . $SETTINGS[sitemap_url] . 'to google!');
        }
        $str = "";
        while (!@feof($res)) {
            $str .= @fread($res, 1000);
        }
        fclose($res);
        $LAYOUT->addSuccess('Result was: <i>' . strip_tags($str, '<br> <h2> <h1>') . '</i>', 'Your sitemap file has been successfuly sent to google!');
        return TRUE;
    }
}