示例#1
0
 function execute(&$postdata)
 {
     global $timestamp, $db_ptable, $onlineip;
     $this->setPostData($postdata);
     $pwSQL = pwSqlSingle(array('fid' => $this->data['fid'], 'icon' => $this->data['icon'], 'author' => $this->data['author'], 'authorid' => $this->data['authorid'], 'subject' => $this->data['title'], 'ifcheck' => $this->data['ifcheck'], 'type' => $this->data['w_type'], 'postdate' => $timestamp, 'lastpost' => $timestamp, 'lastposter' => $this->data['lastposter'], 'hits' => 1, 'replies' => 0, 'topped' => $this->data['topped'], 'digest' => $this->data['digest'], 'special ' => $this->data['special'], 'state' => 0, 'ifupload' => $this->data['ifupload'], 'ifmail' => $this->data['ifmail'], 'anonymous' => $this->data['anonymous'], 'ptable' => $db_ptable, 'ifmagic' => $this->data['ifmagic'], 'ifhide' => $this->data['hideatt'], 'tpcstatus' => $this->data['tpcstatus'], 'modelid' => $this->data['modelid']));
     $this->db->update("INSERT INTO pw_threads SET {$pwSQL}");
     $this->tid = $this->db->insert_id();
     # memcache refresh
     $threadList = L::loadClass("threadlist");
     $threadList->updateThreadIdsByForumId($this->data['fid'], $this->tid);
     $pw_tmsgs = GetTtable($this->tid);
     if (is_object($postdata->tag)) {
         $postdata->tag->insert($this->tid);
         $this->data['tags'] .= "\t" . $postdata->tag->relate($this->data['title'], $this->data['content']);
     }
     if (is_object($this->att) && ($aids = $this->att->getAids())) {
         $this->att->pw_attachs->updateById($aids, array('tid' => $this->tid));
     }
     $ipTable = L::loadClass('IPTable');
     $pwSQL = pwSqlSingle(array('tid' => $this->tid, 'aid' => $this->data['aid'], 'userip' => $onlineip, 'ifsign' => $this->data['ifsign'], 'buy' => '', 'ipfrom' => $ipTable->getIpFrom($onlineip), 'tags' => $this->data['tags'], 'ifconvert' => $this->data['convert'], 'ifwordsfb' => $this->data['ifwordsfb'], 'content' => $this->data['content'], 'magic' => $this->data['magic']));
     $this->db->update("INSERT INTO {$pw_tmsgs} SET {$pwSQL}");
     if ($this->data['digest']) {
         $this->db->update("UPDATE pw_memberdata SET digests=digests+1 WHERE uid=" . pwEscape($this->data['authorid']));
         $this->post->user['digests']++;
     }
     $this->post->updateUserInfo($this->type, $this->creditSet(), $this->data['content']);
     $this->afterpost();
 }
示例#2
0
function getDescripByTid($tid)
{
    global $db;
    $tid = (int) $tid;
    if (!$tid) {
        return '';
    }
    $table = GetTtable($tid);
    $content = $db->get_value("SELECT content FROM {$table} WHERE tid=" . S::sqlEscape($tid));
    $content = preg_replace("/<((style|script).*?)>(.*?)<(\\/\\1.*?)>/si", "", $content);
    $content = strip_tags(stripWindCode($content));
    $content = trim($content);
    return substrs($content, 200);
}
示例#3
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;
}
 function getThreadDataWithTmsgs($query)
 {
     $threads = $tmsgsTables = array();
     while ($rt = $GLOBALS['db']->fetch_array($query)) {
         $threads[$rt['tid']] = $rt;
         $tmsgsTableName = GetTtable($rt['tid']);
         $tmsgsTables[$tmsgsTableName][] = $rt['tid'];
     }
     if (!S::isArray($threads)) {
         return array();
     }
     foreach ($tmsgsTables as $tableName => $tids) {
         $tmsgsQuery = $GLOBALS['db']->query("SELECT * FROM " . S::sqlMetaData($tableName) . " WHERE tid IN(" . S::sqlImplode($tids) . ")");
         while ($rt = $GLOBALS['db']->fetch_array($tmsgsQuery)) {
             $rt['threadurl'] = $GLOBALS['db_bbsurl'] . '/read.php?tid=' . $rt['tid'];
             $rt['forumurl'] = $GLOBALS['db_bbsurl'] . '/thread.php?fid=' . $threads[$rt['tid']]['fid'];
             $threads[$rt['tid']] = array_merge($threads[$rt['tid']], $rt);
         }
     }
     return $threads;
 }
 function getsBythreadIds($threadIds)
 {
     $threadIds = is_array($threadIds) ? $threadIds : explode(",", $threadIds);
     foreach ($threadIds as $threadId) {
         $table = GetTtable($threadId);
         $tables[$table][] = $threadId;
     }
     $threads = array();
     foreach ($tables as $table => $tids) {
         $t = $this->_getsBythreadIds($tids, $table);
         $threads = $threads + $t;
     }
     $tmp = array();
     foreach ($threads as $t) {
         $tmp[$t['tid']] = $t;
     }
     $result = array();
     foreach ($threadIds as $threadId) {
         isset($tmp[$threadId]) ? $result[] = $tmp[$threadId] : '';
     }
     return $result;
 }
示例#6
0
function update_markinfo($fid, $tid, $pid)
{
    global $db;
    $perpage = 10;
    $pid = intval($pid);
    $whereStr = " fid=" . pwEscape($fid) . " AND tid=" . pwEscape($tid) . " AND pid=" . pwEscape($pid) . " AND ifhide=0 ";
    $count = $db->get_value("SELECT COUNT(*) FROM pw_pinglog WHERE {$whereStr} ");
    $markInfo = "";
    if ($count) {
        $query = $db->query("SELECT id FROM pw_pinglog WHERE {$whereStr} ORDER BY pingdate DESC LIMIT 0,{$perpage}");
        $ids = array();
        while ($rt = $db->fetch_array($query)) {
            $ids[] = $rt['id'];
        }
        $markInfo = $count . ":" . implode(",", $ids);
    }
    if ($pid == 0) {
        $pw_tmsgs = GetTtable($tid);
        $db->update("UPDATE {$pw_tmsgs} SET ifmark=" . pwEscape($markInfo) . " WHERE tid=" . pwEscape($tid));
    } else {
        $db->update("UPDATE " . GetPtable("N", $tid) . " SET ifmark=" . pwEscape($markInfo) . " WHERE pid=" . pwEscape($pid));
    }
    return $markInfo;
}
示例#7
0
 function getColonyThread($tid)
 {
     $pw_tmsgs = GetTtable($tid);
     $rt = $this->_db->get_one("SELECT a.cyid,t.tid,t.subject,t.fid,t.ptable,tm.content,c.cname FROM pw_argument a left join pw_threads t ON a.tid=t.tid LEFT JOIN {$pw_tmsgs} tm ON t.tid=tm.tid LEFT JOIN pw_colonys c ON a.cyid=c.id WHERE a.tid=" . pwEscape($tid));
     return $rt ? array('content' => substrs(stripWindCode($rt['content']), 125), 'type' => 40, 'objectid' => $rt['tid'], 'extra' => array('title' => $rt['subject'], 'cyid' => $rt['cyid'], 'cname' => $rt['cname'])) : array();
 }
