function replace($fieldData)
 {
     $fieldData = $this->_checkData($fieldData);
     if (!$fieldData) {
         return false;
     }
     return pwQuery::replace($this->_tableName, $fieldData);
 }
 /**
  * 添加用户信息
  *
  * @param array $fieldData
  * @return int
  */
 function addKmdUser($fieldData)
 {
     $fieldData = $this->_checkAllowField($fieldData, $this->_allowFields);
     if (!S::isArray($fieldData)) {
         return false;
     }
     return pwQuery::replace($this->_tableName, $fieldData);
 }
 /**
  * 
  * 添加话题新鲜事关系
  * @param int $topicId
  * @param int $mid
  */
 function addTopicRelations($topicId, $mid)
 {
     $mid = intval($mid);
     $topicId = intval($topicId);
     if (!$mid || !$topicId) {
         return false;
     }
     $fields = array('topicid' => $topicId, 'mid' => $mid, 'crtime' => $GLOBALS['timestamp']);
     pwQuery::replace($this->_tableName, $fields);
     return true;
 }
 /**
  * 
  * 添加用户关注的话题
  * @param int $topicId
  * @param int $userid
  * @return boolean
  */
 function addAttentionTopic($topicId, $userid)
 {
     $userid = intval($userid);
     $topicId = intval($topicId);
     if (!$userid || !$topicId) {
         return false;
     }
     $fields = array('topicid' => $topicId, 'userid' => $userid, 'crtime' => $GLOBALS['timestamp']);
     pwQuery::replace($this->_tableName, $fields);
     return true;
 }
 function _insertLog($tableName, $sids, $operate)
 {
     if (!$tableName || !S::isArray($sids) || !$operate) {
         return false;
     }
     global $db, $timestamp;
     $operates = array('update' => 1, 'delete' => 2, 'insert' => 3);
     foreach ($sids as $sid) {
         pwQuery::replace($tableName, array('id' => $sid, 'sid' => $sid, 'operate' => $operates[$operate], 'modified_time' => $timestamp));
     }
     return true;
 }
Exemple #6
0
 function add($uid, $appid, $appname, $allowfeed, $descrip)
 {
     global $timestamp;
     /*
     $this->db->update("REPLACE INTO pw_userapp SET " . S::sqlSingle(array(
     	'uid'		=> $uid,
     	'appid'		=> $appid,
     	'appname'	=> $appname,
     )));
     */
     pwQuery::replace('pw_userapp', array('uid' => $uid, 'appid' => $appid, 'appname' => $appname));
     if ($allowfeed) {
         $descrip = S::escapeChar($descrip);
         $this->db->update("INSERT INTO pw_feed SET " . S::sqlSingle(array('uid' => $uid, 'type' => 'app', 'descrip' => $descrip, 'timestamp' => $timestamp), false));
     }
     return new ApiResponse(true);
 }
