Beispiel #1
0
 /**
  * 编辑一条工作经历
  * @param int $uid 用户id
  * @param int $companyId 公司Id
  * @param int $startTime 入公司年份
  * @return bool
  */
 function editCareer($careerId, $companyId, $startTime)
 {
     if (!$careerId || !$companyId || !$startTime) {
         return false;
     }
     return pwQuery::update($this->_tableName, "careerid=:careerid", array($careerId), array('companyid' => $companyId, 'starttime' => $startTime));
 }
 function updateByUidAndMedalId($fieldData, $uid, $medalId)
 {
     $fieldData = $this->_checkData($fieldData);
     if (!$fieldData) {
         return false;
     }
     return pwQuery::update($this->_tableName, "uid=:uid AND medal_id=:medal_id", array($uid, $medalId), $fieldData);
 }
 function update($fieldData, $uid, $behavior)
 {
     $fieldData = $this->_checkData($fieldData);
     if (!$fieldData) {
         return false;
     }
     return pwQuery::update($this->_tableName, "uid=:uid AND behavior=:behavior", array($uid, $behavior), $fieldData);
 }
 function updateRecordByTidAndPid($tid, $pid, $data)
 {
     list($tid, $pid) = array(intval($tid), intval($pid));
     $data = $this->_checkAllowField($data, $this->_allowFields);
     if ($tid < 1 || $pid < 1 || !S::isArray($data)) {
         return false;
     }
     return pwQuery::update($this->_tableName, "tid=:tid AND pid=:pid", array($tid, $pid), $data);
 }
Beispiel #5
0
 function updates($fieldData, $ids)
 {
     if (!$this->_check() || !$fieldData || empty($ids)) {
         return false;
     }
     /**
     		$this->_db->update("UPDATE " . $this->_tableName . " SET " . $this->_getUpdateSqlString($fieldData) . " WHERE " . $this->_primaryKey . " IN (" . $this->_getImplodeString($ids) . ")");
     		**/
     pwQuery::update('pw_memberinfo', 'uid IN(:uid)', array($ids), $fieldData);
     return $this->_db->affected_rows();
 }
Beispiel #6
0
 function insertAppevent($uid, $appevent = array(), $appid)
 {
     //插入用户的单个应用信息
     //$rt = $this->db->get_one("SELECT uid FROM pw_userapp WHERE uid=".S::sqlEscape($uid)." AND appid=".S::sqlEscape($appid));
     $appclient = L::loadClass('appclient');
     $rt = $appclient->getUserAppByUidAndAppid($uid, $appid);
     if ($rt && $appevent) {
         $appevent = serialize($appevent);
         //$this->db->update("UPDATE pw_userapp SET appevent=" .S::sqlEscape($appevent). "WHERE uid=".S::sqlEscape($uid)." AND appid=".S::sqlEscape($appid));
         pwQuery::update('pw_userapp', 'uid=:uid AND appid=:appid', array($uid, $appid), array('appevent' => $appevent));
         return new ApiResponse(true);
     }
     return new ApiResponse(false);
 }
