Example #1
0
 /**
  * 批量添加教育经历
  * @param array $data
  * @return bool
  */
 function addEducations($data)
 {
     if (!S::isArray($data)) {
         return false;
     }
     return $this->_db->update("INSERT INTO " . $this->_tableName . "(uid,schoolid,educationlevel,starttime) VALUES " . S::sqlMulti($data));
 }
Example #2
0
 /**
  * 添加工作经历
  * @param array $data
  * @return bool
  */
 function addCareers($data)
 {
     if (!S::isArray($data)) {
         return false;
     }
     return $this->_db->update("INSERT INTO {$this->_tableName} (uid,companyid,starttime) VALUES " . S::sqlMulti($data) . "");
 }
Example #3
0
 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;
 }
Example #4
0
 /**
  * 批量添加多所学校
  * @param string $schoolNames 学校名称
  * @return int $Id 学校
  */
 function addSchools($fieldData)
 {
     if (!S::isArray($fieldData)) {
         return false;
     }
     return $this->_db->update("INSERT INTO " . $this->_tableName . " (schoolname,areaid,type) VALUES " . S::sqlMulti($fieldData));
 }
 function _updateDb()
 {
     global $db;
     $fileContent = $this->_getFileContent();
     $temparray = explode("\t", $fileContent);
     $data = s::isArray($temparray) ? array_count_values($temparray) : array();
     $nowtime = PwStrtoTime(get_date($this->_timestamp, 'Y-m-d'));
     $sql = array();
     foreach ($data as $key => $val) {
         $key = trim($this->_filterCheckKeyword($key));
         if (!$key) {
             continue;
         }
         $sql[] = array($key, $val, $nowtime);
         if (++$count > 1000) {
             break;
         }
     }
     if (!$sql) {
         return false;
     }
     $db->query("INSERT INTO pw_searchstatistic(keyword,num,created_time) VALUES " . S::sqlMulti($sql));
     $deleteTime = $this->_timestamp - 86400 * 90;
     $db->query("DELETE FROM pw_searchstatistic WHERE created_time < {$deleteTime}");
     return true;
 }
Example #6
0
 function updates($array)
 {
     foreach ($array as $key => $value) {
         $array[$key] = $this->_serializeData($value);
     }
     $this->_db->update("REPLACE INTO " . $this->_tableName . " (invokepieceid,data,cachetime) VALUES " . S::sqlMulti($array, false));
 }
Example #7
0
 /**
  * 批量更新缓存数据
  *
  * @param array $data 缓存数据,array('KEY'=>'VALUE')
  * @param int $expire 缓存数据自动过期时间(秒)
  * @return bool
  */
 function update($data, $expire = 180)
 {
     $tmpvhash = $dcache = $kcache = array();
     $expire = $this->now + $expire;
     $keys = array_keys($data);
     if ($keys) {
         $query = $this->cache->query("SELECT skey,vhash FROM " . $this->table . " WHERE skey IN (" . S::sqlImplode($keys, false) . ")");
         while ($rt = $this->cache->fetch_array($query)) {
             $tmpvhash[$rt['skey']] = $rt['vhash'];
         }
     }
     foreach ($data as $key => $value) {
         $v = $this->_serialize($value);
         $vhash = md5($v);
         if (!isset($tmpvhash[$key]) || $tmpvhash[$key] != $vhash) {
             $dcache[] = array($key, $expire, $vhash, $v);
         } else {
             $kcache[] = $key;
         }
     }
     if ($dcache) {
         $this->cache->update("REPLACE INTO " . $this->table . " (skey,expire,vhash,value) VALUES " . S::sqlMulti($dcache, false));
     }
     if ($kcache) {
         $this->cache->update("UPDATE " . $this->table . " SET expire=" . S::sqlEscape($expire, false) . "WHERE skey IN (" . S::sqlImplode($kcache, false) . ")");
     }
     $this->_expire();
 }
 function updates($array)
 {
     foreach ($array as $key => $value) {
         $array[$key]['data'] = $this->_serialize($value['data']);
     }
     $this->_db->update("REPLACE INTO " . $this->_tableName . " (sign,data,cachetime) VALUES " . S::sqlMulti($array, false));
 }
