function update($uploaddb) { global $windid, $winduid, $timestamp, $pintro; foreach ($uploaddb as $key => $value) { $this->attachs[] = array('aid' => $this->aid, 'pintro' => $pintro[$value['id']] ? $pintro[$value['id']] : substr($value['name'], 0, strrpos($value['name'], '.')), 'path' => $value['fileuploadurl'], 'uploader' => $windid, 'uptime' => $timestamp, 'ifthumb' => $value['ifthumb']); } if ($this->attachs) { $this->db->update("INSERT INTO pw_cnphoto (aid,pintro,path,uploader,uptime,ifthumb) VALUES " . S::sqlMulti($this->attachs)); $this->pid = $this->db->insert_id(); $cnalbum = $this->db->get_one("SELECT * FROM pw_cnalbum WHERE aid=" . S::sqlEscape($this->aid)); if ($this->atype) { if (!$cnalbum['private']) { updateDatanalyse($this->pid, 'groupPicNew', $timestamp); } } else { $statistics = L::loadClass('Statistics', 'datanalyse'); $statistics->photouser($winduid, count($this->attachs)); } if (isset($cnalbum['lastphoto']) && !$cnalbum['lastphoto']) { $lastphoto = $this->getLastPhotoThumb(); $lastphotosqlAdd = ",lastphoto= " . S::sqlEscape($lastphoto); } $this->db->update("UPDATE pw_cnalbum SET photonum=photonum+" . S::sqlEscape(count($this->attachs)) . ",lasttime=" . S::sqlEscape($timestamp) . $lastphotosqlAdd . " WHERE aid=" . S::sqlEscape($this->aid)); } return true; }
$value['pid'] = $tmpid; $tmpid++; $weiboPhotos[] = $value; } $objId = count($photos) > 1 ? 0 : $pid; $weiboExtra = array('aid' => $aid, 'aname' => $albumInfo['aname'], 'photos' => $weiboPhotos); $weiboService->send($winduid, '分享照片', 'photos', $objId, $weiboExtra); } //会员资讯缓存 $userCache = L::loadClass('Usercache', 'user'); $userCache->delete($winduid, 'cardphoto'); $ouserDataService = L::loadClass('Ouserdata', 'sns'); /* @var $ouserDataService PW_Ouserdata */ $myAppsData = $ouserDataService->get($winduid); if (!$myAppsData['photos_privacy']) { updateDatanalyse($pid, 'picNew', $timestamp); } } //积分变动 require_once R_P . 'require/credit.php'; $o_photos_creditset = unserialize($o_photos_creditset); $creditset = getCreditset($o_photos_creditset['Uploadphoto'], true, $photoNum); $creditset = array_diff($creditset, array(0)); if (!empty($creditset)) { $credit->sets($winduid, $creditset, true); updateMemberid($winduid); } if ($creditlog = unserialize($o_photos_creditlog)) { addLog($creditlog['Uploadphoto'], $windid, $winduid, 'photos_Uploadphoto'); } updateUserAppNum($winduid, 'photo', 'add', $photoNum);
updateMemberid($winduid); } if ($creditlog = unserialize($o_share_creditlog)) { addLog($creditlog['Post'], $windid, $winduid, 'share_Post'); } updateUserAppNum($winduid, 'share'); $memberShare = array('reply' => "memberShareThread", 'topic' => "memberShareThread", 'diary' => "memberShareDiary", 'album' => "memberShareAlbum", 'user' => "memberShareUser", 'group' => "memberShareGroup", 'photo' => "memberSharePic", 'web' => "memberShareLink", 'video' => "memberShareVideo", 'music' => "memberShareMusic"); $threadShare = array('topic' => "threadShare", 'diary' => "diaryShare", 'photo' => "picShare"); $threadFav = array('diary' => "diaryFav", 'photo' => "picFav"); if (isset($memberShare[$type])) { updateDatanalyse($winduid, $memberShare[$type], 1); } if (isset($threadShare[$type_tmp]) && $ifhidden != 1) { updateDatanalyse($id, $threadShare[$type_tmp], 1); } elseif (isset($threadFav[$type])) { updateDatanalyse($id, $threadFav[$type], 1); } if (defined('AJAX')) { Showmsg('operate_success'); } else { refreshto("{$baseUrl}q=share&a={$a}", 'operate_success'); } function getVideo($link, $host) { $matches = array(); switch ($host) { case 'youku.com': preg_match("/sid\\/(\\w+)\\//", $link, $matches); break; case 'youtube.com': preg_match("/v\\=([\\w\\-]+)/", $link, $matches);
function _addRateForHot($objectId, $typeId, $optionId) { $action = $this->_getRateTypesForHot($typeId, $optionId); require_once R_P . 'require/functions.php'; updateDatanalyse($objectId, $action, 1); }
PostHost("http://push.phpwind.net/push.php?type=collect&url=" . rawurlencode("{$db_bbsurl}/read.php?tid={$tid}") . "&tocharset={$db_charset}&title=" . rawurlencode($read['subject']) . "&bbsname=" . rawurlencode($db_bbsname), ""); $tiddb[$type][] = $tid; $newtids = makefavor($tiddb); $db->update("UPDATE pw_favors SET tids=" . pwEscape($newtids) . ' WHERE uid=' . pwEscape($winddb['uid'])); } else { $db->update("INSERT INTO pw_favors SET " . pwSqlSingle(array('uid' => $winddb['uid'], 'tids' => $tid))); } $db->update("UPDATE pw_threads SET favors=favors+1 WHERE tid=" . pwEscape($tid)); //Start Here pwcache require_once R_P . 'lib/elementupdate.class.php'; $elementupdate = new ElementUpdate(); $elementupdate->newfavorUpdate($tid, $fid); if ($db_ifpwcache & 1024) { $elementupdate->hotfavorUpdate($tid, $fid); } updateDatanalyse($tid, 'threadFav', 1); //End Here Showmsg('job_favor_success'); } elseif ($action == 'tag') { $cachetime = pwFilemtime(D_P . "data/bbscache/tagdb.php"); if (!file_exists(D_P . "data/bbscache/tagdb.php") || $timestamp - $cachetime > 3600) { $tagnum = max($db_tagindex, 200); $tagdb = array(); $query = $db->query("SELECT * FROM pw_tags WHERE ifhot='0' ORDER BY num DESC" . pwLimit($tagnum)); while ($rs = $db->fetch_array($query)) { $tagdb[$rs['tagname']] = $rs['num']; } writeover(D_P . "data/bbscache/tagdb.php", "<?php\r\n\$tagdb=" . pw_var_export($tagdb) . ";\r\n?>"); } else { include_once D_P . "data/bbscache/tagdb.php"; }
} $data = array('uid' => $winduid, 'username' => $windid, 'title' => $title, 'type' => $type, 'typeid' => $id, 'upid' => $upid, 'postdate' => $timestamp, 'ifwordsfb' => $wordsfb->ifwordsfb(stripslashes($title))); $db->update("INSERT INTO pw_comment SET " . S::sqlSingle($data)); $insertid = $db->insert_id(); if ($app_table && $id_filed) { $db->update("UPDATE {$app_table} SET c_num=c_num+1 WHERE {$id_filed}=" . S::sqlEscape($id)); } if ($insertid) { //zhudong 当为群组的记录的时候,更改群组记录的发表时间 if ($type == 'groupwrite') { $db->update("UPDATE pw_cwritedata SET replay_time=" . S::sqlEscape($timestamp) . " WHERE id=" . S::sqlEscape($id)); } countPosts('+1'); $threadComment = array('diary' => 'diaryComment', 'photo' => 'picComment', 'groupphoto' => 'groupPicComment', 'write' => 'writeComment'); if (isset($threadComment[$type])) { updateDatanalyse($id, $threadComment[$type], 1); } if (strpos($title, '[s:') !== false) { $title = showface($title); } list($face) = showfacedesign($winddb['icon'], 1, 'm'); $title = convert($title, $db_windpost); $postdate = get_date($timestamp); $tousername = getUserNameByTypeAndId($type, $id); //echo "success\t".$insertid."\t".$face."\t".$title; if ($tousername != $windid) { /* change to notice modified for phpwind8.5 M::sendMessage( $winduid, array($tousername), array(
function afterReply() { global $db_ifpwcache, $timestamp, $db_readperpage; if ($this->data['ifcheck'] == 1) { if ($this->forum->foruminfo['allowhtm'] && !$this->forum->foruminfo['cms'] && $this->tpcArr['replies'] < $db_readperpage) { $StaticPage = L::loadClass('StaticPage'); $StaticPage->update($this->tid); } $lastpost = array('subject' => $this->data['title'] ? substrs($this->data['title'], 26) : 'Re:' . substrs($this->tpcArr['subject'], 26), 'author' => $this->data['lastposter'], 'lastpost' => $timestamp, 'tid' => $this->tid, 't_date' => $this->tpcArr['postdate']); $this->forum->lastinfo('reply', '+', $lastpost); //Start Here pwcache if ($db_ifpwcache & 270) { require_once R_P . 'lib/elementupdate.class.php'; $elementupdate = new ElementUpdate($this->forum->fid); $elementupdate->special = $this->tpcArr['special']; if ($db_ifpwcache & 14) { $elementupdate->replySortUpdate($this->tid, $this->forum->fid, $this->tpcArr['postdate'], $this->tpcArr['replies'] + 1); } if ($db_ifpwcache & 256) { $elementupdate->newReplyUpdate($this->tid, $this->forum->fid, $this->tpcArr['postdate']); } $elementupdate->updateSQL(); } updateDatanalyse($this->data['authorid'], 'memberThread', 1); updateDatanalyse($this->tid, 'threadPost', 1); # memcache refresh $threadsObj = L::loadclass("threads"); $threadsObj->clearThreadByThreadId($this->tid); # memcache refresh $threadlistObj = L::loadclass("threadlist"); $threadlistObj->updateThreadIdsByForumId($this->forum->fid, $this->tid); } if ($this->postdata->filter->filter_weight > 1) { $this->postdata->filter->insert($this->tid, $this->pid, implode(',', $this->postdata->filter->filter_word), $this->postdata->filter->filter_weight); } }
$db->update("INSERT INTO pw_diary SET $pwSQL");**/ $pwSQL = array('uid' => $winduid, 'dtid' => $dtid, 'aid' => !empty($attachs) ? addslashes(serialize($attachs)) : '', 'username' => $windid, 'privacy' => $privacy, 'subject' => $atc_title, 'content' => $atc_content, 'ifcopy' => $ifcopy, 'ifconvert' => $ifconvert, 'ifupload' => $ifupload, 'ifwordsfb' => $ifwordsfb, 'postdate' => $timestamp); pwQuery::insert('pw_diary', $pwSQL); $did = $db->insert_id(); $db->update("UPDATE pw_diarytype SET num=num+1 WHERE uid=" . S::sqlEscape($winduid) . " AND dtid=" . S::sqlEscape($dtid)); //更新分类日志数 if ($aids) { $diaryService = L::loadClass('Diary', 'diary'); $diaryService->updateDiaryContentByAttach($did, $attachIds); $db->update("UPDATE pw_attachs SET did=" . S::sqlEscape($did) . " WHERE aid IN(" . S::sqlImplode($aids) . ")"); $pwInfoSQL = array('uploadtime' => $winddb['uploadtime'], 'uploadnum' => $winddb['uploadnum']); } if (!$privacy && !$myAppsData['index_privacy'] && !$myAppsData['diary_privacy']) { $userCache = L::loadClass('Usercache', 'user'); $userCache->delete($winduid, 'carddiary'); updateDatanalyse($did, 'diaryNew', $timestamp); if ($sendWeiboPrivacy && $ifsendweibo) { $weiboService = L::loadClass('weibo', 'sns'); /* @var $weiboService PW_Weibo */ $atc_content = substrs(stripWindCode($weiboService->escapeStr($atc_content)), 125); $weiboExtra = array('did' => $did, 'title' => stripslashes($atc_title)); $weiboService->send($winduid, $atc_content, 'diary', $did, $weiboExtra); } } countPosts('+1'); //积分变动 require_once R_P . 'require/credit.php'; $o_diary_creditset = unserialize($o_diary_creditset); $creditset = getCreditset($o_diary_creditset['Post']); $creditset = array_diff($creditset, array(0)); if (!empty($creditset)) {
function User_info() { global $db, $timestamp, $db_onlinetime, $winduid, $windpwd, $safecv, $db_ifonlinetime, $c_oltime, $onlineip, $db_ipcheck, $tdtime, $montime, $db_ifsafecv, $db_ifpwcache, $uc_server; PwNewDB(); $detail = getUserByUid($winduid); if (empty($detail) && $uc_server) { require_once R_P . 'require/ucuseradd.php'; } $loginout = 0; if ($db_ipcheck && strpos($detail['onlineip'], $onlineip) === false) { $iparray = explode('.', $onlineip); strpos($detail['onlineip'], $iparray[0] . '.' . $iparray[1]) === false && ($loginout = 1); } if (!$detail || PwdCode($detail['password']) != $windpwd || $db_ifsafecv && $safecv != $detail['safecv'] || $loginout || $detail['yz'] > 1) { $GLOBALS['groupid'] = 'guest'; require_once R_P . 'require/checkpass.php'; Loginout(); if ($detail['yz'] > 1) { $GLOBALS['jihuo_uid'] = $detail['uid']; Showmsg('login_jihuo'); } Showmsg('ip_change'); } else { list($detail['shortcut'], $detail['appshortcut']) = explode("\t", $detail['shortcut']); unset($detail['password']); $detail['honor'] = substrs($detail['honor'], 90); $distime = $timestamp - $detail['lastvisit']; if ($distime > $db_onlinetime || $distime > 3600) { //Start elementupdate if ($db_ifpwcache & 1 && SCR != 'post' && SCR != 'thread') { require_once R_P . 'lib/elementupdate.class.php'; $elementupdate = new ElementUpdate(); $elementupdate->userSortUpdate($detail); } //End elementupdate if (!GetCookie('hideid')) { $ecpvisit = pwEscape($timestamp, false); $ct = 'lastvisit=' . $ecpvisit . ',thisvisit=' . $ecpvisit; if ($db_ifonlinetime) { $c_oltime = $c_oltime <= 0 ? 0 : ($c_oltime > $db_onlinetime * 1.2 ? $db_onlinetime : intval($c_oltime)); $s_oltime = pwEscape($c_oltime, false); $ct .= ',onlinetime=onlinetime+' . $s_oltime; if ($detail['lastvisit'] > $montime) { $ct .= ',monoltime=monoltime+' . $s_oltime; } else { $ct .= ',monoltime=' . $s_oltime; } $c_oltime && updateDatanalyse($winduid, 'memberOnLine', $c_oltime); $c_oltime = 0; } $db->update("UPDATE pw_memberdata SET {$ct} WHERE uid=" . pwEscape($winduid)); $detail['lastvisit'] = $detail['thisvisit'] = $timestamp; } } } return $detail; }
function afterpost() { global $db_ifpwcache, $timestamp; if ($this->data['ifcheck'] == 1) { if ($this->forum->foruminfo['allowhtm'] && !$this->forum->foruminfo['cms']) { $StaticPage = L::loadClass('StaticPage'); $StaticPage->update($this->tid); } $lastpost = array('subject' => substrs($this->data['title'], 26), 'author' => $this->data['lastposter'], 'lastpost' => $timestamp, 'tid' => $this->tid, 't_date' => $timestamp); $this->forum->lastinfo('topic', '+', $lastpost); if ($this->forum->isOpen() && !$this->data['anonymous']) { pwAddFeed($this->post->uid, 'post', $this->tid, array('subject' => stripslashes($this->data['title']), 'tid' => $this->tid, 'fid' => $this->forum->fid)); //会员资讯缓存 $usercachedata = array(); $usercache = L::loadDB('Usercache'); $usercachedata['subject'] = substrs(stripWindCode($this->data['title']), 100, N); $usercachedata['content'] = substrs(stripWindCode($this->data['content']), 100, N); $usercachedata['postdate'] = $timestamp; if ($this->att) { $usercachedata['attimages'] = $this->att->getImages(4); } $usercache->update($this->data['authorid'], 'topic', $this->tid, $usercachedata); } //Start elementupdate if ($db_ifpwcache & 128 || $db_ifpwcache & 512 && $this->att && $this->att->elementpic) { require_once R_P . 'lib/elementupdate.class.php'; $elementupdate = new ElementUpdate($this->forum->fid); if ($db_ifpwcache & 128) { $elementupdate->newSubjectUpdate($this->tid, $this->forum->fid, $timestamp, $this->data['special']); } if ($db_ifpwcache & 512 && $this->att && $this->att->elementpic) { $elementupdate->newPicUpdate($this->att->elementpic['aid'], $this->forum->fid, $this->tid, $this->att->elementpic['attachurl'], $this->att->elementpic['ifthumb'], $this->data['content']); } $elementupdate->updateSQL(); } updateDatanalyse($this->data['authorid'], 'memberThread', 1); //End elementupdate } if ($this->postdata->filter->filter_weight > 1) { $this->postdata->filter->insert($this->tid, 0, implode(',', $this->postdata->filter->filter_word), $this->postdata->filter->filter_weight); } if ($this->data['topped'] > 0) { require_once R_P . 'require/updateforum.php'; setForumsTopped($this->tid, $this->data['fid'], $this->data['topped']); updatetop(); } }
function updateArticleHitsDatanalyse($aid, $cid, $num) { $articleService = C::loadClass('articleservice'); /* @var $articleService PW_ArticleService */ $articleService->updateArticleHits($aid); if ((int) $num % 13 == 0) { updateDatanalyse($aid, 'article_' . $cid, (int) $num, true); } }
function afterpost() { global $db_ifpwcache, $timestamp; if ($this->data['ifcheck'] == 1) { if ($this->forum->foruminfo['allowhtm'] && !$this->forum->foruminfo['cms']) { $StaticPage = L::loadClass('StaticPage'); $StaticPage->update($this->tid); } $lastpost = array('subject' => substrs($this->data['title'], 26), 'author' => $this->data['lastposter'], 'lastpost' => $timestamp, 'tid' => $this->tid, 't_date' => $timestamp); $this->forum->lastinfo('topic', '+', $lastpost); if ($this->forum->isOpen() && !$this->data['anonymous']) { require_once R_P . 'require/functions.php'; if (!$this->extraBehavior) { $weiboService = L::loadClass('weibo', 'sns'); /* @var $weiboService PW_Weibo */ $weiboContent = substrs(stripWindCode($weiboService->escapeStr(strip_tags($this->data['content']))), 125); $weiboExtra = array('title' => stripslashes($this->data['title']), 'fid' => $this->forum->fid, 'fname' => $this->forum->name, 'atusers' => $this->data['atusers']); $weiboService->send($this->post->uid, $weiboContent, 'article', $this->tid, $weiboExtra); $threadService = L::loadClass('threads', 'forum'); $threadService->setAtUsers($this->tid, 0, $this->data['atusers']); } //会员资讯缓存 $userCache = L::loadClass('Usercache', 'user'); $userCache->delete($this->data['authorid'], array('article', 'cardtopic')); /* $usercachedata = array(); $usercachedata['subject'] = substrs(stripWindCode($this->data['title']), 100, N); $usercachedata['content'] = substrs(stripWindCode($this->data['content']), 100, N); $usercachedata['postdate'] = $timestamp; if ($this->att) { $usercachedata['attimages'] = $this->att->getImages(4); } $userCache->update($this->data['authorid'], 'topic', $this->tid, $usercachedata); */ } //Start elementupdate require_once D_P . 'data/bbscache/o_config.php'; if ($db_ifpwcache & 128 || $o_browseopen || $db_ifpwcache & 512 && $this->att && $this->att->elementpic) { L::loadClass('elementupdate', '', false); $elementupdate = new ElementUpdate($this->forum->fid); if ($db_ifpwcache & 128) { $elementupdate->newSubjectUpdate($this->tid, $this->forum->fid, $timestamp, $this->data['special']); } if ($db_ifpwcache & 512 && $this->att && $this->att->elementpic && $this->_checkIfHidden()) { $elementupdate->newPicUpdate($this->att->elementpic['aid'], $this->forum->fid, $this->tid, $this->att->elementpic['attachurl'], $this->att->elementpic['ifthumb'], $this->data['content']); } if ($o_browseopen) { $elementupdate->setCacheNum(100); /*设置缓存100个*/ $elementupdate->lastPostUpdate($this->data['authorid'], $this->tid, $timestamp); } $elementupdate->updateSQL(); } require_once R_P . 'require/functions.php'; updateDatanalyse($this->data['authorid'], 'memberThread', 1); //End elementupdate } if ($this->postdata->filter->filter_weight > 1) { $this->postdata->filter->insert($this->tid, 0, implode(',', $this->postdata->filter->filter_word), $this->postdata->filter->filter_weight); } if ($this->data['topped'] > 0) { require_once R_P . 'require/updateforum.php'; setForumsTopped($this->tid, $this->data['fid'], $this->data['topped']); updatetop(); } }
function _addRateForHot($objectId, $typeId, $optionId) { $action = $this->_getRateTypesForHot($typeId, $optionId); updateDatanalyse($objectId, $action, 1); }
/** * 获取用户信息 */ function User_info() { global $db, $timestamp, $db_onlinetime, $winduid, $windpwd, $bday, $safecv, $db_ifonlinetime, $c_oltime, $onlineip, $db_ipcheck, $tdtime, $montime, $db_ifsafecv, $db_ifpwcache, $uc_server, $db_md_ifopen; PwNewDB(); $detail = getUserByUid($winduid); if (empty($detail) && $uc_server) { require_once R_P . 'require/ucuseradd.php'; } $loginout = 0; if ($db_ipcheck && strpos($detail['onlineip'], $onlineip) === false) { $iparray = explode('.', $onlineip); strpos($detail['onlineip'], $iparray[0] . '.' . $iparray[1]) === false && ($loginout = 1); } if (!$detail || PwdCode($detail['password']) != $windpwd || $db_ifsafecv && $safecv != $detail['safecv'] || $loginout || $detail['yz'] > 1) { $GLOBALS['groupid'] = 'guest'; require_once R_P . 'require/checkpass.php'; Loginout(); if ($detail['yz'] > 1) { $GLOBALS['jihuo_uid'] = $detail['uid']; Showmsg('login_jihuo'); } Showmsg('ip_change'); } else { list($detail['shortcut'], $detail['appshortcut']) = explode("\t", $detail['shortcut']); unset($detail['password']); $detail['honor'] = substrs($detail['honor'], 90); $distime = $timestamp - $detail['lastvisit']; if ($distime > $db_onlinetime || $distime > 3600) { /*--- element update ---start*/ if ($db_ifpwcache & 1 && SCR != 'post' && SCR != 'thread') { L::loadClass('elementupdate', '', false); $elementupdate = new ElementUpdate(); $elementupdate->userSortUpdate($detail); } /*--- element update ---end*/ if (!GetCookie('hideid')) { $userService = L::loadClass('UserService', 'user'); /* @var $userService PW_UserService */ $updateMemberData = $updateByIncrementMemberData = array(); $updateMemberData['lastvisit'] = $timestamp; $updateMemberData['thisvisit'] = $timestamp; if ($db_ifonlinetime) { $c_oltime = intval($c_oltime); $c_oltime = $c_oltime <= 0 ? 0 : ($c_oltime > $db_onlinetime * 1.2 ? $db_onlinetime : $c_oltime); $updateByIncrementMemberData['onlinetime'] = $c_oltime; if ($detail['lastvisit'] > $montime) { $updateByIncrementMemberData['monoltime'] = $c_oltime; } else { $updateMemberData['monoltime'] = $c_oltime; } if ($c_oltime) { require_once R_P . 'require/functions.php'; updateDatanalyse($winduid, 'memberOnLine', $c_oltime); } $c_oltime = 0; } if (get_date($timestamp, 'Y-m-d') > get_date($detail['lastvisit'], 'Y-m-d')) { /*更新今日登录数*/ $stasticsService = L::loadClass('Statistics', 'datanalyse'); $stasticsService->login($winduid); /*连续登录天数*/ if ($db_md_ifopen) { require_once R_P . 'require/functions.php'; doMedalBehavior($winduid, 'continue_login'); } } $userService->update($winduid, array(), $updateMemberData); $updateByIncrementMemberData && $userService->updateByIncrement($winduid, array(), $updateByIncrementMemberData); $detail['lastvisit'] = $detail['thisvisit'] = $timestamp; } } } return $detail; }