Exemple #7
0
             }
             $userService->update($uid, array('groupid' => $groupid, 'groups' => $groups));
             if ($groupid == 6) {
                 /**
                 					$db->update("REPLACE INTO pw_banuser"
                 						. " SET " .S::sqlSingle(array(
                 							'uid'		=> $uid,
                 							'fid'		=> 0,
                 							'type'		=> 2,
                 							'startdate'	=> $timestamp,
                 							'days'		=> 0,
                 							'admin'		=> $admin_name,
                 							'reason'	=> ''
                 					),false));
                 					**/
                 pwQuery::replace('pw_banuser', array('uid' => $uid, 'fid' => 0, 'type' => 2, 'startdate' => $timestamp, 'days' => 0, 'admin' => $admin_name, 'reason' => ''));
             }
             $_cache->delete('UID_' . $uid);
             if ($groupid != '-1' || $groups) {
                 admincheck($uid, $rt['username'], $groupid, $groups, 'update');
             } elseif ($rt['groupid'] != '-1' || $rt['groups']) {
                 admincheck($uid, $rt['username'], $groupid, $groups, 'delete');
             }
         }
     }
     adminmsg('operate_success');
 } else {
     initGroupOptions();
     include PrintEot('usermanage');
     exit;
 }
 function _insertUser()
 {
     global $timestamp, $onlineip, $credit;
     /**
     		$pwSQL = S::sqlSingle(array(
     			'uid' => $this->uid,
     			'username' => $this->data['username'],
     			'password' => $this->data['password'],
     			'safecv' => $this->data['safecv'],
     			'email' => $this->data['email'],
     			'groupid' => $this->data['groupid'],
     			'memberid' => $this->data['memberid'],
     			'regdate' => $timestamp,
     			'yz' => $this->data['yz'],
     			'userstatus' => $this->data['userstatus'],
     			'newpm' => 0
     		));
     		$this->db->update("REPLACE INTO pw_members SET $pwSQL");
     		**/
     $pwSQL = array('uid' => $this->uid, 'username' => $this->data['username'], 'password' => $this->data['password'], 'safecv' => $this->data['safecv'], 'email' => $this->data['email'], 'groupid' => $this->data['groupid'], 'memberid' => $this->data['memberid'], 'regdate' => $timestamp, 'yz' => $this->data['yz'], 'userstatus' => $this->data['userstatus'], 'newpm' => 0);
     pwQuery::replace('pw_members', $pwSQL);
     /**
     		$pwSQL = S::sqlSingle(array(
     			'uid' => $this->uid,
     			'postnum' => 0,
     			'lastvisit' => $timestamp,
     			'thisvisit' => $timestamp,
     			'onlineip' => $onlineip
     		));
     		$this->db->pw_update(
     			'SELECT uid FROM pw_memberdata WHERE uid=' . S::sqlEscape($this->uid),
     			'UPDATE pw_memberdata SET ' . $pwSQL . ' WHERE uid=' . S::sqlEscape($this->uid),
     			'INSERT INTO pw_memberdata SET ' . $pwSQL
     		);
     		**/
     $pwSQL = array('uid' => $this->uid, 'postnum' => 0, 'lastvisit' => $timestamp, 'thisvisit' => $timestamp, 'onlineip' => $onlineip);
     $this->db->pw_update('SELECT uid FROM pw_memberdata WHERE uid=' . S::sqlEscape($this->uid), pwQuery::updateClause('pw_memberdata', 'uid =:uid', array($this->uid), $pwSQL), pwQuery::insertClause('pw_memberdata', $pwSQL));
     //$this->db->update("REPLACE INTO pw_memberdata SET $pwSQL");
     require_once R_P . 'require/credit.php';
     $credit->addLog('reg_register', L::reg('rg_regcredit'), array('uid' => $this->uid, 'username' => stripslashes($this->data['username']), 'ip' => $onlineip));
     $credit->sets($this->uid, L::reg('rg_regcredit'), false);
     $credit->runsql();
     //* $this->db->update("UPDATE pw_bbsinfo SET newmember=" . S::sqlEscape($this->data['username']) . ",totalmember=totalmember+1 WHERE id='1'");
     $this->db->update(pwQuery::buildClause("UPDATE :pw_table SET newmember=:newmember,totalmember=totalmember+1 WHERE id=:id", array('pw_bbsinfo', $this->data['username'], 1)));
     $this->memberinfo or $this->memberinfo['uid'] = $this->uid;
     if ($this->memberinfo) {
         /**
         			$this->db->update("REPLACE INTO pw_memberinfo SET uid=" . S::sqlEscape($this->uid) . ',' . S::sqlSingle($this->memberinfo));
         			**/
         $_temp = array('uid' => $this->uid) + $this->memberinfo;
         pwQuery::replace('pw_memberinfo', $_temp);
     }
     $statistics = L::loadClass('Statistics', 'datanalyse');
     $statistics->register();
 }
Exemple #9
0
 /**
  * 获取热门话题
  * @param int $o_weibo_hottopicdays 热门话题榜缓存时间
  * @param int $timestamp 时间戳
  * @param array $db
  * @return array $TopicDb
  */
 function getWeiboHotTopics()
 {
     global $o_weibo_hottopicdays, $timestamp, $db;
     if (perf::checkMemcache()) {
         $_cacheService = Perf::gatherCache('pw_cache');
         $rt = $_cacheService->getCacheByName('weiboHotTopics_10');
     } else {
         $rt = $db->get_one("SELECT * FROM pw_cache WHERE name='weiboHotTopics_10'");
     }
     $lastData = @unserialize($rt['cache']);
     $weiboHotTopics = array();
     if ($lastData && $rt['time'] > $timestamp - 7200) {
         $weiboHotTopics = (array) $lastData;
     } else {
         $days = $o_weibo_hottopicdays ? intval($o_weibo_hottopicdays) : 7;
         $weiboHotTopics = $this->getHotTopics(10, $days);
         /*与上一次比较排名变化*/
         foreach (array($lastData) as $k => $v) {
             if (!isset($v['order'])) {
                 continue;
             }
             if ($v['order'] < $weiboHotTopics[$k]['order']) {
                 $weiboHotTopics[$k]['change'] = 2;
                 //排名下降
             } elseif ($v['order'] > $weiboHotTopics[$k]['order']) {
                 $weiboHotTopics[$k]['change'] = 1;
                 //排名上升
             } else {
                 $weiboHotTopics[$k]['change'] = 0;
             }
         }
         /*	
         $db->update("REPLACE INTO pw_cache SET " . S::sqlSingle(array(
         	'name'	=> 'weiboHotTopics_10',
         	'cache'	=> serialize($weiboHotTopics),
         	'time'	=> $timestamp
         )));
         */
         pwQuery::replace('pw_cache', array('name' => 'weiboHotTopics_10', 'cache' => serialize($weiboHotTopics), 'time' => $timestamp));
     }
     return $weiboHotTopics;
 }