Example #9
0
 function insert($fieldsData)
 {
     if (!S::isArray($fieldsData)) {
         return false;
     }
     $this->_db->update("INSERT INTO " . $this->_tableName . " (uid,name,type,size,attachurl,uploadtime,descrip,ifthumb) VALUES  " . S::sqlMulti($fieldsData));
     return true;
 }
Example #10
0
 /**
  * 批量添加
  * 
  * @param array $fieldsData
  * @return boolean
  */
 function addAreas($fieldsData)
 {
     if (!S::isArray($fieldsData)) {
         return false;
     }
     $this->_db->update("INSERT INTO " . $this->_tableName . " (name,joinname,parentid,vieworder) VALUES  " . S::sqlMulti($fieldsData));
     return true;
 }
 /**
  * 保存用户模块缓存数据
  * @param $uid int 用户id
  * @param $modes array 获取模块数据及数量 array('article' => 1, 'write' => 2, ...)
  */
 function saveModesData($uid, $data, $conf)
 {
     $array = array();
     foreach ($data as $key => $value) {
         $array[] = array('uid' => $uid, 'type' => $key, 'expire' => S::isArray($conf[$key]) && isset($conf[$key]['expire']) ? $this->now + S::int($conf[$key]['expire']) : $this->now + 608400, 'num' => S::isArray($conf[$key]) ? S::int($conf[$key]['num']) : $conf[$key], 'value' => $this->_serialize($value));
     }
     if ($array) {
         $this->_db->update("REPLACE INTO " . $this->_tableName . " (uid,type,expire,num,value) VALUES " . S::sqlMulti($array, false));
     }
 }
Example #12
0
 function _logDelta($tableName, $ids, $state)
 {
     if (!S::isArray($ids)) {
         return false;
     }
     $_tmp = array();
     foreach ($ids as $id) {
         $_tmp[] = array('id' => $id, 'state' => $state);
     }
     $GLOBALS['db']->update("REPLACE INTO " . S::sqlMetadata($tableName) . " (id,state) VALUES " . S::sqlMulti($_tmp));
 }
 function add($uid, $blackList)
 {
     if (!$uid || !$blackList || !is_array($blackList)) {
         return false;
     }
     $array = array();
     foreach ($blackList as $val) {
         $array[] = array($uid, $val);
     }
     $this->_db->update("INSERT INTO " . $this->_tableName . ' (uid, touid) VALUES ' . S::sqlMulti($array));
 }
 function adds($tid, $pid, $uids)
 {
     $tid = intval($tid);
     $pid = intval($pid);
     if (!$tid || !S::isArray($uids)) {
         return false;
     }
     $data = array();
     foreach ($uids as $v) {
         $data[] = array('tid' => $tid, 'pid' => $pid, 'uid' => intval($v));
     }
     $data && $this->_db->update("REPLACE INTO {$this->_tableName} (tid,pid,uid) VALUES " . S::sqlMulti($data));
 }
 /**
  * 批量增加套餐信息
  * @param array $fieldData
  * @return bool
  */
 function addSpreads($fieldData)
 {
     if (!S::isArray($fieldData)) {
         return false;
     }
     $data = array();
     foreach ($fieldData as $value) {
         $value = $this->_checkAllowField($value, $this->_allowFields);
         if (!S::isArray($value)) {
             continue;
         }
         $data[] = $value;
     }
     if (!S::isArray($data)) {
         return false;
     }
     return $this->_db->query(pwQuery::buildClause('INSERT INTO :table VALUES :data', array($this->_tableName, S::sqlMulti($data))));
 }
 function inserts($fieldDatas)
 {
     $this->_db->update("INSERT INTO " . $this->_tableName . " (uid,blacklist,blackcolony,categories,statistics,shieldinfo,sms_num,notice_num,request_num,groupsms_num) VALUES  " . S::sqlMulti($fieldDatas, FALSE));
     return $this->_db->insert_id();
 }
Example #17
0
 function addReplyRelations($fieldDatas)
 {
     $this->_db->update("INSERT INTO " . $this->_tableName . " (uid,mid,categoryid,typeid,status,isown,relation,created_time,modified_time) VALUES  " . S::sqlMulti($fieldDatas, FALSE));
     return $this->_db->insert_id();
 }