Beispiel #7
0
function update_markinfo($fid, $tid, $pid)
{
    global $db;
    $perpage = 10;
    $pid = intval($pid);
    $creditnames = pwCreditNames();
    $whereStr = " fid=" . S::sqlEscape($fid) . " AND tid=" . S::sqlEscape($tid) . " AND pid=" . S::sqlEscape($pid) . " AND ifhide=0 ";
    $count = 0;
    $creditCount = array();
    $query = $db->query("SELECT COUNT(*) AS count,name,SUM(point) AS sum FROM pw_pinglog WHERE {$whereStr} GROUP BY name");
    while ($rt = $db->fetch_array($query)) {
        $count += $rt['count'];
        if (isset($creditnames[$rt['name']])) {
            $creditCount[$rt['name']] += $rt['sum'];
        } elseif (in_array($rt['name'], $creditnames)) {
            $key = array_search($rt['name'], $creditnames);
            $creditCount[$key] += $rt['sum'];
        }
    }
    $markInfo = '';
    if ($count) {
        $query = $db->query("SELECT id FROM pw_pinglog WHERE {$whereStr} ORDER BY id DESC LIMIT 0,{$perpage}");
        $ids = array();
        while ($rt = $db->fetch_array($query)) {
            $ids[] = $rt['id'];
        }
        $markInfo = $count . ":" . implode(",", $ids);
        if ($creditCount) {
            $tmp = array();
            foreach ($creditCount as $key => $value) {
                $tmp[] = $key . '=' . $value;
            }
            $markInfo .= ':' . implode(',', $tmp);
        }
    }
    if ($pid == 0) {
        //* $db->update("UPDATE $pw_tmsgs SET ifmark=" . S::sqlEscape($markInfo) . " WHERE tid=" . S::sqlEscape($tid));
        $pw_tmsgs = GetTtable($tid);
        pwQuery::update($pw_tmsgs, 'tid=:tid', array($tid), array('ifmark' => $markInfo));
    } else {
        $db->update("UPDATE " . GetPtable("N", $tid) . " SET ifmark=" . S::sqlEscape($markInfo) . " WHERE pid=" . S::sqlEscape($pid));
    }
    return $markInfo;
}
Beispiel #8
0
function return_value($tid, $rw_a_name, $rw_a_val)
{
    global $db, $pw_posts, $authorid, $author, $onlineip, $forum, $fid, $credit;
    if ($rw_a_val < 1) {
        return;
    }
    $p_a = $u_a = array();
    $query = $db->query("SELECT pid,author,authorid FROM {$pw_posts} WHERE tid=" . S::sqlEscape($tid) . " AND ifreward='0' AND authorid!=" . S::sqlEscape($authorid) . " GROUP BY authorid ORDER BY postdate ASC LIMIT {$rw_a_val}");
    while ($user = $db->fetch_array($query)) {
        $credit->addLog('reward_active', array($rw_a_name => 1), array('uid' => $user['authorid'], 'username' => $user['author'], 'ip' => $onlineip, 'fname' => $forum[$fid]['name']));
        $p_a[] = $user['pid'];
        $u_a[] = $user['authorid'];
        $rw_a_val--;
    }
    //$p_a && $db->update("UPDATE $pw_posts SET ifreward='1' WHERE pid IN(" . S::sqlImplode($p_a) . ')');
    $p_a && pwQuery::update($pw_posts, 'pid IN(:pid)', array($p_a), array('ifreward' => '1'));
    $u_a && $credit->setus($u_a, array($rw_a_name => 1), false);
    if ($rw_a_val > 0) {
        $credit->addLog('reward_return', array($rw_a_name => $rw_a_val), array('uid' => $authorid, 'username' => $author, 'ip' => $onlineip, 'fname' => $forum[$fid]['name']));
        $credit->set($authorid, $rw_a_name, $rw_a_val, false);
    }
}
Beispiel #9
0
function updatecache_i_i($fid, $aidin = null)
{
    global $db, $db_windpost, $timestamp, $forum;
    require_once R_P . 'require/bbscode.php';
    //* include pwCache::getPath(D_P.'data/bbscache/forum_cache.php');
    extract(pwCache::getData(D_P . 'data/bbscache/forum_cache.php', false));
    $sql_where = empty($aidin) ? "fid=" . S::sqlEscape($fid) : "aid IN ({$aidin})";
    $F_ffid = false;
    $aid = $aidcache = 0;
    $aids = '';
    $query = $db->query("SELECT aid,startdate,enddate,content FROM pw_announce WHERE {$sql_where} AND ifopen='1' AND (enddate=0 OR enddate>=" . S::sqlEscape($timestamp) . ") ORDER BY vieworder,startdate DESC");
    while ($rt = $db->fetch_array($query)) {
        if ($rt['startdate'] <= $timestamp) {
            if ($F_ffid) {
                continue;
            } elseif (!$rt['enddate']) {
                $F_ffid = true;
            }
        }
        if (!$aid && $rt['startdate'] <= $timestamp && (!$rt['enddate'] || $rt['enddate'] >= $timestamp)) {
            $aid = $rt['aid'];
            if ($rt['content'] != convert($rt['content'], $db_windpost, 2)) {
                //* $db->update("UPDATE pw_announce SET ifconvert='1' WHERE aid=".S::sqlEscape($aid));
                pwQuery::update('pw_announce', 'aid=:aid', array($aid), array('ifconvert' => 1));
            }
        } else {
            $aids .= ",{$rt['aid']}";
        }
    }
    if ($aids) {
        $aids = substr($aids, 1);
        $aidcache = $timestamp;
    }
    //* $db->update("UPDATE pw_forumdata SET ".S::sqlSingle(array('aid'=>$aid,'aids'=>$aids,'aidcache'=>$aidcache))."WHERE fid=".S::sqlEscape($fid));
    pwQuery::update('pw_forumdata', 'fid=:fid', array($fid), array('aid' => $aid, 'aids' => $aids, 'aidcache' => $aidcache));
}
Beispiel #10
0
        is_null($locked) && Showmsg('mawhole_nolock');
        $msgdb = $logdb = array();
        $query = $db->query("SELECT locked,tid,fid,postdate,author,authorid,subject FROM pw_threads WHERE tid IN(" . S::sqlImplode($selids) . ")");
        while ($rt = $db->fetch_array($query)) {
            if ($rt['locked'] % 3 != $locked && $locked) {
                $s = $rt['locked'] > 2 ? $locked + 3 : $locked;
                //$db->update('UPDATE pw_threads SET locked='.S::sqlEscape($s).' WHERE tid='.S::sqlEscape($rt['tid']));
                pwQuery::update('pw_threads', 'tid=:tid', array($rt['tid']), array('locked' => $s));
                if ($ifmsg) {
                    $msgdb[] = array('toUser' => $rt['author'], 'title' => getLangInfo('writemsg', 'lock_title'), 'content' => getLangInfo('writemsg', 'lock_content', array('manager' => $windid, 'fid' => $fid, 'tid' => $rt['tid'], 'subject' => $rt['subject'], 'postdate' => get_date($rt['postdate']), 'forum' => strip_tags($forum[$fid]['name']), 'admindate' => get_date($timestamp), 'reason' => stripslashes($atc_content))));
                }
                $logdb[] = array('type' => 'locked', 'username1' => $rt['author'], 'username2' => $windid, 'field1' => $fid, 'field2' => $rt['tid'], 'field3' => '', 'descrip' => 'lock_descrip', 'timestamp' => $timestamp, 'ip' => $onlineip, 'tid' => $rt['tid'], 'subject' => substrs($rt['subject'], 28), 'forum' => $forum[$fid]['name'], 'reason' => stripslashes($atc_content));
            } elseif ($rt['locked'] % 3 != 0 && !$locked) {
                $s = $rt['locked'] > 2 ? 3 : 0;
                //$db->update("UPDATE pw_threads SET locked='$s' WHERE tid=".S::sqlEscape($rt['tid']));
                pwQuery::update('pw_threads', "tid=:tid", array($rt['tid']), array("locked" => $s));
                if ($ifmsg) {
                    $msgdb[] = array('toUser' => $rt['author'], 'title' => getLangInfo('writemsg', 'unlock_title'), 'content' => getLangInfo('writemsg', 'unlock_content', array('manager' => $windid, 'fid' => $fid, 'tid' => $rt['tid'], 'subject' => $rt['subject'], 'postdate' => get_date($rt['postdate']), 'forum' => strip_tags($forum[$fid]['name']), 'admindate' => get_date($timestamp), 'reason' => stripslashes($atc_content))));
                }
                $logdb[] = array('type' => 'locked', 'username1' => $rt['author'], 'username2' => $windid, 'field1' => $fid, 'field2' => $rt['tid'], 'field3' => '', 'descrip' => 'unlock_descrip', 'timestamp' => $timestamp, 'ip' => $onlineip, 'tid' => $rt['tid'], 'subject' => substrs($rt['subject'], 28), 'forum' => $forum[$fid]['name'], 'reason' => stripslashes($atc_content));
            }
        }
        sendMawholeMessages($msgdb);
        foreach ($logdb as $key => $val) {
            writelog($val);
        }
        refreshto("apps.php?q=group&a=thread&cyid={$cyid}", 'lock_success');
    }
} elseif ($action == 'pushtopic') {
    $pushtime_top = (int) pwRights(false, 'pushtime');
    if (empty($_POST['step'])) {
Beispiel #11
0
// update posts hits
if ($c_htm || $db_hits_store == 2) {
    $db_hithour == 0 && ($db_hithour = 4);
    $hit_wtime = $hit_control * $db_hithour;
    $hit_wtime > 24 && ($hit_wtime = 0);
    $hitsize = @filesize(D_P . 'data/bbscache/hits.txt');
    if ($hitsize && ($hitsize > 1024 || $timestamp - $hit_tdtime > $hit_wtime * 3600) && procLock('hitupdate')) {
        require_once R_P . 'require/hitupdate.php';
        procUnLock('hitupdate');
    }
}
if ($higholnum < $usertotal) {
    pwQuery::update('pw_bbsinfo', 'id=:id', array(1), array('higholnum' => $usertotal, 'higholtime' => $timestamp));
    $higholnum = $usertotal;
}
if ($hposts < $tposts) {
    pwQuery::update('pw_bbsinfo', 'id=:id', array(1), array('hposts' => $tposts));
    $hposts = $tposts;
}
$mostinbbstime = get_date($higholtime);
if (!$ol_offset && $db_onlinelmt != 0 && $usertotal >= $db_onlinelmt) {
    Cookie('ol_offset', '', 0);
    Showmsg('most_online');
}
if ($plantime && $timestamp > $plantime && procLock('task')) {
    require_once R_P . 'require/task.php';
    procUnLock('task');
}
require_once PrintEot('index');
CloudWind::yunSetCookie(SCR);
footer();
Beispiel #12
0
 function changeEmail($uid, $newEmail)
 {
     $uid = intval($uid);
     $newEmail = trim($newEmail);
     if (!$uid || !$newEmail) {
         return false;
     }
     PW_Register::checkEmail($newEmail);
     return pwQuery::update('pw_members', "uid=:uid", array($uid), array('email' => $newEmail));
 }
Beispiel #13
0
                pwQuery::insert('pw_cmembers', array('uid' => $rt['uid'], 'username' => $admin, 'ifadmin' => 1, 'colonyid' => $cyid, 'addtime' => $timestamp));
            }
            $pwSQL['admin'] = $admin;
        }
        require_once A_P . 'lib/colonys.class.php';
        $colonyServer = new PW_Colony();
        if ($cid != $colony['classid']) {
            $cid = isset($o_classdb[$cid]) ? $cid : 0;
            $colonyServer->changeTopicToForum($cyid, $iftopicshowinforum, $cid, $colony['classid']);
            $pwSQL['classid'] = $cid;
        } elseif ($iftopicshowinforum != $colony['iftopicshowinforum'] && $colony['classid'] > 0) {
            $colonyServer->changeTopicShowInForum($cyid, $iftopicshowinforum, $colony['classid']);
        }
        $pwSQL['styleid'] = $styleid;
        //* $db->update("UPDATE pw_colonys SET " . S::sqlSingle($pwSQL) . ' WHERE id=' . S::sqlEscape($cyid));
        pwQuery::update('pw_colonys', 'id=:id', array($cyid), $pwSQL);
        require_once R_P . 'u/require/core.php';
        updateGroupLevel($cyid, $colony);
        adminmsg('operate_success', "{$basename}&action=editcolony");
    }
} elseif ($action == 'mergecolony') {
    if (empty($_POST['step'])) {
        require_once PrintApp('admin');
    } else {
        $basename = $basename . '&action=mergecolony';
        S::gp(array('fromcname', 'tocname'), '');
        require_once A_P . 'lib/colony.class.php';
        require_once A_P . 'lib/colonys.class.php';
        $colonyServer = new PW_Colony();
        if (!($colony = $colonyServer->getColonyByName($fromcname))) {
            adminmsg('源群组不存在!');
Beispiel #14
0
 /**
  * 基础更新数据查询语句
  * @param $fieldData
  * @param $id
  * @return unknown_type
  */
 function _update($fieldData, $id)
 {
     if (!$this->_check() || !$fieldData || $id < 1) {
         return false;
     }
     //* $this->_db->update("UPDATE " . $this->_tableName . " SET " . $this->_getUpdateSqlString($fieldData) . " WHERE " . $this->_primaryKey . "=" . $this->_addSlashes($id) . " LIMIT 1");
     return pwQuery::update($this->_tableName, "{$this->_primaryKey}=:{$this->_primaryKey}", array($id), $fieldData);
 }
Beispiel #15
0
            $creditdb = $credit->get($value['uid'], 'CUSTOM');
            foreach ($creditdb as $k => $val) {
                /**
                				$db->pw_update(
                					"SELECT uid FROM pw_membercredit WHERE uid=".S::sqlEscape($newuid)."AND cid=".S::sqlEscape($k),
                					"UPDATE pw_membercredit SET value=value+".S::sqlEscape($val[1])."WHERE uid=".S::sqlEscape($newuid)."AND cid=".S::sqlEscape($k),
                					"INSERT INTO pw_membercredit SET".S::sqlSingle(array('uid'=>$newuid,'cid'=>$k,'value'=>$val[1]))
                				);
                				**/
                $db->pw_update("SELECT uid FROM pw_membercredit WHERE uid=" . S::sqlEscape($newuid) . "AND cid=" . S::sqlEscape($k), pwQuery::buildClause("UPDATE :pw_table SET value=value+:value WHERE uid=:uid AND cid=:cid", array('pw_membercredit', $val[1], $newuid, $k)), pwQuery::insertClause('pw_membercredit', array('uid' => $newuid, 'cid' => $k, 'value' => $val[1])));
            }
            //$db->update("UPDATE pw_threads SET ".S::sqlSingle(array('author'=>$touser['username'],'authorid'=>$newuid))."WHERE authorid=".S::sqlEscape($value['uid']));
            pwQuery::update('pw_threads', 'authorid=:authorid', array($value['uid']), array('author' => $touser['username'], 'authorid' => $newuid));
            foreach ($ptable_a as $val) {
                //$db->update("UPDATE $val SET ".S::sqlSingle(array('author'=>$touser['username'],'authorid'=>$newuid))."WHERE authorid=".S::sqlEscape($value['uid']));
                pwQuery::update($val, 'authorid=:authorid', array($value['uid']), array('author' => $touser['username'], 'authorid' => $newuid));
            }
            $db->update("UPDATE pw_attachs SET uid=" . S::sqlEscape($newuid) . "WHERE uid=" . S::sqlEscape($value['uid']));
            $userService->delete($value['uid']);
            $messageServer = L::loadClass('message', 'message');
            $messageServer->clearMessages($value['uid'], array('groupsms', 'sms', 'notice', 'request', 'history'));
        }
        $mainFields = array();
        $memberDataFields = array('postnum' => $postnum, 'digests' => $digests, 'rvrc' => $rvrc, 'money' => $money, 'credit' => $credits, 'currency' => $currency);
        $memberInfoFields = array('deposit' => $deposit, 'ddeposit' => $ddeposit);
        $userService->updateByIncrement($newuid, $mainFields, $memberDataFields, $memberInfoFields);
        adminmsg('operate_success');
    }
    include PrintEot('usermanage');
    exit;
} elseif ($adminitem == 'customcredit') {
Beispiel #16
0
<?php

!defined('P_W') && exit('Forbidden');
InitGP(array('id'), null, 2);
InitGP(array('record'));
$rt = $db->get_one("SELECT tid,fid FROM pw_pinglog WHERE ifhide=0 AND id=" . S::sqlEscape($id));
if (empty($rt) || !$rt['fid']) {
    Showmsg('data_error');
}
L::loadClass('forum', 'forum', false);
$pwforum = new PwForum($rt['fid']);
$isGM = CkInArray($windid, $manager);
if (!$isGM && !pwRights($pwforum->isBM($windid), 'pingcp', $rt['fid'])) {
    Showmsg('mawhole_right');
}
//$db->update("UPDATE pw_pinglog SET record=" . S::sqlEscape($record) . " WHERE id=" . S::sqlEscape($id));
pwQuery::update('pw_pinglog', 'id=:id', array($id), array('record' => $record));
echo "success";
# memcache reflesh
if ($db_memcache) {
    //* $threads = L::loadClass('Threads', 'forum');
    //* $threads->delThreads($rt['tid']);
    Perf::gatherInfo('changeThreadWithThreadIds', array('tid' => $rt['tid']));
}
ajax_footer();
Beispiel #17
0
    require_once R_P . 'require/header.php';
    require_once PrintEot('reward');
    footer();
} else {
    PostCheck();
    require_once R_P . 'require/credit.php';
    //* include_once pwCache::getPath(D_P . 'data/bbscache/forum_cache.php');
    pwCache::getData(D_P . 'data/bbscache/forum_cache.php');
    if ($type == '1') {
        //$db->update("UPDATE pw_threads SET state='2' WHERE tid=" . S::sqlEscape($tid));
        pwQuery::update('pw_threads', 'tid=:tid', array($tid), array('state' => 2));
        $credit->addLog('reward_return', array($rt['cbtype'] => $rt['cbval'] * 2), array('uid' => $authorid, 'username' => $author, 'ip' => $onlineip, 'fname' => $forum[$fid]['name']));
        $credit->set($authorid, $rt['cbtype'], $rt['cbval'] * 2);
    } else {
        if ($timestamp < $rt['timelimit'] && $groupid != '3' && $groupid != '4') {
            Showmsg('reward_time_limit');
        }
        //$db->update("UPDATE pw_threads SET state='3' WHERE tid=" . S::sqlEscape($tid));
        pwQuery::update('pw_threads', 'tid=:tid', array($tid), array('state' => 3));
    }
    return_value($tid, $rt['catype'], $rt['caval']);
    if ($ifmsg) {
        if ($type == '1') {
            $affect = $credit->cType[$rt['cbtype']] . ":" . $rt['cbval'] * 2;
        } else {
            $affect = '';
        }
        M::sendNotice(array($rt['author']), array('title' => getLangInfo('writemsg', 'endreward_title_' . $type), 'content' => getLangInfo('writemsg', 'endreward_content_' . $type, array('manager' => $windid, 'fid' => $fid, 'tid' => $tid, 'subject' => $rt['subject'], 'postdate' => get_date($rt['postdate']), 'forum' => $forum[$fid]['name'], 'affect' => $affect, 'admindate' => get_date($timestamp), 'reason' => 'None'))));
    }
    refreshto("read.php?tid={$tid}&ds=1", 'operate_success');
}
Beispiel #18
0
function updatecache_fd1()
{
    global $db;
    require_once R_P . 'admin/cache.php';
    //* $db->update("UPDATE pw_forums SET childid='0',fupadmin=''");
    $db->update(pwQuery::buildClause("UPDATE :pw_table SET childid='0',fupadmin=''", array('pw_forums')));
    $query = $db->query("SELECT fid,forumadmin FROM pw_forums WHERE type='category' ORDER BY vieworder");
    while ($cate = $db->fetch_array($query)) {
        S::slashes($cate);
        $query2 = $db->query("SELECT fid,forumadmin FROM pw_forums WHERE type='forum' AND fup=" . S::sqlEscape($cate['fid']));
        if ($db->num_rows($query2)) {
            $havechild[] = $cate['fid'];
            while ($forum = $db->fetch_array($query2)) {
                S::slashes($forum);
                $fupadmin = trim($cate['forumadmin']);
                if ($fupadmin) {
                    //$db->update("UPDATE pw_forums SET fupadmin=".S::sqlEscape($fupadmin)." WHERE fid=".S::sqlEscape($forum['fid']));
                    pwQuery::update('pw_forums', 'fid=:fid', array($forum['fid']), array('fupadmin' => $fupadmin));
                }
                if (trim($forum['forumadmin'])) {
                    $fupadmin .= $fupadmin ? substr($forum['forumadmin'], 1) : $forum['forumadmin'];
                    //is
                }
                $query3 = $db->query("SELECT fid,forumadmin FROM pw_forums WHERE type='sub' AND fup=" . S::sqlEscape($forum['fid']));
                if ($db->num_rows($query3)) {
                    $havechild[] = $forum['fid'];
                    while ($sub1 = $db->fetch_array($query3)) {
                        S::slashes($sub1);
                        $fupadmin1 = $fupadmin;
                        if ($fupadmin1) {
                            //$db->update("UPDATE pw_forums SET fupadmin=".S::sqlEscape($fupadmin1)." WHERE fid=".S::sqlEscape($sub1['fid']));
                            pwQuery::update('pw_forums', 'fid=:fid', array($sub1['fid']), array('fupadmin' => $fupadmin1));
                        }
                        if (trim($sub1['forumadmin'])) {
                            $fupadmin1 .= $fupadmin1 ? substr($sub1['forumadmin'], 1) : $sub1['forumadmin'];
                        }
                        $query4 = $db->query("SELECT fid,forumadmin FROM pw_forums WHERE type='sub' AND fup=" . S::sqlEscape($sub1['fid']));
                        if ($db->num_rows($query4)) {
                            $havechild[] = $sub1['fid'];
                            while ($sub2 = $db->fetch_array($query4)) {
                                S::slashes($sub2);
                                $fupadmin2 = $fupadmin1;
                                if ($fupadmin2) {
                                    //$db->update("UPDATE pw_forums SET fupadmin=".S::sqlEscape($fupadmin2)." WHERE fid=".S::sqlEscape($sub2['fid']));
                                    pwQuery::update('pw_forums', 'fid=:fid', array($sub2['fid']), array('fupadmin' => $fupadmin2));
                                }
                            }
                        }
                    }
                }
            }
        }
    }
    if ($havechild) {
        /*
        $havechilds = S::sqlImplode($havechild);
        $db->update("UPDATE pw_forums SET childid='1' WHERE fid IN($havechilds)");
        */
        pwQuery::update('pw_forums', 'fid IN(:fid)', array($havechild), array('childid' => '1'));
    }
}
Beispiel #19
0
function updateGroupLevel($cyid, $gdb = array())
{
    require_once R_P . 'require/functions.php';
    global $o_groups_upgrade, $o_groups_levelneed;
    //* isset($o_groups_upgrade) || include pwCache::getPath(D_P . 'data/bbscache/o_config.php');
    isset($o_groups_upgrade) || extract(pwCache::getData(D_P . 'data/bbscache/o_config.php', false));
    $nums = CalculateCredit($gdb, $o_groups_upgrade);
    arsort($o_groups_levelneed);
    reset($o_groups_levelneed);
    $lid = 0;
    foreach ($o_groups_levelneed as $key => $lowneed) {
        $lid = $key;
        if ($nums >= $lowneed) {
            break;
        }
    }
    if ($lid != $gdb['commonlevel']) {
        //* $GLOBALS['db']->update("UPDATE pw_colonys SET commonlevel=" . S::sqlEscape($lid) . ' WHERE id=' . S::sqlEscape($cyid));
        pwQuery::update('pw_colonys', 'id=:id', array($cyid), array('commonlevel' => $lid));
    }
}
Beispiel #20
0
    } else {
        S::gp(array('password'));
        S::gp(array('newmanager'), 'GP', 2);
        if (!threadSetCheckOwnerPassword($winduid, $password)) {
            Showmsg('您输入的密码不正确!');
        }
        $userdb = $db->get_one("SELECT m.username,m.groupid,m.memberid FROM pw_cmembers c LEFT JOIN pw_members m ON c.uid=m.uid WHERE c.ifadmin='1' AND c.colonyid=" . S::sqlEscape($cyid) . ' AND c.uid=' . S::sqlEscape($newmanager));
        if (empty($userdb)) {
            Showmsg('请选择要转让的用户!');
        }
        $userdb['groupid'] == '-1' && ($userdb['groupid'] = $userdb['memberid']);
        if ($o_groups && strpos($o_groups, ',' . $userdb['groupid'] . ',') === false) {
            Showmsg('您选择的用户没有接受的权限!');
        }
        //* $db->update("UPDATE pw_colonys SET admin=" . S::sqlEscape($userdb['username']) . ' WHERE id=' . S::sqlEscape($cyid));
        pwQuery::update('pw_colonys', 'id=:id', array($cyid), array('admin' => $userdb['username']));
        M::sendNotice(array($userdb['username']), array('title' => getLangInfo('writemsg', 'group_attorn_title'), 'content' => getLangInfo('writemsg', 'group_attorn_content', array('username' => $windid, 'cyid' => $cyid, 'cname' => $colony['cname'], 'descrip' => $colony['descrip']))));
        refreshto("thread.php?cyid={$cyid}", '转让群组成功!');
    }
} elseif ($t == 'disband') {
    if (!($windid == $colony['admin'] && $groupRight['allowdisband'] || $groupid == '3')) {
        Showmsg('colony_out_right');
    }
    if (empty($_POST['step'])) {
        require_once PrintEot('thread_set');
        footer();
    } else {
        S::gp(array('password'));
        if (!threadSetCheckOwnerPassword($winduid, $password)) {
            Showmsg('您输入的密码不正确!');
        }
Beispiel #21
0
 }
 /*		if ($_vieworder) {
 			if (count(array_unique($_vieworder)) < count($_vieworder)) {
 				Showmsg('顺序不能重复');
 			}
 		}*/
 $filterService = L::loadClass('FilterUtil', 'filter');
 if ($updateHotwordsDb) {
     foreach ($updateHotwordsDb as $key => $value) {
         if (($GLOBALS['banword'] = $filterService->comprise($value['keyword'])) !== false) {
             Showmsg('content_wordsfb');
         }
         $updateArr = array('keyword' => $value['keyword'], 'vieworder' => $value['vieworder']);
         $value['fromtype'] && ($updateArr = array_merge($updateArr, array('fromtype' => $value['fromtype'])));
         //$db->update(" UPDATE pw_searchhotwords SET ".S::sqlSingle($updateArr)." WHERE id=".S::sqlEscape($key));
         pwQuery::update('pw_searchhotwords', "id=:id", array($key), $updateArr);
     }
 }
 if (!$view) {
     foreach ($tempHotwords as $key => $value) {
         if (!$key) {
             continue;
         }
         $delHotwordsIds[] = $key;
     }
     $delHotwordsIds && pwQuery::delete('pw_searchhotwords', 'id IN(:id)', array($delHotwordsIds));
 }
 if ($delHotwordsNoIds) {
     //$db->update(" DELETE FROM pw_searchhotwords WHERE id NOT IN(".S::sqlImplode($delHotwordsNoIds).")");
     pwQuery::delete('pw_searchhotwords', 'id NOT IN(:id)', array($delHotwordsNoIds));
 }
Beispiel #22
0
    $admincheck = 0;
}
if ($groupid != 'guest' && ($admincheck || $attach['uid'] == $winduid)) {
    pwDelatt($attach['attachurl'], $db_ifftp);
    pwFtpClose($ftp);
    $pw_attachs->delete($aid);
    $ifupload = getattachtype($tid);
    $ifaid = $ifupload === false ? 0 : 1;
    if ($pid) {
        $pw_posts = GetPtable('N', $tid);
        //$db->update("UPDATE $pw_posts SET aid=" . S::sqlEscape($ifaid, false) . "WHERE tid=" . S::sqlEscape($tid, false) . "AND pid=" . S::sqlEscape($pid, false));
        pwQuery::update($pw_posts, 'tid=:tid AND pid=:pid', array($tid, $pid), array('aid' => $ifaid));
    } else {
        $pw_tmsgs = GetTtable($tid);
        //* $db->update("UPDATE $pw_tmsgs SET aid=" . S::sqlEscape($ifaid, false) . " WHERE tid=" . S::sqlEscape($tid, false));
        pwQuery::update($pw_tmsgs, 'tid=:tid', array($tid), array('aid' => $ifaid));
    }
    $ifupload = (int) $ifupload;
    //$db->update('UPDATE pw_threads SET ifupload=' . S::sqlEscape($ifupload) . ' WHERE tid=' . S::sqlEscape($tid));
    pwQuery::update('pw_threads', 'tid=:tid', array($tid), array('ifupload' => $ifupload));
    if ($foruminfo['allowhtm'] && $page == 1) {
        $StaticPage = L::loadClass('StaticPage');
        $StaticPage->update($tid);
        empty($j_p) && ($j_p = "read.php?tid={$tid}&ds=1");
        refreshto($j_p, 'operate_success');
    } else {
        refreshto("read.php?tid={$tid}&ds=1&page={$page}", 'operate_success');
    }
} else {
    Showmsg('job_attach_right');
}
 /**
  * 设置是否允许热门标签
  * 
  * @param array $tagids
  * @return boolean
  */
 function setHotByTagids($tagids, $ifhot)
 {
     $ifhot = intval($ifhot);
     if ($ifhot < 0 || !S::isArray($tagids)) {
         return false;
     }
     return pwQuery::update($this->_tableName, "tagid in(:tagid)", array($tagids), array('ifhot' => $ifhot));
 }