Exemple #10
0
 /**
  * 获取热门活动
  * return array
  */
 function getHotActive($nums)
 {
     global $timestamp;
     if (perf::checkMemcache()) {
         $_cacheService = Perf::gatherCache('pw_cache');
         $rt = $_cacheService->getCacheByName('hotactive_3');
     } else {
         $rt = $this->_db->get_one("SELECT * FROM pw_cache WHERE name='hotactive_3'");
     }
     if ($rt && $rt['time'] > $timestamp - 1800) {
         return unserialize($rt['cache']);
     } else {
         list($activedb) = $this->searchList(array('createtime_s' => $timestamp - 2592000), 3, 0, 'members', 'DESC');
         pwQuery::replace('pw_cache', array('name' => 'hotactive_3', 'cache' => serialize($activedb), 'time' => $timestamp));
         //$this->_db->update("REPLACE INTO pw_cache SET " . S::sqlSingle(array('name' => 'hotactive_3', 'cache' => serialize($activedb), 'time' => $timestamp)));
         return $activedb;
     }
 }
Exemple #11
0
 $userCache = L::loadClass('UserCache', 'user');
 $cacheData = $userCache->get($winduid, array('recommendUsers' => 3));
 $recommendUsers = $cacheData['recommendUsers'];
 if (perf::checkMemcache()) {
     $_cacheService = Perf::gatherCache('pw_cache');
     $rt = $_cacheService->getCacheByName('weiboAuthorSort_5');
 } else {
     $rt = $db->get_one("SELECT * FROM pw_cache WHERE name='weiboAuthorSort_5'");
 }
 //$rt = $db->get_one("SELECT * FROM pw_cache WHERE name='weiboAuthorSort_5' AND time>" . S::sqlEscape($timestamp - 86400));
 if ($rt && $rt['time'] > $timestamp - 86400) {
     $weiboAuthorSort = unserialize($rt['cache']);
     is_array($weiboAuthorSort) || ($weiboAuthorSort = array());
 } else {
     $weiboAuthorSort = $weiboService->getAuthorSort(5);
     pwQuery::replace('pw_cache', array('name' => 'weiboAuthorSort_5', 'cache' => serialize($weiboAuthorSort), 'time' => $timestamp));
     /*
     $db->update("REPLACE INTO pw_cache SET " . S::sqlSingle(array(
     	'name'	=> 'weiboAuthorSort_5',
     	'cache'	=> serialize($weiboAuthorSort),
     	'time'	=> $timestamp
     )));
     */
 }
 /* 右侧话题排行 */
 !$topicService && ($topicService = L::loadClass('topic', 'sns'));
 /* @var $topicService PW_Topic */
 !$weiboHotTopics && ($weiboHotTopics = $topicService->getWeiboHotTopics());
 /*获取用户关注的话题*/
 $perpage = 10;
 $attentionCount = $topicService->getUserAttentionTopicNum($winduid);
Exemple #12
0
 function updateInfo($data)
 {
     if ($this->default) {
         $data['uid'] = $this->uid;
         pwQuery::replace('pw_space', $data);
     } else {
         pwQuery::update('pw_space', 'uid=:uid', array($this->uid), $data);
         //$this->_db->update("UPDATE pw_space SET " . S::sqlSingle($data) . ' WHERE uid=' . S::sqlEscape($this->uid));
     }
 }
                $sql1[$key] = $val;
            } elseif (in_array($key, $memberdata_field) && strpos(",{$db_pptcredit},", ",{$key},") !== false) {
                $sql2[$key] = (int) $val;
            }
        }
        $sql1 += array('groupid' => -1, 'memberid' => 8, 'gender' => 0, 'regdate' => $timestamp);
        /**
        		$db->update("REPLACE INTO pw_members SET".S::sqlSingle($sql1));
        		**/
        pwQuery::replace('pw_members', $sql1);
        $winduid = $db->insert_id();
        $sql2 += array('uid' => $winduid, 'postnum' => 0, 'lastvisit' => $timestamp, 'thisvisit' => $timestamp, 'onlineip' => $onlineip);
        /**
        		$db->update("REPLACE INTO pw_memberdata SET".S::sqlSingle($sql2));
        		**/
        pwQuery::replace('pw_memberdata', $sql2);
        //* $db->update("UPDATE pw_bbsinfo SET newmember=".S::sqlEscape($userdb['username']).",totalmember=totalmember+1 WHERE id='1'");
        $db->update(pwQuery::buildClause("UPDATE :pw_table SET newmember=:newmember,totalmember=totalmember+1 WHERE id=:id", array('pw_bbsinfo', $userdb['username'], 1)));
    }
    $db_hash = $_db_hash;
    $windpwd = PwdCode($userdb['password']);
    Cookie("winduser", StrCode($winduid . "\t" . $windpwd), $userdb['cktime']);
    Cookie('lastvisit', '', 0);
    Loginipwrite();
    if ($ajax == 1) {
        ObStart();
        echo "success\t{$db_bbsurl}";
        ajax_footer();
    }
    ObHeader($forward ? $forward : $db_bbsurl);
} elseif ($action == 'quit') {