Example #18
0
 function writeLog()
 {
     if (!empty($this->cLog)) {
         $GLOBALS['db']->update("INSERT INTO pw_creditlog (uid,username,ctype,affect,adddate,logtype,ip,descrip) VALUES " . S::sqlMulti($this->cLog, false));
     }
     $this->cLog = array();
 }
 function addCnRelations($fieldDatas)
 {
     $this->_db->update("INSERT INTO " . $this->_tableName . " (cyid,mid) VALUES  " . S::sqlMulti($fieldDatas, FALSE));
     return $this->_db->insert_id();
 }
Example #20
0
 }
 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));
 }
 foreach ((array) $new_view['keyword'] as $key => $value) {
     if (!$value) {
         continue;
     }
     if (($GLOBALS['banword'] = $filterService->comprise($value)) !== false) {
         Showmsg('content_wordsfb');
     }
     $tempKeywords[] = array('keyword' => $value, 'vieworder' => intval($new_view['vieworder'][$key]), 'fromtype' => 'custom', 'posttime' => $timestamp);
 }
 if ($tempKeywords) {
     $db->update("INSERT INTO pw_searchhotwords(keyword,vieworder,fromtype,posttime) VALUES " . S::sqlMulti($tempKeywords));
 }
 $hotwordsconfig['shownum'] = abs(intval($hotwordsconfig['shownum']));
 $hotwordsconfig['invokeperiod'] = abs(intval($hotwordsconfig['invokeperiod']));
 $autoInvoke = array('isOpne' => $hotwordsconfig['openautoinvoke'], 'period' => $hotwordsconfig['invokeperiod']);
 L::loadClass('hotwordssearcher', 'search/userdefine');
 $hotwordsServer = new PW_HotwordsSearcher();
 $hotwordsServer->update($autoInvoke, $hotwordsconfig['shownum']);
 if (!$hotwordsconfig['shownum']) {
     setConfig('db_hotwords', '');
 }
 if (!$hotwordsconfig['invokeperiod']) {
     pwQuery::delete('pw_searchhotwords', 'fromtype=:id', array('auto'));
 }
 $config['hotwordsconfig'] = $hotwordsconfig ? serialize($hotwordsconfig) : '';
 setConfig('db_opensch', $config['opensch']);
Example #21
0
 function insert($tid)
 {
     $sql = $upids = $tagids = array();
     foreach ($this->tags as $key => $value) {
         if (!$value) {
             continue;
         }
         $rt = $this->db->get_one("SELECT tagid FROM pw_tags WHERE tagname=" . S::sqlEscape($value));
         if (!$rt) {
             $this->db->update("INSERT INTO pw_tags SET " . S::sqlSingle(array('tagname' => $value, 'num' => 1)));
             $tagid = $this->db->insert_id();
         } else {
             $tagid = $rt['tagid'];
             $upids[] = $tagid;
         }
         $sql[] = array($tagid, $tid);
         $tagids[] = $tagid;
     }
     if ($upids) {
         $this->db->update("UPDATE pw_tags SET num=num+1 WHERE tagid IN(" . S::sqlImplode($upids) . ')');
     }
     if ($sql) {
         $this->db->update("INSERT INTO pw_tagdata (tagid,tid) VALUES " . S::sqlMulti($sql));
     }
     if ($tagids) {
         $statistics = L::loadClass('Statistics', 'datanalyse');
         $statistics->addtag($tagids);
     }
 }
