示例#1
0
文件: u.php 项目: adi00/wumaproject
     }
     $userdb['medals'] = explode(',', $userdb['medals']);
 }
 $usercredit = array('postnum' => $userdb['postnum'], 'digests' => $userdb['digests'], 'rvrc' => $userdb['rvrc'], 'money' => $userdb['money'], 'credit' => $userdb['credit'], 'currency' => $userdb['currency'], 'onlinetime' => $userdb['onlinetime']);
 foreach ($credit->get($userdb['uid'], 'CUSTOM') as $key => $value) {
     $usercredit[$key] = $value;
 }
 $totalcredit = CalculateCredit($usercredit, unserialize($db_upgrade));
 $newmemberid = getmemberid($totalcredit);
 if ($userdb['memberid'] != $newmemberid) {
     $userdb['memberid'] = $newmemberid;
     $db->update("UPDATE pw_members SET memberid=" . pwEscape($newmemberid, false) . "WHERE uid=" . pwEscape($userdb['uid']));
 }
 if ($db_autoban) {
     require_once R_P . 'require/autoban.php';
     autoban($userdb['uid']);
 }
 if ($userdb['groupid'] == '6' || getstatus($userdb['userstatus'], 1)) {
     $pwSQL = '';
     $isBan = false;
     $bandb = $delban = array();
     $query = $db->query("SELECT * FROM pw_banuser WHERE uid=" . pwEscape($userdb['uid']));
     while ($rt = $db->fetch_array($query)) {
         if ($rt['type'] == 1 && $timestamp - $rt['startdate'] > $rt['days'] * 86400) {
             $delban[] = $rt['id'];
         } elseif ($rt['fid'] == 0) {
             $rt['startdate'] = get_date($rt['startdate']);
             $bandb = $rt;
         } else {
             $isBan = true;
             $rt['startdate'] = get_date($rt['startdate']);
示例#2
0
 function doPing($cid, $addpoint, $params = array())
 {
     global $credit, $winddb, $winduid, $windid, $timestamp, $onlineip, $gp_gptype;
     require_once R_P . 'require/credit.php';
     $add_c = $tmp = $pingLog = array();
     if (is_array($cid)) {
         foreach ($cid as $k => $v) {
             if ($v && isset($credit->cType[$v]) && is_numeric($addpoint[$k]) && $addpoint[$k] != 0) {
                 if (!isset($this->markset[$v])) {
                     return 'masigle_credit_right';
                 }
                 $tmp[$v] += intval($addpoint[$k]);
             }
         }
         foreach ($tmp as $k => $v) {
             if (!$v) {
                 continue;
             }
             if ($v > $this->markset[$k]['maxper'] || $v < $this->markset[$k]['minper']) {
                 $GLOBALS['limitCreditType'] = $k;
                 //GLOBAL
                 $GLOBALS['markset'] = $this->markset;
                 //GLOBAL
                 return 'masigle_creditlimit';
             }
             $add_c[$k] = $v;
         }
     }
     if (empty($add_c)) {
         return 'member_credit_error';
     }
     if (strlen($params['atc_content']) > 100) {
         return 'showping_content_too_long';
     }
     $count = count($this->postData);
     foreach ($add_c as $k => $v) {
         $allpoint = abs($v) * $count;
         if ($allpoint > $this->markset[$k]['leavepoint']) {
             $GLOBALS['leavepoint'] = $this->markset[$k]['leavepoint'];
             return 'masigle_point';
         }
         if (isset($this->userCreditInfo[$k])) {
             $this->userCreditInfo[$k]['pingdate'] = $timestamp;
             $this->userCreditInfo[$k]['pingnum'] += $allpoint;
         } else {
             $this->userCreditInfo[$k] = array('pingdate' => $timestamp, 'pingnum' => $allpoint, 'pingtype' => $k);
         }
         //需扣除积分
         if ($this->markset[$k]['markdt'] && $allpoint > 0) {
             if ($credit->get($winduid, $k) < $allpoint) {
                 return 'credit_enough';
             }
             $credit->set($winduid, $k, -$allpoint, false);
         }
     }
     $newcreditdb = '';
     foreach ($this->userCreditInfo as $v) {
         $newcreditdb .= ($newcreditdb ? '|' : '') . implode("\t", $v);
     }
     //更新用户评分信息
     $userService = L::loadClass('UserService', 'user');
     /* @var $this->userService PW_UserService */
     $userService->update($winduid, array(), array(), array('credit' => $newcreditdb));
     $singlepoint = array_sum($add_c);
     require_once R_P . 'require/showimg.php';
     //* $threadService = L::loadClass("threads", 'forum');
     foreach ($this->postData as $pid => $atc) {
         !$atc['subject'] && ($atc['subject'] = substrs(strip_tags(convert($atc['content'])), 35));
         /*积分日志*/
         $credit->addLog('credit_showping', $add_c, array('uid' => $atc['authorid'], 'username' => $atc['author'], 'ip' => $onlineip, 'operator' => $windid, 'tid' => $this->tid, 'subject' => $atc['subject'], 'reason' => $params['atc_content']));
         //为被评用户增加积分
         $credit->sets($atc['authorid'], $add_c, false);
         if (!is_numeric($pid)) {
             //主题时,更新总评分数
             //* $this->db->update("UPDATE pw_threads SET ifmark=ifmark+" . S::sqlEscape($singlepoint)." WHERE tid=" . S::sqlEscape($tid));
             $this->db->update(pwQuery::buildClause("UPDATE :pw_table SET ifmark=ifmark+:ifmark WHERE tid=:tid", array('pw_threads', $singlepoint, $this->tid)));
             $rpid = 0;
         } else {
             $rpid = $pid;
         }
         $pwSQL = $ping = array();
         $affect = '';
         list($ping['pingtime'], $ping['pingdate']) = getLastDate($timestamp - 1);
         //list($face) = showfacedesign($winddb['icon'],1,'m');
         foreach ($add_c as $key => $value) {
             /*记录评分日志*/
             $pwSQL = array('fid' => $this->fid, 'tid' => $this->tid, 'pid' => $rpid, 'name' => $key, 'point' => $value, 'pinger' => $windid, 'record' => $params['atc_content'], 'pingdate' => $timestamp);
             $affect .= ($affect ? ',' : '') . $credit->cType[$key] . ':' . $value;
             //$this->db->update("INSERT INTO pw_pinglog SET " . S::sqlSingle($pwSQL));
             //$pingLogId = $this->db->insert_id();
             $pingLogId = pwQuery::insert('pw_pinglog', $pwSQL);
             $pingLog[$pid][$key] = array('fid' => $this->fid, 'tid' => $this->tid, 'pid' => $pid, 'name' => $credit->cType[$key], 'point' => $value > 0 ? "+{$value}" : $value, 'pinger' => $windid, 'pingeruid' => $winduid, 'record' => $params['atc_content'] ? $params['atc_content'] : '-', 'pingtime' => $ping['pingtime'], 'pingdate' => $ping['pingdate'], 'pingLogId' => $pingLogId);
         }
         $this->update_markinfo($this->tid, $rpid);
         //* $threadService->clearTmsgsByThreadId($this->tid);
         Perf::gatherInfo('changeTmsgWithThreadIds', array('tid' => $this->tid));
         $this->postData[$pid]['ifmark'] = $ifmark;
         if ($params['ifmsg'] && !$atc['anonymous'] && $atc['author'] != $windid) {
             //发消息
             $title = getLangInfo('writemsg', 'ping_title', array('sender' => $windid, 'receiver' => $atc['author']));
             $content = getLangInfo('writemsg', 'ping_content', array('manager' => $windid, 'fid' => $atc['fid'], 'tid' => $this->tid, 'pid' => $pid, 'subject' => $atc['subject'], 'postdate' => get_date($atc['postdate']), 'forum' => strip_tags($this->forum->foruminfo['name']), 'affect' => $affect, 'admindate' => get_date($timestamp), 'reason' => stripslashes($params['atc_content']), 'sender' => $windid, 'receiver' => $atc['author']));
             $this->sendMessage($atc['author'], $title, $content);
         }
         if ($gp_gptype == 'system') {
             require_once R_P . 'require/writelog.php';
             $log = array('type' => 'credit', 'username1' => $atc['author'], 'username2' => $windid, 'field1' => $this->fid, 'field2' => '', 'field3' => '', 'descrip' => 'credit_descrip', 'timestamp' => $timestamp, 'ip' => $onlineip, 'tid' => $this->tid, 'forum' => strip_tags($this->forum->foruminfo['name']), 'subject' => $atc['subject'], 'affect' => $affect, 'reason' => $params['atc_content']);
             writelog($log);
         }
     }
     $credit->runsql();
     defined('AJAX') && ($GLOBALS['pingLog'] = $pingLog);
     /*评分内容作为回复*/
     if ($params['ifpost'] && $params['atc_content']) {
         $replyReturn = $this->addPost($this->tid, $params['atc_content']);
     }
     if ($GLOBALS['db_autoban'] && $singlepoint < 0) {
         require_once R_P . 'require/autoban.php';
         foreach ($this->postData as $pid => $atc) {
             autoban($atc['authorid']);
         }
     }
     if ($this->forum->foruminfo['allowhtm'] && $_REQUEST['page'] == 1) {
         $StaticPage = L::loadClass('StaticPage');
         $StaticPage->update($this->tid);
     }
     if (isset($replyReturn) && $replyReturn !== true) {
         $replyReturn = getLangInfo('msg', $replyReturn);
         return '评分已完成!回复失败,可能的原因是:' . $replyReturn;
     }
     return true;
 }
示例#3
0
function processLogin($userId, $user = null, $cktime = '31536000', $lgt = 0)
{
    global $timestamp, $db_ckpath, $db_ckdomain, $db_autoban;
    if (!$user) {
        $userService = L::loadClass('UserService', 'user');
        /* @var $userService PW_UserService */
        $user = $userService->get($userId, true, true);
    }
    $pwuser = $user['username'];
    $md5_pwpwd = $user['password'];
    $safecv = $user['safecv'];
    require_once R_P . 'require/checkpass.php';
    $logininfo = checkpass($pwuser, $md5_pwpwd, $safecv, $lgt);
    if (!is_array($logininfo)) {
        Showmsg($logininfo);
    }
    list($winduid, , $windpwd, ) = $logininfo;
    /*update cache*/
    $_cache = getDatastore();
    $_cache->delete("UID_" . $winduid);
    $cktime != 0 && ($cktime += $timestamp);
    Cookie("winduser", StrCode($winduid . "\t" . $windpwd . "\t" . $safecv), $cktime);
    Cookie("ck_info", $db_ckpath . "\t" . $db_ckdomain);
    Cookie('lastvisit', '', 0);
    //将$lastvist清空以将刚注册的会员加入今日到访会员中
    //自动获取勋章_start
    require_once R_P . 'require/functions.php';
    doMedalBehavior($winduid, 'continue_login');
    //自动获取勋章_end
    if ($db_autoban) {
        require_once R_P . 'require/autoban.php';
        autoban($winduid);
    }
    return $logininfo;
}
示例#4
0
 $_cache->delete("UID_" . $winduid);
 if (file_exists(D_P . "data/groupdb/group_{$groupid}.php")) {
     require_once Pcv(D_P . "data/groupdb/group_{$groupid}.php");
 } else {
     require_once D_P . "data/groupdb/group_1.php";
 }
 (int) $keepyear && ($cktime = '31536000');
 $cktime != 0 && ($cktime += $timestamp);
 Cookie("winduser", StrCode($winduid . "\t" . $windpwd . "\t" . $safecv), $cktime);
 Cookie("ck_info", $db_ckpath . "\t" . $db_ckdomain);
 //Cookie("ucuser",'cc',$cktime);
 Cookie('lastvisit', '', 0);
 //将$lastvist清空以将刚注册的会员加入今日到访会员中
 if ($db_autoban) {
     require_once R_P . 'require/autoban.php';
     autoban($winduid);
 }
 $_G['allowhide'] && $hideid ? Cookie('hideid', "1", $cktime) : Loginipwrite($winduid);
 (empty($jumpurl) || false !== strpos($jumpurl, $regurl)) && ($jumpurl = $db_bfn);
 if (GetCookie('o_invite') && $db_modes['o']['ifopen'] == 1) {
     list($o_u, $hash, $app) = explode("\t", GetCookie('o_invite'));
     if (is_numeric($o_u) && strlen($hash) == 18) {
         require_once R_P . 'require/o_invite.php';
     }
 }
 //passport
 if ($db_pptifopen && $db_ppttype == 'server' && ($db_ppturls || $forward)) {
     $tmp = $jumpurl;
     $jumpurl = $forward ? $forward : $db_ppturls;
     $forward = $tmp;
     require_once R_P . 'require/passport_server.php';
示例#5
0
         $atcdb[$pid]['ifmark'] = $ifmark;
         if ($ifmsg && !$atc['anonymous']) {
             $msg = array('toUser' => $atc['author'], 'fromUid' => $winduid, 'fromUser' => $windid, 'subject' => 'ping_title', 'content' => 'ping_content', 'other' => array('manager' => $windid, 'fid' => $atc['fid'], 'tid' => $tid, 'pid' => $pid, 'subject' => $atc['subject'], 'postdate' => get_date($atc['postdate']), 'forum' => strip_tags($foruminfo['name']), 'affect' => $affect, 'admindate' => get_date($timestamp), 'reason' => stripslashes($atc_content)));
             pwSendMsg($msg);
         }
         if ($gp_gptype == 'system') {
             require_once R_P . 'require/writelog.php';
             $log = array('type' => 'credit', 'username1' => $atc['author'], 'username2' => $windid, 'field1' => $fid, 'field2' => '', 'field3' => '', 'descrip' => 'credit_descrip', 'timestamp' => $timestamp, 'ip' => $onlineip, 'tid' => $tid, 'forum' => strip_tags($foruminfo['name']), 'subject' => $atc['subject'], 'affect' => $affect, 'reason' => $atc_content);
             writelog($log);
         }
     }
     $credit->runsql();
     if ($db_autoban && $singlepoint < 0) {
         require_once R_P . 'require/autoban.php';
         foreach ($atcdb as $pid => $atc) {
             autoban($atc['authorid']);
         }
     }
     if ($foruminfo['allowhtm'] && $page == 1) {
         $StaticPage = L::loadClass('StaticPage');
         $StaticPage->update($tid);
     }
     if (defined('AJAX')) {
         echo "success";
         ajax_footer();
     } else {
         refreshto("read.php?tid={$tid}&page={$page}#{$jump_pid}", 'enter_thread');
     }
 } else {
     PostCheck();
     $groupid == 'guest' && Showmsg('not_login');