示例#8
0
 function overprintThread($tid, $related)
 {
     $pw_tmsgs = GetTtable($tid);
     //* return $this->_db->update("UPDATE $pw_tmsgs SET overprint=" . S::sqlEscape($related) . " WHERE tid=" . S::sqlEscape($tid) . " LIMIT 1");
     return pwQuery::update($pw_tmsgs, 'tid=:tid', array($tid), array('overprint' => $related));
 }
示例#9
0
 function _getThread($tid, $isDetailed = false)
 {
     if ($isDetailed) {
         $pw_tmsgs = GetTtable($tid);
         return $GLOBALS['db']->get_one("SELECT t.*,m.uid,m.icon,m.groupid,m.userstatus,tm.* FROM pw_threads t LEFT JOIN pw_members m ON t.authorid=m.uid LEFT JOIN {$pw_tmsgs} tm ON t.tid=tm.tid WHERE t.tid=" . S::sqlEscape($tid) . " AND t.ifcheck = 1 AND t.fid != 0");
     } else {
         return $GLOBALS['db']->get_one("SELECT * FROM pw_threads WHERE tid=" . S::sqlEscape($tid) . " AND ifcheck = 1 AND fid != 0");
     }
 }
示例#10
0
if (empty($action)) {
    include PrintEot('attachrenew');
    exit;
} elseif ('delete' == $action) {
    S::gp(array('step'));
    $step = $step ? (int) $step : 0;
    $prenum = 10000;
    $attachDB = L::loadDB('attachs', 'forum');
    $attachs = $attachDB->groupByTidAndPid($step, $prenum);
    $tTables = $pTables = array();
    foreach ($attachs as $key => $value) {
        if ($value['pid']) {
            $pTable = GetPtable('N', $value['tid']);
            $pTables[$pTable][] = $value['pid'];
        } else {
            $tTable = GetTtable($value['tid']);
            $tTables[$tTable][] = $value['tid'];
        }
    }
    foreach ($tTables as $table => $value) {
        $db->update("UPDATE {$table} SET aid=1 WHERE tid IN (" . S::sqlImplode($value) . ")");
    }
    foreach ($pTables as $table => $value) {
        $db->update("UPDATE {$table} SET aid=1 WHERE pid IN (" . S::sqlImplode($value) . ")");
    }
    $maxAid = $attachDB->getTableStructs('Auto_increment');
    if ($maxAid > ($step + 1) * $prenum) {
        $step++;
        adminmsg('attach_renew_wait', EncodeUrl("{$basename}&action={$action}&step={$step}"), 1);
    } else {
        adminmsg('attach_renew');
示例#11
0
function delforum($fid)
{
    global $db, $db_guestdir, $db_guestthread, $db_guestread;
    $foruminfo = $db->get_one("SELECT fid,fup,forumadmin FROM pw_forums WHERE fid=" . S::sqlEscape($fid));
    //$db->update("DELETE FROM pw_forums WHERE fid=".S::sqlEscape($fid));
    pwQuery::delete('pw_forums', 'fid=:fid', array($fid));
    //* $db->update("DELETE FROM pw_forumdata WHERE fid=".S::sqlEscape($fid));
    pwQuery::delete('pw_forumdata', 'fid=:fid', array($fid));
    $db->update("DELETE FROM pw_forumsextra WHERE fid=" . S::sqlEscape($fid));
    $db->update("DELETE FROM pw_permission WHERE fid>'0' AND fid=" . S::sqlEscape($fid));
    if ($foruminfo['forumadmin']) {
        $userService = L::loadClass('UserService', 'user');
        /* @var $userService PW_UserService */
        $forumadmin = explode(",", $foruminfo['forumadmin']);
        foreach ($forumadmin as $key => $value) {
            if ($value) {
                $gid = $userService->getByUserName($value);
                if ($gid['groupid'] == 5 && !ifadmin($value)) {
                    $userService->update($gid['uid'], array('groupid' => -1));
                    admincheck($gid['uid'], $value, $gid['groupid'], '', 'delete');
                }
            }
        }
    }
    if ($db_guestthread || $db_guestread) {
        require_once R_P . 'require/guestfunc.php';
        $db_guestthread && deldir(D_P . "{$db_guestdir}/T_{$fid}");
    }
    //* P_unlink(D_P."data/forums/fid_{$fid}.php");
    pwCache::deleteData(D_P . "data/forums/fid_{$fid}.php");
    require_once R_P . 'require/functions.php';
    require_once R_P . 'require/updateforum.php';
    $pw_attachs = L::loadDB('attachs', 'forum');
    $ttable_a = $ptable_a = array();
    $query = $db->query("SELECT tid,replies,ptable FROM pw_threads WHERE fid=" . S::sqlEscape($fid));
    while ($tpc = $db->fetch_array($query)) {
        $tid = $tpc['tid'];
        $ttable_a[GetTtable($tid)][] = $tid;
        $ptable_a[$tpc['ptable']] = 1;
        $db_guestread && clearguestcache($tid, $tpc['replies']);
        if ($attachdb = $pw_attachs->getByTid($tid)) {
            delete_att($attachdb);
        }
    }
    pwFtpClose($GLOBALS['ftp']);
    foreach ($ttable_a as $pw_tmsgs => $val) {
        //* $val = S::sqlImplode($val,false);
        //* $db->update("DELETE FROM $pw_tmsgs WHERE tid IN($val)");
        pwQuery::delete($pw_tmsgs, 'tid IN(:tid)', array($val));
    }
    # $db->update("DELETE FROM pw_threads WHERE fid=".S::sqlEscape($fid));
    # ThreadManager
    //* $threadManager = L::loadClass("threadmanager", 'forum');
    //* $threadManager->deleteByForumId($fid);
    $threadService = L::loadclass('threads', 'forum');
    $threadService->deleteByForumId($fid);
    //* Perf::gatherInfo('changeThreadWithForumIds', array('fid'=>$fid));
    foreach ($ptable_a as $key => $val) {
        $pw_posts = GetPtable($key);
        //$db->update("DELETE FROM $pw_posts WHERE fid=".S::sqlEscape($fid));
        pwQuery::delete($pw_posts, 'fid=:fid', array($fid));
    }
    updateforum($foruminfo['fup']);
}
示例#12
0
function recycle($ids)
{
    global $db, $fid;
    $delids = array();
    foreach ($ids as $key => $value) {
        if (is_numeric($value)) {
            $delids[] = $value;
        }
    }
    if ($delids) {
        $delids = pwImplode($delids);
    } else {
        Showmsg('forumcp_recycle_nodata');
    }
    $query = $db->query("SELECT r.*,t.special,t.ifshield,t.ifupload,t.ptable,t.replies,t.fid AS ckfid FROM pw_recycle r LEFT JOIN pw_threads t ON r.tid=t.tid WHERE r.tid IN ({$delids}) AND r.pid='0' AND r.fid=" . pwEscape($fid));
    $taid_a = $ttable_a = $ptable_a = array();
    $delids = $pollids = $actids = $delaids = $rewids = $ids = array();
    while (@extract($db->fetch_array($query))) {
        $ids[] = $tid;
        ($ifshield != '2' || $replies == '0' || $ckfid == '0') && ($delids[] = $tid);
        $special == 1 && ($pollids[] = $tid);
        $special == 2 && ($actids[] = $tid);
        $special == 3 && ($rewids[] = $tid);
        if ($ifshield != '2' || $replies == '0' || $ckfid == '0') {
            $ptable_a[$ptable] = 1;
            $ttable_a[GetTtable($tid)][] = $tid;
        }
        if ($ifupload) {
            $taid_a[GetTtable($tid)][] = $tid;
            if ($ifshield != '2' || $replies == '0' || $ckfid == '0') {
                $pw_posts = GetPtable($ptable);
                $query2 = $db->query("SELECT aid FROM {$pw_posts} WHERE tid=" . pwEscape($tid) . " AND aid!=''");
                while (@extract($db->fetch_array($query2))) {
                    if (!$aid) {
                        continue;
                    }
                    $attachs = unserialize(stripslashes($aid));
                    foreach ($attachs as $key => $value) {
                        is_numeric($key) && ($delaids[] = $key);
                        pwDelatt($value['attachurl'], $GLOBALS['db_ifftp']);
                        $value['ifthumb'] && pwDelatt("thumb/{$value['attachurl']}", $GLOBALS['db_ifftp']);
                    }
                }
            }
        }
    }
    foreach ($taid_a as $pw_tmsgs => $value) {
        $value = pwImplode($value);
        $query = $db->query("SELECT aid FROM {$pw_tmsgs} WHERE tid IN({$value}) AND aid!=''");
        while (@extract($db->fetch_array($query))) {
            if (!$aid) {
                continue;
            }
            $attachs = unserialize(stripslashes($aid));
            foreach ($attachs as $key => $value) {
                is_numeric($key) && ($delaids[] = $key);
                pwDelatt($value['attachurl'], $GLOBALS['db_ifftp']);
                $value['ifthumb'] && pwDelatt("thumb/{$value['attachurl']}", $GLOBALS['db_ifftp']);
            }
        }
    }
    if ($pollids) {
        $pollids = pwImplode($pollids);
        $db->update("DELETE FROM pw_polls WHERE tid IN({$pollids})");
    }
    if ($actids) {
        $actids = pwImplode($actids);
        $db->update("DELETE FROM pw_activity WHERE tid IN({$actids})");
        $db->update("DELETE FROM pw_actmember WHERE actid IN({$actids})");
    }
    if ($rewids) {
        $rewids = pwImplode($rewids);
        $db->update("DELETE FROM pw_reward WHERE tid IN({$rewids})");
    }
    if ($delaids) {
        $pw_attachs = L::loadDB('attachs');
        $pw_attachs->delete($delaids);
    }
    $delids = pwImplode($delids);
    if ($delids) {
        # $db->update("DELETE FROM pw_threads	WHERE tid IN($delids)");
        # ThreadManager
        $threadManager = L::loadClass("threadmanager");
        $threadManager->deleteByThreadIds($fid, $delids);
    }
    foreach ($ttable_a as $pw_tmsgs => $val) {
        $val = pwImplode($val);
        $db->update("DELETE FROM {$pw_tmsgs} WHERE tid IN({$val})");
    }
    foreach ($ptable_a as $key => $val) {
        $pw_posts = GetPtable($key);
        $db->update("DELETE FROM {$pw_posts} WHERE tid IN({$delids})");
    }
    delete_tag($delids);
    if ($ids) {
        $ids = pwImplode($ids);
        $db->update("DELETE FROM pw_recycle WHERE tid IN ({$ids})");
    }
    pwFtpClose($GLOBALS['ftp']);
}
示例#13
0
     $sql = "WHERE r.pid='0' AND (t.fid='0' OR t.ifshield='2')";
 }
 $query = $db->query("SELECT r.*,t.special,t.ifshield,t.ifupload,t.ptable,t.replies,t.fid,t.postdate AS ckfid FROM pw_recycle r LEFT JOIN pw_threads t ON r.tid=t.tid {$sql} LIMIT 100");
 while (@extract($db->fetch_array($query))) {
     $goon = 1;
     $ids[] = $tid;
     ($ifshield != '2' || $replies == '0' || $ckfid == '0') && ($delids[] = $tid);
     $special == 1 && ($pollids[] = $tid);
     $special == 2 && ($actids[] = $tid);
     $special == 3 && ($rewids[] = $tid);
     if ($ifshield != '2' || $replies == '0' || $ckfid == '0') {
         $ptable_a[$ptable] = 1;
         $ttable_a[GetTtable($tid)][] = $tid;
     }
     if ($ifupload) {
         $taid_a[GetTtable($tid)][] = $tid;
         $_tids[$tid] = $tid;
         $_pids[0] = 0;
         if ($ifshield != '2' || $replies == '0' || $ckfid == '0') {
             $pw_posts = GetPtable($ptable);
             $query2 = $db->query("SELECT pid FROM {$pw_posts} WHERE tid=" . S::sqlEscape($tid, false) . " AND aid!=''");
             while ($pid2 = $db->fetch_array($query2)) {
                 $_pids[$pid2['pid']] = $pid2['pid'];
             }
         }
     }
 }
 if ($pollids) {
     $pollids = S::sqlImplode($pollids, false);
     $db->update("DELETE FROM pw_polls WHERE tid IN({$pollids})");
 }
示例#14
0
 /**
  * @desc 扫描主题表
  */
 function scanThreads()
 {
     # 获取主题信息,判断是否重复记录
     $sql = " SELECT t.tid, t.subject, t.ifcheck, t.postdate, t.author, f.id, f.state " . " FROM {$this->table} AS t LEFT JOIN pw_filter AS f ON t.tid = f.tid" . " WHERE t.tid>" . S::sqlEscape($this->table_progress[$this->table]) . " AND t.fid =" . S::sqlEscape($this->fid) . " GROUP BY t.tid ORDER BY t.tid ASC LIMIT " . $this->pagesize;
     $query = $this->db->query($sql);
     $num = 0;
     while ($thread = $this->db->fetch_array($query)) {
         # 获取帖子内容
         $pw_tmsgs = GetTtable($thread['tid']);
         $sql = " SELECT content FROM {$pw_tmsgs} WHERE tid=" . S::sqlEscape($thread['tid']);
         $thread['content'] = $this->db->get_value($sql);
         # 扫描进度
         $this->progress++;
         $this->objid = $thread['tid'];
         # 帖子内容
         $content = $thread['subject'] . $thread['content'];
         # 过滤敏感词
         $result = $this->filter->paraseContent($content, $this->skip, $this->convert);
         # 处理扫描结果
         if (is_array($result)) {
             $word = $this->getWordString($result[1]);
             $score = round($result[0], 2);
             if ($this->dispose && $score > 0 && $thread['ifcheck']) {
                 # 更改审核状态
                 //$sql = "UPDATE pw_threads SET ifcheck=0 WHERE tid = " .S::sqlEscape($thread['tid']);
                 pwQuery::update('pw_threads', 'tid=:tid', array($thread['tid']), array('ifcheck' => 0));
                 $num++;
                 # 更新版块信息
                 $this->updateCache();
                 # 发消息通知
                 $msg = array('subject' => $thread['subject'], 'tid' => $thread['tid'], 'fid' => $this->fid);
                 $this->sendMsg($thread['author'], $msg, 't');
             }
             if (!$thread['id']) {
                 # 如果不重复,扫描到的结果+1
                 $this->result++;
                 $compart = $insertString ? ',' : '';
                 # 处理数据
                 $insertString .= $compart . "( " . S::sqlEscape($thread['tid']) . ", " . S::sqlEscape($word) . ", " . S::sqlEscape($thread['postdate']) . ")";
             } elseif ($thread['state']) {
                 # 如果是已经审核通过的再次被扫到,扫描到的结果+1
                 $this->result++;
                 # 处理数据
                 $value = array('state' => 0, 'filter' => $word, 'created_at' => $thread['postdate']);
                 $value = S::sqlSingle($value);
                 # 更新记录
                 $sql = "UPDATE pw_filter SET {$value} WHERE pid=0 AND tid = " . S::sqlEscape($thread['tid']);
                 $this->db->update($sql);
             }
         }
     }
     # 插入记录
     if ($insertString) {
         $insertSql = "INSERT INTO pw_filter (tid, filter, created_at) VALUES " . $insertString;
         $this->db->update($insertSql);
     }
     if ($this->dispose && $num) {
         $this->updateCache($num);
     }
 }
示例#15
0
     ajax_footer();
 } elseif ($step == 2) {
     S::gp(array('to_id', 'to_threadcate', 'to_subtype', 'tidarray'));
     if ($forum[$to_id]['type'] == 'category') {
         Showmsg('mawhole_error');
     }
     pwCache::getData(D_P . 'data/forums/fid_' . $to_id . '.php');
     if ($foruminfo['t_type'] == 2 && !$to_threadcate) {
         Showmsg('请选择主题分类后发布');
     }
     $mids = $ttable_a = $ptable_a = array();
     if (is_array($tidarray)) {
         foreach ($tidarray as $key => $value) {
             if (is_numeric($value)) {
                 $mids[] = $value;
                 $ttable_a[GetTtable($value)][] = $value;
             }
         }
     }
     !$mids && Showmsg('mawhole_nodata');
     $pw_attachs = L::loadDB('attachs', 'forum');
     $pw_attachs->updateByTid($mids, array('fid' => $to_id));
     //* $threads = L::loadClass('Threads', 'forum');
     //* $threads->delThreads($mids);
     Perf::gatherInfo('changeThreadWithThreadIds', array('tid' => $mids));
     //$mids = S::sqlImplode($mids);
     $updatetop = $todaypost = $topic_all = $replies_all = 0;
     $cy_tids = array();
     $query = $db->query("SELECT tid,fid as tfid,author,postdate,subject,replies,topped,ptable,ifcheck,tpcstatus,modelid,special,specialsort FROM pw_threads WHERE tid IN(" . S::sqlImplode($mids) . ")");
     $mgdate = get_date($timestamp, 'Y-m-d');
     //语言文件中用
示例#16
0
 /**
  * get new attachs
  * $type must in array('img','txt','zip')
  * @param int $type
  * @param int $fid
  * @param int $num
  * @param int $hour
  * @return array
  */
 function newAttach($type, $fid = 0, $num = 0, $hour = 0)
 {
     require_once R_P . 'require/bbscode.php';
     global $timestamp, $db_ftpweb, $attachpath;
     $attachtype = array('img', 'txt', 'zip');
     if (!in_array($type, $attachtype)) {
         return false;
     }
     $num = (int) $num;
     $hour = (int) $hour;
     !$fid && ($fid = getCommonFid());
     !$num && ($num = $this->cachenum);
     $time = $hour ? strlen($hour) == 10 ? $hour : $timestamp - intval($hour) * 3600 : 0;
     $sqladd = '';
     $sqladd .= $time ? ' AND a.uploadtime>' . S::sqlEscape($time) : '';
     $fid && ($sqladd .= " AND a.fid IN ({$fid}) ");
     if ($this->reality == false) {
         $sql = "SELECT a.tid as id,a.aid AS value,a.attachurl AS addition,a.ifthumb as special FROM pw_attachs a LEFT JOIN pw_threads t ON a.tid=t.tid WHERE a.type=" . S::sqlEscape($type, 1) . " AND a.pid=0 AND a.needrvrc=0 AND t.ifcheck='1' {$sqladd} GROUP BY a.tid ORDER BY a.aid DESC " . S::sqlLimit($num);
     } else {
         $sql = "SELECT a.tid,a.attachurl,t.author,t.authorid,t.subject,a.ifthumb FROM pw_attachs a LEFT JOIN pw_threads t ON a.tid=t.tid WHERE a.type=" . S::sqlEscape($type, 1) . " AND a.pid=0 AND a.needrvrc=0 AND t.ifcheck='1' {$sqladd} ORDER BY a.aid DESC " . S::sqlLimit($num);
     }
     $attachs = array();
     $query = $this->db->query($sql);
     while ($attach = $this->db->fetch_array($query)) {
         $tid = $attach['tid'] ? $attach['tid'] : $attach['id'];
         $pw_tmsgs = GetTtable($tid);
         $content = $this->db->get_value("SELECT content FROM {$pw_tmsgs} WHERE tid=" . S::sqlEscape($tid));
         $atc_content = substrs(stripWindCode($content), 30);
         if ($this->reality == true) {
             $tem = array();
             $tem['url'] = 'read.php?tid=' . $attach['tid'];
             $tem['title'] = $attach['subject'];
             $tem['value'] = $atc_content;
             $tem['image'] = $this->_getImageUrl($attach['attachurl'], $attach['ifthumb']);
             $tem['forumname'] = getForumName($attach['fid']);
             $tem['forumurl'] = getForumUrl($attach['fid']);
             $tem['addition'] = $attach;
             $attachs[] = $tem;
         } else {
             if ($attachs[$attach['id']]) {
                 continue;
             }
             $additions = array('0' => $attach['addition'], '1' => $atc_content);
             $addition = addslashes(serialize($additions));
             $attach['addition'] = $addition;
             $attachs[$attach['id']] = $attach;
         }
     }
     return $attachs;
 }
示例#17
0
 function _del()
 {
     $this->delfile($this->attach['attachurl'], $this->attach['ifthumb']);
     $this->attachsDB->delete($this->aid);
     require_once R_P . 'require/updateforum.php';
     $ifupload = getattachtype($this->tid);
     $ifaid = $ifupload === false ? 0 : 1;
     $updateArr = array('aid' => $ifaid);
     if ($this->attach['pid']) {
         $pw_posts = GetPtable('N', $this->tid);
         $content = $this->_db->get_value("SELECT content FROM {$pw_posts} WHERE tid=" . S::sqlEscape($this->tid, false) . "AND pid=" . S::sqlEscape($this->attach['pid'], false));
         if (($content = $this->parseAttContent($content)) !== false) {
             $updateArr['content'] = $content;
             $updateThreadCache = TRUE;
         }
         //$this->_db->update("UPDATE $pw_posts SET " . S::sqlSingle($updateArr) . " WHERE tid=" . S::sqlEscape($this->tid, false) . "AND pid=" . S::sqlEscape($this->attach['pid'], false));
         pwQuery::update($pw_posts, 'tid=:tid AND pid=:pid', array($this->tid, $this->attach['pid']), $updateArr);
     } else {
         $pw_tmsgs = GetTtable($this->tid);
         $content = $this->_db->get_value("SELECT content FROM {$pw_tmsgs} WHERE tid=" . S::sqlEscape($this->tid, false));
         if (($content = $this->parseAttContent($content)) !== false) {
             $updateArr['content'] = $content;
             $updateThreadCache = TRUE;
         }
         //* $this->_db->update("UPDATE $pw_tmsgs SET " . S::sqlSingle($updateArr) . " WHERE tid=" . S::sqlEscape($this->tid, false));
         pwQuery::update($pw_tmsgs, 'tid=:tid', array($this->tid), $updateArr);
     }
     if ($this->attach['type'] == 'img') {
         $tucoolService = L::loadClass('tucool', 'forum');
         $tucoolService->updateTucoolImageNum($this->tid);
         $tucoolInfo = $tucoolService->get($this->tid);
         if ($this->attach['attachurl'] == $tucoolInfo['cover']) {
             $attachService = L::loadClass('attachs', 'forum');
             /* @var $attachService PW_Attachs */
             $coverInfo = $attachService->getLatestAttachInfoByTidType($this->tid);
             $tucoolService->setCover($this->tid, $coverInfo['attachurl'], $coverInfo['ifthumb']);
         }
     }
     if ($updateThreadCache) {
         //* $threadService = L::loadClass("threads", 'forum'); /* @var $threadService PW_Threads */
         //* $threadService->clearTmsgsByThreadId($this->tid);
         Perf::gatherInfo('changeThreadWithThreadIds', array('tid' => $this->tid));
     }
     $ifupload = (int) $ifupload;
     //$this->_db->update('UPDATE pw_threads SET ifupload=' . S::sqlEscape($ifupload) . ' WHERE tid=' . S::sqlEscape($this->tid));
     pwQuery::update('pw_threads', "tid=:tid", array($this->tid), array("ifupload" => $ifupload));
     if ($this->foruminfo['allowhtm'] && $GLOBALS['page'] == 1) {
         $StaticPage = L::loadClass('StaticPage');
         $StaticPage->update($this->tid);
     }
 }
示例#18
0
 function recountTopic($read, $ifdel, $recycle)
 {
     global $db_anonymousname;
     $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}'");
             } else {
                 $threadManager = L::loadClass("threadmanager");
                 $threadManager->deleteByThreadId($read['fid'], $tid);
                 $pw_tmsgs = GetTtable($tid);
                 $this->db->update("DELETE FROM {$pw_tmsgs} WHERE tid='{$tid}'");
             }
             $ret = 1;
         } else {
             $this->db->update("UPDATE pw_threads SET replies='0',lastpost=postdate,lastposter=" . pwEscape($read['author']) . " WHERE tid='{$tid}'");
         }
     } 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 = pwSqlSingle(array('replies' => $replies, 'lastpost' => $pt['postdate'], 'lastposter' => $pt['author']), false);
         $this->db->update("UPDATE pw_threads SET {$pwSQL} WHERE tid='{$tid}'");
     }
     return $ret;
 }