Example #22
0
            }
        }
        $names = array();
        $query = $db->query("SELECT * FROM pw_cnskin");
        while ($rt = $db->fetch_array($query)) {
            $names[$rt['dir']] = $rt['name'];
        }
        require_once PrintApp('admin');
    } else {
        S::gp(array('name', 'style_name'));
        $db->update("DELETE FROM pw_cnskin");
        $pwSQL = array();
        foreach ($name as $key => $value) {
            $pwSQL[] = array($value, $style_name[$key]);
        }
        $db->update("REPLACE INTO pw_cnskin (dir, name) VALUES " . S::sqlMulti($pwSQL));
        adminmsg('operate_success', "{$basename}&action=colonystyle");
    }
}
function Delcnimg($filename)
{
    return pwDelatt("cn_img/{$filename}", $GLOBALS['db_ifftp']);
}
function updatecache_cnc()
{
    global $db;
    $classdb = array();
    $query = $db->query('SELECT fid,cname FROM pw_cnclass WHERE ifopen=1');
    while ($rt = $db->fetch_array($query)) {
        $classdb[$rt['fid']] = $rt['cname'];
    }
Example #23
0
function updateFansSort()
{
    global $db;
    L::loadClass('getinfo', '', false);
    $getinfo =& GetInfo::getInstance();
    $userId = $userIds = array();
    $db->update("DELETE FROM pw_elements WHERE type='totalfans' ");
    $userIds = $getinfo->getTotalFansSort(100);
    if (!S::isArray($userIds)) {
        return false;
    }
    foreach ($userIds as $key => $value) {
        $userId[$key]['id'] = $value['uid'];
        $userId[$key]['value'] = $value['fans'];
        $userId[$key]['type'] = "totalfans";
        $userId[$key]['mark'] = "fans";
    }
    if ($userId) {
        $sql = "REPLACE INTO pw_elements(id,value,type,mark) VALUES " . S::sqlMulti($userId, true);
        $db->update($sql);
    }
    return true;
}
Example #24
0
 function delReply($replydb, $recycle = false, $delCredit = true, $recount = false, $extra = array())
 {
     global $credit, $windid, $timestamp, $onlineip, $db_creditset;
     !$credit && (require_once R_P . 'require/credit.php');
     $tids = $pids = $_tids = $_pids = $ptable_a = $recycledb = $delfids = $deltids = $deluids = $attachdb = $deltpc = array();
     foreach ($replydb as $key => $reply) {
         $tids[$reply['tid']] = 1;
         if ($reply['pid'] == 'tpc') {
             $reply['pid'] = 0;
         }
         if ($recycle) {
             $recycledb[] = array('pid' => $reply['pid'], 'tid' => $reply['tid'], 'fid' => $reply['fid'], 'deltime' => $timestamp, 'admin' => $windid);
         }
         if ($reply['pid'] > 0) {
             /*回复*/
             $isInRecycle = $reply['fid'] == 0 && $reply['tid'] == 0;
             if ($reply['aid']) {
                 $_tids[$reply['tid']] = $reply['tid'];
                 $_pids[$reply['pid']] = $reply['pid'];
             }
             if (!$isInRecycle) {
                 $deluids[$reply['authorid']]++;
                 if ($reply['ifcheck']) {
                     $delfids[$reply['fid']]['replies']++;
                     $deltids[$reply['tid']]++;
                 }
             }
             $ptable_a[$reply['ptable']] = 1;
             $pids[] = $reply['pid'];
             $creditType = 'Deleterp';
             $logType = 'delrp_descrip';
         } else {
             /* 主题 */
             $isInRecycle = $reply['fid'] == 0 && $reply['ifcheck'] == 1;
             !$isInRecycle && $deluids[$reply['authorid']]++;
             $deltpc[] = $reply['tid'];
             $creditType = 'Delete';
             $logType = 'del_descrip';
         }
         $msg_delrvrc = $msg_delmoney = 0;
         if ($delCredit && !$isInRecycle) {
             $creditset = $this->getcreditset($reply['fid']);
             $credit->addLog("topic_{$creditType}", $creditset[$creditType], array('uid' => $reply['authorid'], 'username' => $reply['author'], 'ip' => $onlineip, 'fname' => strip_tags($this->getForumInfo($reply['fid'], 'name')), 'operator' => $windid));
             $credit->sets($reply['authorid'], $creditset[$creditType], false);
             $msg_delrvrc = abs($creditset[$creditType]['rvrc']);
             $msg_delmoney = abs($creditset[$creditType]['money']);
         }
         /*操作日志 */
         $logdb[] = array('type' => 'delete', 'username1' => $reply['author'], 'username2' => $windid, 'field1' => $reply['fid'], 'field2' => '', 'field3' => '', 'descrip' => $logType, 'timestamp' => $timestamp, 'ip' => $onlineip, 'tid' => $reply['tid'], 'subject' => substrs($reply['subject'] ? $reply['subject'] : $reply['content'], 28), 'affect' => "{$GLOBALS[db_rvrcname]}:-{$msg_delrvrc},{$GLOBALS[db_moneyname]}:-{$msg_delmoney}", 'reason' => $extra['reason']);
     }
     if (!$tids) {
         return true;
     }
     require_once R_P . 'require/updateforum.php';
     $delpids = S::sqlImplode($pids);
     if ($recycle) {
         foreach ($ptable_a as $key => $val) {
             $pw_posts = GetPtable($key);
             //$this->db->update("UPDATE $pw_posts SET tid='0',fid='0' WHERE pid IN($delpids)");
             pwQuery::update($pw_posts, 'pid IN(:pid)', array($pids), array('tid' => '0', 'fid' => '0'));
         }
         if ($recycledb) {
             $this->db->update("REPLACE INTO pw_recycle (pid,tid,fid,deltime,admin) VALUES " . S::sqlMulti($recycledb));
         }
     } else {
         foreach ($ptable_a as $key => $val) {
             $pw_posts = GetPtable($key);
             //$this->db->update("DELETE FROM $pw_posts WHERE pid IN($delpids)");
             pwQuery::delete($pw_posts, 'pid IN(:pid)', array($pids));
         }
     }
     if ($delpids) {
         $this->resetReplayToppedFloor($replydb, '', '', $extra['tpcstatus']);
     }
     /*前台删主题,默认将其设为屏蔽*/
     if ($deltpc) {
         //$this->db->update("UPDATE pw_threads SET ifshield='2' WHERE tid IN (" . S::sqlImplode($deltpc) . ')');
         pwQuery::update('pw_threads', 'tid IN (:tid)', array($deltpc), array('ifshield' => 2));
         $pw_attachs = L::loadDB('attachs', 'forum');
         $attachdb += $pw_attachs->getByTid($deltpc, 0);
         !$recycle && delete_tag(S::sqlImplode($deltpc));
         /* 删除微博 */
         $weiboService = L::loadClass('weibo', 'sns');
         /* @var $weiboService PW_Weibo */
         $weibos = $weiboService->getWeibosByObjectIdsAndType($deltpc, 'article');
         if ($weibos) {
             $mids = array();
             foreach ($weibos as $key => $weibo) {
                 $mids[] = $weibo['mid'];
             }
             $weiboService->deleteWeibos($mids);
         }
     }
     if ($_tids) {
         $pw_attachs = L::loadDB('attachs', 'forum');
         $attachdb += $pw_attachs->getByTid($_tids, $_pids);
     }
     if ($attachdb) {
         delete_att($attachdb, !$recycle);
         require_once R_P . 'require/functions.php';
         pwFtpClose($GLOBALS['ftp']);
     }
     $userService = L::loadClass('UserService', 'user');
     /* @var $userService PW_UserService */
     foreach ($deluids as $uid => $value) {
         $userService->updateByIncrement($uid, array(), array('postnum' => -$value));
     }
     if ($deltopic = $this->delReplyTopic(array_keys($tids), $deltpc, $recount, $recycle)) {
         foreach ($deltopic as $fid => $value) {
             $delfids[$fid]['topic'] = $value;
         }
     }
     if ($delfids) {
         //* $threadlist = L::loadClass("threadlist", 'forum');
         foreach ($delfids as $fid => $value) {
             //* $threadlist->refreshThreadIdsByForumId($fid);
             Perf::gatherInfo('changeThreadWithForumIds', array('fid' => $fid));
             updateForumCount($fid, -$value['topic'], -$value['replies']);
         }
     }
     if ($deltids && !$recount) {
         foreach ($deltids as $tid => $value) {
             //$this->db->update("UPDATE pw_threads SET replies=replies-" . S::sqlEscape($value) . " WHERE tid=" . S::sqlEscape($tid));
             $this->db->update(pwQuery::buildClause("UPDATE :pw_table SET replies=replies-:replies WHERE tid=:tid", array('pw_threads', $value, $tid)));
         }
     }
     /*写操作日志 */
     require_once R_P . 'require/writelog.php';
     foreach ($logdb as $log) {
         writelog($log);
     }
     /*扣除积分*/
     $credit->runsql();
     return !empty($deltopic);
 }
Example #25
0
                while ($rt = $db->fetch_array($query)) {
                    $sel[] = array('uid' => $rt['uid'], 'fid' => $rt['fid'], 'gid' => $rt['gid']);
                }
            }
        }
        require GetLang('right');
        is_array($othergroup) || ($othergroup = array());
        foreach ($othergroup as $value) {
            if (isset($lang['right']['systemforum'][$value])) {
                foreach ($sel as $k => $v) {
                    $pwSQL[] = array($v['uid'], $v['fid'], $v['gid'], $value, 'systemforum', $group[$value]);
                }
            }
        }
        if ($pwSQL) {
            $db->update("REPLACE INTO pw_permission (uid,fid,gid,rkey,type,rvalue) VALUES " . S::sqlMulti($pwSQL));
        }
        adminmsg('operate_success', $jumpurl);
    }
} elseif ($action == 'delright') {
    $jumpurl = $job == 'user' ? "{$basename}&action=user" : "{$basename}&action=group";
    S::gp(array('selid', 'all'));
    if (empty($all)) {
        $pwSQL = array();
        empty($selid) && adminmsg('operate_error', $jumpurl);
        settype($selid, 'array');
        foreach ($selid as $key => $value) {
            list($uid, $fid, $gid) = explode('_', $value);
            $uid = (int) $uid;
            $fid = (int) $fid;
            $gid = (int) $gid;
Example #26
0
                pwQuery::update('pw_forums', 'fid=:fid', array($fm['fid']), array('forumadmin' => $newadmin));
                $updatecache_fd = 1;
            }
        }
    }
    $newgroups == ',' && ($newgroups = '');
    if (in_array($newgid, array('-1', '6', '7')) && $newgroups == '') {
        $db->update("DELETE FROM pw_administrators WHERE uid=" . S::sqlEscape($rt['uid'], false));
    } else {
        $sqladd[] = array($rt['uid'], $rt['username'], $newgid, $newgroups);
    }
    $userService->update($rt['uid'], array('groupid' => $newgid, 'groups' => $newgroups));
    $db->update("DELETE FROM pw_extragroups WHERE uid=" . S::sqlEscape($rt['uid'], false) . "AND gid=" . S::sqlEscape($rt['gid'], false));
}
if ($sqladd) {
    $db->update("REPLACE INTO pw_administrators (uid,username,groupid,groups) VALUES " . S::sqlMulti($sqladd, false));
}
if ($updatecache_fd) {
    $havechild = array();
    $db->update("UPDATE pw_forums SET childid='0',fupadmin=''");
    $query = $db->query("SELECT fid,forumadmin FROM pw_forums WHERE type='category' ORDER BY vieworder");
    while ($cate = $db->fetch_array($query)) {
        $query2 = $db->query("SELECT fid,forumadmin FROM pw_forums WHERE type='forum' AND fup=" . S::sqlEscape($cate['fid'], false));
        if ($db->num_rows($query2)) {
            $havechild[] = $cate['fid'];
            while ($forum = $db->fetch_array($query2)) {
                $fupadmin = trim($cate['forumadmin']);
                if ($fupadmin) {
                    //$db->update("UPDATE pw_forums SET fupadmin=".S::sqlEscape($fupadmin,false)."WHERE fid=".S::sqlEscape($forum['fid'],false));
                    pwQuery::update('pw_forums', 'fid=:fid', array($forum['fid']), array('fupadmin' => $fupadmin));
                }
Example #27
0
             for ($i = 0; $i < 5; $i++) {
                 if ($step < $total) {
                     $fourmid = $arr_forumkeys[$step];
                     !$forum[$fourmid] && adminmsg('undefined_action');
                     $step++;
                     if ($forum[$fourmid]['type'] == 'category') {
                         continue;
                     } else {
                         $arr_posts = array();
                         $arr_posts = $getinfo->hotfavor($fourmid, $db_sortnum);
                         $arr_posts = arr_unique($arr_posts);
                         foreach ($arr_posts as $key => $value) {
                             $arr_posts[$key]['type'] = 'hotfavor';
                         }
                         if ($arr_posts) {
                             $sql = "REPLACE INTO pw_elements(id,mark,value,type) VALUES" . S::sqlMulti($arr_posts, false);
                             $db->update($sql);
                         }
                     }
                 } else {
                     break;
                 }
             }
             if ($step < $total) {
                 adminmsg('updatecache_total_step', "{$basename}&action=update&type=hotfavor&step={$step}");
             }
         }
         adminmsg('operate_success');
     }
 } else {
     adminmsg('undefined_action');
Example #28
0
 /** 
  *  添加二级分类
  * 
  *  @param  $newSubStyle   array 新添加的二级分类的数组
  *  @return null
  */
 function addNewSubStyle($newSubStyle)
 {
     $this->db->update("INSERT INTO pw_cnstyles(cname,ifopen,upid,vieworder) VALUES " . S::sqlMulti($newSubStyle));
 }
Example #29
0
function addLog($creditlog, $username, $uid, $logtype)
{
    global $db, $creditset, $credit, $timestamp, $db_ifcredit, $onlineip;
    $credit_pop = '';
    $cLog = array();
    empty($creditset) && ($creditset = array());
    foreach ($creditset as $key => $affect) {
        if (isset($credit->cType[$key]) && $affect != 0 && isset($creditlog[$key])) {
            $log['username'] = S::escapeChar($username);
            $log['cname'] = $credit->cType[$key];
            $log['affect'] = $affect;
            $log['affect'] > 0 && ($log['affect'] = '+' . $log['affect']);
            $log['descrip'] = S::escapeChar(getLangInfo('creditlog', $logtype, $log));
            $credit_pop .= $key . ":" . $log['affect'] . '|';
            $cLog[] = array($uid, $log['username'], $key, $affect, $timestamp, $logtype, $onlineip, $log['descrip']);
        }
    }
    if ($db_ifcredit && $credit_pop) {
        //Credit Changes Tips
        $credit_pop = $logtype . '|' . $credit_pop;
        $userService = L::loadClass('UserService', 'user');
        /* @var $userService PW_UserService */
        $userService->update($uid, array(), array('creditpop' => $credit_pop));
    }
    if (!empty($cLog)) {
        $db->update("INSERT INTO pw_creditlog (uid,username,ctype,affect,adddate,logtype,ip,descrip) VALUES " . S::sqlMulti($cLog, false));
    }
    $cLog = array();
}
Example #30
0
 }
 if ($typedb) {
     $db->update("REPLACE INTO pw_topictype (fid,name,logo,vieworder,ifsys) VALUES " . S::sqlMulti($typedb));
 }
 //增加二级新分类
 foreach ($new_t_sub_db as $key => $value) {
     foreach ($value as $k => $v) {
         if (empty($v)) {
             continue;
         }
         $v = str_replace(array('&#46;&#46;', '&#41;', '&#60;', '&#61;'), array('..', ')', '<', '='), $v);
         $subtypedb[] = array('fid' => $fid, 'name' => $v, 'logo' => $new_t_sub_logo_db[$key][$k], 'vieworder' => $new_t_sub_view_db[$key][$k], 'upid' => $key, 'ifsys' => isset($new_t_sub_sys_db[$key][$k]) ? $new_t_sub_sys_db[$key][$k] : 0);
     }
 }
 if ($subtypedb) {
     $db->update("REPLACE INTO pw_topictype (fid,name,logo,vieworder,upid,ifsys) VALUES " . S::sqlMulti($subtypedb));
 }
 require_once R_P . 'admin/cache.php';
 if ($addtpctype != $forumset['addtpctype']) {
     $forumset['addtpctype'] = $addtpctype;
     $forumset = serialize($forumset);
     if ($foruminfo['fid']) {
         $db->update('UPDATE pw_forumsextra SET forumset=' . S::sqlEscape($forumset) . ' WHERE fid=' . S::sqlEscape($fid));
     } else {
         $db->update('INSERT INTO pw_forumsextra SET ' . S::sqlSingle(array('fid' => $fid, 'forumset' => $forumset)));
     }
     updatecache_forums($fid);
 }
 $foruminfo = L::forum($fid);
 if ($t_type != $foruminfo['t_type']) {
     //$db->update("UPDATE pw_forums SET " . S::sqlSingle(array('t_type'=> $t_type)) . "WHERE fid=".S::sqlEscape($fid));