Beispiel #24
0
                        if ($fupadmin1) {
                            //$db->update("UPDATE pw_forums SET fupadmin=".S::sqlEscape($fupadmin1,false)."WHERE fid=".S::sqlEscape($sub1['fid'],false));
                            pwQuery::update('pw_forums', 'fid=:fid', array($sub1['fid']), array('fupadmin' => $fupadmin1));
                        }
                        if (trim($sub1['forumadmin'])) {
                            $fupadmin1 .= $fupadmin1 ? substr($sub1['forumadmin'], 1) : $sub1['forumadmin'];
                        }
                        $query4 = $db->query("SELECT fid,forumadmin FROM pw_forums WHERE type='sub' AND fup=" . S::sqlEscape($sub1['fid'], false));
                        if ($db->num_rows($query4)) {
                            $havechild[] = $sub1['fid'];
                            while ($sub2 = $db->fetch_array($query4)) {
                                $fupadmin2 = $fupadmin1;
                                if ($fupadmin2) {
                                    //$db->update("UPDATE pw_forums SET fupadmin=".S::sqlEscape($fupadmin2,false)."WHERE fid=".S::sqlEscape($sub2['fid'],false));
                                    pwQuery::update('pw_forums', 'fid=:fid', array($sub2['fid']), array('fupadmin' => $fupadmin2));
                                }
                            }
                        }
                    }
                }
            }
        }
    }
    if ($havechild) {
        /*
        $havechilds = S::sqlImplode($havechild,false);
        $db->update("UPDATE pw_forums SET childid='1' WHERE fid IN($havechilds)");
        */
        pwQuery::update('pw_forums', 'fid IN(:fid)', array($havechild), array('childid' => '1'));
    }
}
Beispiel #25
0
         $rt['ifadmin'] == -1 && $newMemberCount++;
         $toUsers[] = $rt['username'];
     }
     $newColony->updateInfoCount(array('members' => $newMemberCount));
     //* $db->update("UPDATE pw_cmembers SET ifadmin='1' WHERE colonyid=" . S::sqlEscape($cyid) . ' AND uid IN(' . S::sqlImplode($selid) . ") AND ifadmin!='1'");
     pwQuery::update('pw_cmembers', 'colonyid=:colonyid AND uid IN (:uid) AND ifadmin!=:ifadmin', array($cyid, $selid, 1), array('ifadmin' => 1));
     break;
 case 'deladmin':
     $colony['admin'] != $windid && $groupid != 3 && Showmsg('colony_manager');
     $query = $db->query("SELECT username FROM pw_cmembers WHERE colonyid=" . S::sqlEscape($cyid) . ' AND uid IN(' . S::sqlImplode($selid) . ") AND ifadmin='1'");
     while ($rt = $db->fetch_array($query)) {
         $colony['admin'] == $rt['username'] && Showmsg('colony_delladminfail');
         $toUsers[] = $rt['username'];
     }
     //* $db->update("UPDATE pw_cmembers SET ifadmin='0' WHERE colonyid=" . S::sqlEscape($cyid) . ' AND uid IN(' . S::sqlImplode($selid) . ") AND ifadmin='1'");
     pwQuery::update('pw_cmembers', 'colonyid=:colonyid AND uid IN (:uid) AND ifadmin=:ifadmin', array($cyid, $selid, 1), array('ifadmin' => 0));
     break;
 case 'check':
     $toUsers = $newColony->checkMembers($selid);
     break;
 case 'del':
     $query = $db->query("SELECT username,ifadmin FROM pw_cmembers WHERE colonyid=" . S::sqlEscape($cyid) . ' AND uid IN(' . S::sqlImplode($selid) . ")");
     while ($rt = $db->fetch_array($query)) {
         if ($rt['username'] == $colony['admin']) {
             Showmsg('colony_delfail');
         }
         if ($groupid != 3 && $rt['ifadmin'] == '1' && $colony['admin'] != $windid) {
             Showmsg('colony_manager');
         }
         $rt['ifadmin'] != -1 && $trueMemberCount++;
         $toUsers[] = $rt['username'];
Beispiel #26
0
 function recountTopic($read, $ifdel, $recycle)
 {
     global $db_anonymousname, $timestamp;
     $ret = 0;
     $tid = $read['tid'];
     $pw_posts = GetPtable($read['ptable']);
     $replies = $this->db->get_value("SELECT COUNT(*) AS replies FROM {$pw_posts} WHERE tid='{$tid}' AND ifcheck='1'");
     if (!$replies) {
         $read['anonymous'] && ($read['author'] = $db_anonymousname);
         if ($ifdel) {
             if ($recycle) {
                 //$this->db->update("UPDATE pw_threads SET fid='0',ifshield='0' WHERE tid='$tid'");
                 pwQuery::update('pw_threads', 'tid = :tid', array($tid), array('fid' => 0, 'ifshield' => 0));
             } else {
                 //* $threadManager = L::loadClass("threadmanager", 'forum');
                 //* $threadManager->deleteByThreadId($read['fid'], $tid);
                 $threadService = L::loadclass('threads', 'forum');
                 $threadService->deleteByThreadId($tid);
                 Perf::gatherInfo('changeThreadWithForumIds', array('fid' => $read['fid']));
                 $pw_tmsgs = GetTtable($tid);
                 //* $this->db->update("DELETE FROM $pw_tmsgs WHERE tid='$tid'");
                 pwQuery::delete($pw_tmsgs, 'tid=:tid', array($tid));
             }
             $ret = 1;
         } else {
             $pwSQL = array('replies' => 0, 'lastposter' => $read['author']);
             !($read['lastpost'] > $timestamp || $read['locked'] > 2) && ($pwSQL['lastpost'] = $read['postdate']);
             //$this->db->update("UPDATE pw_threads SET " . S::sqlSingle($pwSQL) . " WHERE tid=" . S::sqlEscape($tid));
             pwQuery::update('pw_threads', 'tid = :tid', array($tid), $pwSQL);
         }
     } else {
         $pt = $this->db->get_one("SELECT postdate,author,anonymous FROM {$pw_posts} WHERE tid='{$tid}' ORDER BY postdate DESC LIMIT 1");
         $pt['anonymous'] && ($pt['author'] = $db_anonymousname);
         $pwSQL = array('replies' => $replies, 'lastposter' => $pt['author']);
         !($read['lastpost'] > $timestamp || $read['locked'] > 2) && ($pwSQL['lastpost'] = $pt['postdate']);
         //$this->db->update("UPDATE pw_threads SET " . S::sqlSingle($pwSQL) . " WHERE tid=" . S::sqlEscape($tid));
         pwQuery::update('pw_threads', 'tid = :tid', array($tid), $pwSQL);
     }
     return $ret;
 }
Beispiel #27
0
    $aid = $attach['aid'];
    //获取管理权限
    $isGM = S::inArray($windid, $manager);
    !$isGM && ($groupid = 3 && ($isGM = 1));
    if ($isGM) {
        $admincheck = 1;
    } else {
        $admincheck = 0;
    }
    $attach['attachurl'] = "diary/" . $attach['attachurl'];
    if ($admincheck || $attach['uid'] == $winduid) {
        pwDelatt($attach['attachurl'], $db_ifftp);
        pwFtpClose($ftp);
        $diaryService = L::loadClass('Diary', 'diary');
        /* @var $diaryService PW_Diary */
        $diary = array();
        $diary = $diaryService->get($did);
        $attachs = unserialize($diary['aid']);
        if (is_array($attachs)) {
            unset($attachs[$aid]);
            $attachs = $attachs ? serialize($attachs) : '';
            //$db->update("UPDATE pw_diary SET aid=".S::sqlEscape($attachs)."WHERE did=" . S::sqlEscape($did));
            pwQuery::update('pw_diary', 'did =:did', array($did), array('aid' => $attachs));
        }
        $db->update("DELETE FROM pw_attachs WHERE aid=" . S::sqlEscape($aid));
        echo 'success';
        ajax_footer();
    } else {
        Showmsg('job_attach_right');
    }
}
Beispiel #28
0
             $num = $db->get_value($sql);
             /**
             						$db->update("UPDATE pw_forumdata SET article=article+".S::sqlEscape($num).",topic=topic+".S::sqlEscape($num,false)."WHERE fid=".S::sqlEscape($key));
             						**/
             $db->update(pwQuery::buildClause("UPDATE :pw_table SET article=article+:article,topic=topic+:topic WHERE fid=:fid", array('pw_forumdata', $num, $num, $key)));
         }
     }
     $tmpStid = $sTid;
     $sTid = S::sqlImplode($sTid);
     //更改帖子状态
     if ($sTid) {
         //$sql = "UPDATE pw_threads SET ifcheck=1 WHERE tid IN (".$sTid.")";
         pwQuery::update('pw_threads', 'tid IN (:tid)', array($tmpStid), array('ifcheck' => 1));
         foreach (array_keys($ttable) as $pw_tmsgs) {
             //* $sql = "UPDATE $pw_tmsgs SET ifwordsfb='$db_wordsfb' WHERE tid IN (".$sTid.")";
             pwQuery::update($pw_tmsgs, 'tid IN (:tid)', array($tmpStid), array('ifwordsfb' => $db_wordsfb));
         }
     }
     $filter_id = S::sqlImplode($objid);
     if ($filter_id) {
         //更改审核状态,更新审核人员信息
         $sql = "UPDATE pw_filter SET state=1,assessor=" . S::sqlEscape($admin_name) . ",updated_at=" . S::sqlEscape($timestamp) . " WHERE id IN (" . $filter_id . ")";
         $db->update($sql);
     }
     //重定向
     adminmsg('operate_success', "{$basename}" . "&action=check");
 } else {
     $sql = "SELECT pid FROM pw_filter WHERE pid>0 AND state=0";
     $query = $db->query($sql);
     while ($rt = $db->fetch_array($query)) {
         $pid[] = (int) $rt['pid'];
Beispiel #29
0
    if ($foruminfo['allowhtm'] == 1) {
        #纯静态页面生成
        $htmurl = $db_readdir . '/' . $fid . '/' . date('ym', $read['postdate']) . '/' . $read['tid'] . '.html';
        if (!$foruminfo['cms'] && !$toread && file_exists(R_P . $htmurl)) {
            ObHeader("{$R_url}/{$htmurl}");
        }
    }
    $readdb[] = $read;
}
$toread && ($urladd .= "&toread={$toread}");
$fpage > 1 && ($urladd .= "&fpage={$fpage}");
$pages = numofpage($count + $topped_count, $page, $numofpage, "read.php?tid={$tid}{$urladd}{$viewbbs}&");
$tpc_locked = $read['locked'] % 3 != 0 ? 1 : 0;
//更新帖子点击
if ($db_hits_store == 0) {
    pwQuery::update('pw_threads', 'tid=:tid', array($tid), null, array(PW_EXPR => array('hits=hits+1')));
} elseif ($db_hits_store == 1) {
    $db->update('UPDATE pw_hits_threads SET hits=hits+1 WHERE tid=' . S::sqlEscape($tid));
} elseif ($db_hits_store == 2) {
    pwCache::writeover(D_P . 'data/bbscache/hits.txt', $tid . "\t", 'ab');
}
//帖子浏览记录
$readlog = str_replace(",{$tid},", ',', GetCookie('readlog'));
$readlog .= ($readlog ? '' : ',') . $tid . ',';
$readlogCount = substr_count($readlog, ',');
$readlogCount > 11 && ($readlog = preg_replace("/[\\d]+\\,/i", '', $readlog, $readlogCount - 11));
Cookie('readlog', $readlog);
$favortitle = str_replace(array("&#39;", "'", "\"", "\\"), array("‘", "\\'", "\\\"", "\\\\"), $subject);
$db_bbsname_a = addslashes($db_bbsname);
#模版内用到
if ($readdb[0]['cyid']) {
Beispiel #30
0
@name:加亮道具
@type:帖子类
@effect:可以将自己的帖子标题加亮显示

****/
if ($tooldb['type'] != 1) {
    Showmsg('tooluse_type_error');
    // 判断道具类型是否设置错误
}
if (!$_POST['step']) {
    require_once uTemplate::PrintEot('profile_toolcenter');
    ajax_footer();
} else {
    if ($tpcdb['authorid'] != $winduid) {
        Showmsg('tool_authorlimit');
    }
    S::gp(array('title1', 'title2', 'title3', 'title4', 'title5', 'title6'));
    $titlefont = "{$title1}~{$title2}~{$title3}~{$title4}~{$title5}~{$title6}~";
    //$db->update("UPDATE pw_threads SET titlefont=".S::sqlEscape($titlefont).",toolinfo=".S::sqlEscape($tooldb['name'],false)."WHERE tid=".S::sqlEscape($tid));
    pwQuery::update('pw_threads', 'tid=:tid', array($tid), array('titlefont' => $titlefont, 'toolinfo' => $tooldb['name']));
    $fid = $db->get_value("SELECT fid FROM pw_threads WHERE tid=" . S::sqlEscape($tid));
    //* $threads = L::loadClass('Threads', 'forum');
    //$threads->delThreads($tid);
    Perf::gatherInfo('changeThreadWithForumIds', array('fid' => $fid));
    require_once R_P . 'require/updateforum.php';
    delfcache($fid, $db_fcachenum);
    $db->update("UPDATE pw_usertool SET nums=nums-1 WHERE uid=" . S::sqlEscape($winduid) . "AND toolid=" . S::sqlEscape($toolid));
    $logdata = array('type' => 'use', 'nums' => '', 'money' => '', 'descrip' => 'tool_3_descrip', 'uid' => $winduid, 'username' => $windid, 'ip' => $onlineip, 'time' => $timestamp, 'toolname' => $tooldb['name'], 'subject' => substrs($tpcdb['subject'], 15), 'tid' => $tid);
    writetoollog($logdata);
    Showmsg('toolmsg_success');
}