示例#19
0
 function topicModify($tid, $pid, &$post)
 {
     parent::postModify($tid, $pid, $post);
     $this->type = 'topic';
     $this->pw_tmsgs = GetTtable($this->tid);
 }
示例#20
0
<?php

!defined('P_W') && exit('Forbidden');
define('AJAX', '1');
PostCheck();
S::gp(array('pid', 'page', 'type'));
$template = 'ajax_job';
if (empty($windid)) {
    Showmsg('not_login');
}
$tpcs = array();
if ($pid == 'tpc') {
    $table = GetTtable($tid);
    $tpcs = $db->get_one("SELECT t.author,t.authorid,t.subject,tm.userip,tm.content,tm.buy FROM pw_threads t LEFT JOIN {$table} tm ON tm.tid=t.tid WHERE t.tid=" . S::sqlEscape($tid));
    $where = '';
} elseif (is_numeric($pid)) {
    $table = GetPtable('N', $tid);
    $tpcs = $db->get_one("SELECT author,authorid,subject,userip,content,buy FROM {$table} WHERE pid=" . S::sqlEscape($pid) . ' AND tid=' . S::sqlEscape($tid));
    $where = ' AND pid=' . S::sqlEscape($pid);
}
!$tpcs && Showmsg('illegal_tid');
!$tpcs['subject'] && ($tpcs['subject'] = preg_replace('/\\[.*?\\]/i', '', substrs($tpcs['content'], 25)));
$tpcs['content'] = substr($tpcs['content'], strpos($tpcs['content'], '[sell=') + 6);
$cost = substr($tpcs['content'], 0, strpos($tpcs['content'], ']'));
list($creditvalue, $credittype) = explode(',', $cost);
$tpcsBuyDate = $tpcs['buy'] ? unserialize($tpcs['buy']) : array();
require_once R_P . 'require/credit.php';
if ($type == 'record') {
    S::gp(array('buyPage', 'page'));
    if (!$buyPage) {
        $page = 1;
示例#21
0
文件: slide.php 项目: jechiy/PHPWind
L::loadClass('forum', 'forum', false);
require_once R_P . 'require/bbscode.php';
//* include_once pwCache::getPath(D_P.'data/bbscache/cache_read.php',true);
pwCache::getData(D_P . 'data/bbscache/cache_read.php');
S::gp(array('tid'));
if (Perf::checkMemcache()) {
    $_cacheService = Perf::getCacheService();
    $_thread = $_cacheService->get('thread_tid_' . $tid);
    $_thread && ($_tmsg = $_cacheService->get('thread_tmsg_tid_' . $tid));
    $read = $_thread && $_tmsg ? array_merge($_thread, $_tmsg) : false;
    if (!$read) {
        $_cacheService = Perf::gatherCache('pw_threads');
        $read = $page > 1 ? $_cacheService->getThreadByThreadId($tid) : $_cacheService->getThreadAndTmsgByThreadId($tid);
    }
} else {
    $read = $db->get_one("SELECT t.* ,tm.* FROM pw_threads t LEFT JOIN " . S::sqlMetadata(GetTtable($tid)) . " tm ON t.tid=tm.tid WHERE t.tid=" . S::sqlEscape($tid));
}
!$read && Showmsg('illegal_tid');
$postdate = get_date($read['postdate'], 'Y-m-d');
list($fid, $ptable, $ifcheck, $openIndex, $topped_count, $subject, $authorid, $author) = array($read['fid'], $read['ptable'], $read['ifcheck'], getstatus($read['tpcstatus'], 2), $read['topreplays'], $read['subject'], $read['authorid'], $read['author']);
$pw_posts = GetPtable($ptable);
$pwforum = new PwForum($fid);
if (!$pwforum->isForum()) {
    Showmsg('data_error');
}
$foruminfo =& $pwforum->foruminfo;
$forumset =& $pwforum->forumset;
if (!S::inArray($windid, $manager)) {
    $pwforum->forumcheck($winddb, $groupid);
}
if (!$foruminfo['allowvisit'] && $_G['allowread'] == 0 && $_COOKIE) {
示例#22
0
 function getReadContent()
 {
     $readdb = array();
     $pw_tmsgs = GetTtable($this->tid);
     $read = $this->db->get_one("SELECT t.*,tm.*,m.uid,m.username,m.oicq,m.groupid,m.memberid,m.icon AS micon ,m.hack,m.honor,m.signature,m.regdate,m.medals,m.userstatus,md.onlinetime,md.postnum,md.digests,md.rvrc,md.money,md.credit,md.currency,md.starttime,md.thisvisit,md.lastvisit,mb.* FROM pw_threads t LEFT JOIN {$pw_tmsgs} tm ON t.tid=tm.tid LEFT JOIN pw_members m ON m.uid=t.authorid LEFT JOIN pw_memberdata md ON md.uid=t.authorid {$this->tablaadd} WHERE t.tid=" . S::sqlEscape($this->tid));
     if (!$read || $read['special'] || !$read['ifcheck']) {
         return false;
     }
     $this->fid = $read['fid'];
     $this->datedir = date('ym', $read['postdate']);
     if (file_exists(R_P . "{$this->htmdir}/{$this->fid}/{$this->datedir}/{$this->tid}.html")) {
         P_unlink(R_P . "{$this->htmdir}/{$this->fid}/{$this->datedir}/{$this->tid}.html");
     }
     if (!$this->initForum($this->fid)) {
         return false;
     }
     if ($this->isHideContent($read['content'])) {
         return false;
     }
     $this->setSeosetting(&$read);
     $this->vars['forumtitle'] = $this->forumtitle;
     $this->vars['msg_guide'] = $this->guidename . "<em>&gt;</em><a href=\"read.php?tid={$this->tid}\">{$read['subject']}</a>";
     $this->vars['db_metakeyword'] = $read['subject'] . str_replace(array('|', ' - '), ',', $this->forumtitle) . 'phpwind';
     $this->vars['subject'] = $read['subject'];
     $this->vars['titletop1'] = substrs('Re:' . str_replace('&nbsp;', ' ', $read['subject']), L::config('db_titlemax') - 2);
     $this->vars['hits'] = $read['hits'];
     $this->vars['replies'] = $read['replies'];
     $this->vars['tid'] = $this->tid;
     $this->vars['fid'] = $this->fid;
     $this->vars['pwforum'] = $this->forum;
     $this->vars['postUrl'] = 'post.php?fid=' . $this->fid;
     $_pids = array();
     $read['aid'] && ($_pids[] = 0);
     $count = $read['replies'] + 1;
     $this->vars['pages'] = numofpage($count, 1, ceil($count / $this->perpage), "{$GLOBALS['db_bbsurl']}/read.php?tid={$this->tid}&");
     $read['pid'] = 'tpc';
     $readdb[] = $read;
     if ($read['replies'] > 0) {
         $readnum = $this->perpage - 1;
         $pw_posts = GetPtable($read['ptable']);
         $query = $this->db->query("SELECT t.*,m.uid,m.username,m.oicq,m.groupid,m.memberid,m.icon AS micon,m.hack,m.honor,m.signature,m.regdate,m.medals,m.userstatus,md.onlinetime,md.postnum,md.digests,md.rvrc,md.money,md.credit,md.currency,md.starttime,md.thisvisit,md.lastvisit, mb.* FROM {$pw_posts} t LEFT JOIN pw_members m ON m.uid=t.authorid LEFT JOIN pw_memberdata md ON md.uid=t.authorid {$this->tablaadd} WHERE t.tid=" . S::sqlEscape($this->tid) . " AND ifcheck='1' ORDER BY postdate LIMIT 0,{$readnum}");
         while ($read = $this->db->fetch_array($query)) {
             if ($this->isHideContent($read['content'])) {
                 return false;
             }
             $read['aid'] && ($_pids[] = $read['pid']);
             $readdb[] = $read;
         }
         $this->db->free_result($query);
     }
     if ($_pids) {
         $this->attachShow = new attachShow(false);
         $this->attachShow->init($this->tid, $_pids);
     }
     $this->vars['db_menuinit'] = "'td_post' : 'menu_post','td_post1' : 'menu_post','td_hack' : 'menu_hack'";
     $bandb = $this->forum->forumBan($readdb);
     $authorids = array($read['authorid']);
     $start_limit = 0;
     foreach ($readdb as $key => $read) {
         isset($bandb[$read['authorid']]) && ($read['groupid'] = 6);
         $authorids[] = $read['authorid'];
         $readdb[$key] = $this->htmread($read, $start_limit++);
         $this->vars['db_menuinit'] .= ",'td_read_" . $read['pid'] . "':'menu_read_" . $read['pid'] . "'";
     }
     if (L::config('db_showcustom')) {
         $this->vars['customdb'] = $this->getCustomdb($authorids);
     }
     return $readdb;
 }
示例#23
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;
 }
示例#24
0
文件: rss.php 项目: jechiy/PHPWind
 }
 $title = $fid ? strip_tags($forum[$fid]['name']) : $db_bbsname;
 $title = decodeRssHtml($title);
 $title = xmlEscape($title);
 $channel = array('title' => $title, 'link' => $db_bbsurl, 'description' => "最新帖子", 'copyright' => "Copyright(C) {$db_bbsname}", 'generator' => "http://www.phpwind.com", 'lastBuildDate' => date('r'), 'ttl' => $ttl);
 $Rss = new Rss(array('xml' => "1.0", 'rss' => "2.0", 'encoding' => $db_charset));
 if ($sql) {
     $query = $db->query("SELECT t.tid,t.fid,t.subject,t.author,t.ifhide,t.postdate,t.anonymous,fe.forumset as forumset \n\t\t\t\t\t\t\t\tFROM pw_threads t {$forceindex} \n\t\t\t\t\t\t\t\tLEFT JOIN pw_forumsextra fe ON t.fid=fe.fid {$sql}");
     $lastPostFlag = true;
     $threaddbs = array();
     while ($threaddb = $db->fetch_array($query)) {
         $threaddbs[$threaddb[tid]] = $threaddb;
     }
     if (S::isArray($threaddbs)) {
         $tmsgTids = array_keys($threaddbs);
         $pw_tmsgs = !$db_merge_tmsgs ? GetTtable($threaddb['tid']) : 'pw_merge_tmsgs';
         $query = $db->query("SELECT tid,aid,content,ifsign FROM {$pw_tmsgs} WHERE tid IN (" . S::sqlImplode($tmsgTids) . ")");
         while ($rt = $db->fetch_array($query)) {
             isset($threaddbs[$rt['tid']]) && ($rt = array_merge((array) $rt, $threaddbs[$rt['tid']]));
             if (isset($rt['forumset']) && $rt['forumset']) {
                 $forumset = unserialize($rt['forumset']);
             } else {
                 $forumset = array();
             }
             if ($lastPostFlag) {
                 $forumLastPostTime = $rt['postdate'];
                 $lastPostFlag = false;
             }
             $rt['anonymous'] && ($rt['author'] = $db_anonymousname);
             if ($db_htmifopen) {
                 $link = "{$db_bbsurl}/read{$db_dir}tid-{$rt['tid']}{$db_ext}";
示例#25
0
function delforum($fid)
{
    global $db, $db_guestdir, $db_guestthread, $db_guestread;
    $foruminfo = $db->get_one("SELECT fid,fup,forumadmin FROM pw_forums WHERE fid=" . pwEscape($fid));
    $db->update("DELETE FROM pw_forums WHERE fid=" . pwEscape($fid));
    $db->update("DELETE FROM pw_forumdata WHERE fid=" . pwEscape($fid));
    $db->update("DELETE FROM pw_forumsextra WHERE fid=" . pwEscape($fid));
    $db->update("DELETE FROM pw_permission WHERE fid>'0' AND fid=" . pwEscape($fid));
    if ($foruminfo['forumadmin']) {
        $forumadmin = explode(",", $foruminfo['forumadmin']);
        foreach ($forumadmin as $key => $value) {
            if ($value) {
                $gid = $db->get_one("SELECT uid,groupid FROM pw_members WHERE username="******"UPDATE pw_members SET groupid='-1' WHERE username="******"{$db_guestdir}/T_{$fid}");
    }
    P_unlink(D_P . "data/forums/fid_{$fid}.php");
    $ttable_a = $ptable_a = array();
    $query = $db->query("SELECT tid,replies,ptable FROM pw_threads WHERE fid=" . pwEscape($fid));
    while ($tpc = $db->fetch_array($query)) {
        $tid = $tpc['tid'];
        $ttable_a[GetTtable($tid)][] = $tid;
        $ptable_a[$tpc['ptable']] = 1;
        $db_guestread && clearguestcache($tid, $tpc['replies']);
    }
    foreach ($ttable_a as $pw_tmsgs => $val) {
        $val = pwImplode($val, false);
        $db->update("DELETE FROM {$pw_tmsgs} WHERE tid IN({$val})");
    }
    # $db->update("DELETE FROM pw_threads WHERE fid=".pwEscape($fid));
    # ThreadManager
    $threadManager = L::loadClass("threadmanager");
    $threadManager->deleteByForumId($fid);
    foreach ($ptable_a as $key => $val) {
        $pw_posts = GetPtable($key);
        $db->update("DELETE FROM {$pw_posts} WHERE fid=" . pwEscape($fid));
    }
    updateforum($foruminfo['fup']);
}
示例#26
0
 S::gp(array('tstart', 'lines', 'tmax', 'tmin'));
 list($tidmin, $tidmax) = maxmin($id);
 !$lines && ($lines = 5000);
 if ($tmin <= $tidmin && $step < 3) {
     !$tstart && ($tstart = $tmin - 1);
     $end = $tstart + $lines;
     $tend = $tmax > $tidmin ? $tidmin : $tmax;
     $end > $tend && ($end = $tend);
     $ttable = GetTtable($end);
     $step = 2;
 } else {
     !$tstart && ($tstart = $tidmax);
     $end = $tstart + $lines;
     $tend = $tmax;
     $end > $tend && ($end = $tend);
     $ttable = GetTtable($tstart + 1);
     $step = 3;
 }
 $ftable = 'pw_tmsgs' . $id;
 $ftable == $ttable && adminmsg('table_same');
 $db->update("INSERT INTO {$ttable} SELECT * FROM {$ftable} WHERE tid>" . S::sqlEscape($tstart) . 'AND tid<=' . S::sqlEscape($end));
 $db->update("DELETE FROM {$ftable} WHERE tid>" . S::sqlEscape($tstart) . 'AND tid<=' . S::sqlEscape($end));
 if ($end < $tend) {
     $j_url = "{$basename}&action={$action}&step={$step}&tstart={$end}&lines={$lines}&tmax={$tmax}&tmin={$tmin}&id={$id}";
     adminmsg('table_change', EncodeUrl($j_url), 2);
 } elseif ($step == 2 && $tidmax && $tmax > $tidmax) {
     $step = 3;
     $j_url = "{$basename}&action={$action}&step={$step}&lines={$lines}&tmax={$tmax}&tmin={$tmin}&id={$id}";
     adminmsg('table_change', EncodeUrl($j_url), 2);
 } else {
     adminmsg('operate_success');
示例#27
0
            $a_url = geturl($rt['attachurl'], 'show');
            $rt['a_url'] = is_array($a_url) ? $a_url[0] : $a_url;
            $rt['ifthumb'] == 1 && ($rt['a_url'] = str_replace($rt['attachurl'], 'thumb/' . $rt['attachurl'], $rt['a_url']));
            !$rt['descrip'] && ($rt['descrip'] = substrs($rt['subject'], 20));
        }
        !$rt['pid'] && ($rt['pid'] = 'tpc');
        $rt['fname'] = $forum[$rt['fid']]['name'];
        $showdb[$key] = $rt;
    }
    require_once PrintEot('show');
    footer();
} else {
    $pw_attachs = L::loadDB('attachs', 'forum');
    $rt = $pw_attachs->get($aid);
    if ($rt && $rt['tid'] && $rt['fid']) {
        $pw_tmsgs = GetTtable($rt['tid']);
        $rtinfo = $db->get_one("SELECT t.fid,t.subject,t.ifcheck,t.ifshield,tm.content,m.username\r\n\t\t\tFROM pw_threads t LEFT JOIN {$pw_tmsgs} tm ON tm.tid=t.tid\r\n\t\t\tLEFT JOIN pw_members m ON m.uid=t.authorid\r\n\t\t\tWHERE t.tid=" . S::sqlEscape($rt['tid'], false));
        if (in_array($rtinfo['fid'], $fidoff) || $rtinfo['ifshield'] == '2' || $groupid != '3' && $groupid != '4' && ($rtinfo['needrvrc'] > $userrvrc || !$rtinfo['ifcheck'] || $rtinfo['ifshield'] || strpos($rtinfo['content'], "[post]") !== false && strpos($rtinfo['content'], "[/post]") !== false || strpos($rtinfo['content'], "[hide") !== false && strpos($rtinfo['content'], "[/hide]") !== false || strpos($rtinfo['content'], "[sell") !== false && strpos($rtinfo['content'], "[/sell]") !== false)) {
            Showmsg('pic_not_exists');
        }
        $rt['subject'] = $rtinfo['subject'];
        $rt['username'] = $rtinfo['username'];
        $a_url = geturl($rt['attachurl'], 'show');
        $rt['a_url'] = is_array($a_url) ? $a_url[0] : $a_url;
        $uid = $rt['uid'];
        $type = 1;
        $owner = $rt['username'];
        !$rt['pid'] && ($rt['pid'] = 'tpc');
        !$rt['descrip'] && ($rt['descrip'] = substrs(stripWindCode($rtinfo['content']), 120));
    } else {
        Showmsg('pic_not_exists');
示例#28
0
文件: tagset.php 项目: jechiy/PHPWind
    $ns = $ns ? $ns : (is_int($ns) ? 0 : '');
    $ne = $ne ? $ne : (is_int($ne) ? 0 : '');
    include PrintEot('tagset');
    exit;
} elseif ($action == 'tag') {
    S::gp(array('page', 'tagid', 'tagname'));
    (int) $page < 1 && ($page = 1);
    $sql = is_numeric($tagid) ? "tagid=" . S::sqlEscape($tagid) : "tagname=" . S::sqlEscape($tagname);
    $limit = "LIMIT " . ($page - 1) * $db_perpage . ",{$db_perpage}";
    $rs = $db->get_one("SELECT tagid,tagname,num FROM pw_tags WHERE {$sql}");
    $pages = numofpage($rs['num'], $page, ceil($rs['num'] / $db_perpage), "{$basename}&tagid={$tagid}&");
    $readb = $ttable_a = array();
    $query = $db->query("SELECT td.tagid,td.tid,t.subject FROM pw_tagdata td LEFT JOIN pw_threads t ON td.tid=t.tid WHERE tagid=" . S::sqlEscape($rs['tagid'], false) . $limit);
    while ($rt = $db->fetch_array($query)) {
        $readb[$rt['tid']] = $rt;
        $ttable_a[GetTtable($rt['tid'])][] = $rt['tid'];
    }
    foreach ($ttable_a as $pw_tmsgs => $tids) {
        $tids = S::sqlImplode($tids);
        $query = $db->query("SELECT tid,tags FROM {$pw_tmsgs} WHERE tid IN({$tids})");
        while ($rt = $db->fetch_array($query)) {
            list($tags, $relatetag) = explode("\t", $rt['tags']);
            foreach (explode(' ', $tags) as $key => $value) {
                $readb[$rt['tid']]['tags'] .= "<a href=\"{$basename}&action=tag&tagname=" . rawurlencode($value) . "\">{$value}</a> ";
            }
            foreach (explode(' ', $relatetag) as $key => $value) {
                $readb[$rt['tid']]['relatetag'] .= "<a href=\"{$basename}&action=tag&tagname=" . rawurlencode($value) . "\">{$value}</a> ";
            }
        }
    }
    include PrintEot('tagset');
示例#29
0
    $admincheck = 1;
} else {
    $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 {
示例#30
0
function getDescripByTid($tid)
{
    global $db;
    $tid = (int) $tid;
    if (!$tid) {
        return '';
    }
    $table = GetTtable($tid);
    $content = $db->get_value("SELECT content FROM {$table} WHERE tid=" . pwEscape($tid));
    $content = stripWindCode($content);
    $content = strip_tags($content);
    return substrs($content, 200);
}