Beispiel #1
0
 function get_reply($uid, $num = 20)
 {
     $pw_posts = GetPtable($GLOBALS['db_ptable']);
     $array = $tTable = $tids = array();
     $query = $this->_db->query("SELECT DISTINCT tid,pid FROM {$pw_posts} WHERE authorid=" . S::sqlEscape($uid) . " AND ifcheck=1 AND fid!=0 ORDER BY postdate DESC " . S::sqlLimit($num));
     while ($rt = $this->_db->fetch_array($query)) {
         $tids[] = $rt['tid'];
         $pids[$rt[tid]][] = $rt['pid'];
     }
     if ($tids) {
         $query = $this->_db->query("SELECT t.tid,t.subject,t.replies,t.hits,t.postdate,f.fid as forumsid,f.name as forums FROM pw_threads t LEFT JOIN pw_forums f ON t.fid=f.fid WHERE t.tid IN(" . S::sqlImplode($tids) . ") ORDER BY t.tid DESC");
         while ($rt = $this->_db->fetch_array($query)) {
             $rt['subject'] = substrs($rt['subject'], 45);
             $rt['forums'] = substrs(stripWindCode($rt['forums']), 100, 'N');
             list($rt['postdate']) = getLastDate($rt['postdate']);
             $rt['pid'] = $pids[$rt[tid]][0];
             $tTable[getTtable($rt['tid'])][] = $rt['tid'];
             $array[$rt['tid']] = $rt;
         }
         foreach ($tTable as $pw_tmsgs => $ids) {
             $query = $this->_db->query("SELECT tid,content FROM {$pw_tmsgs} WHERE tid IN (" . S::sqlImplode($ids) . ')');
             while ($rt = $this->_db->fetch_array($query)) {
                 $array[$rt['tid']]['content'] = substrs(stripWindCode($rt['content']), 100, 'N');
             }
         }
     }
     return $array;
 }
 function shieldPost($pid, $tid)
 {
     list($pid, $tid) = array(intval($pid), intval($tid));
     if ($pid < 1 || $tid < 1) {
         return $this->buildResponse(POST_INVALID_PARAMS);
     }
     $postTable = GetPtable('N', $tid);
     $GLOBALS['db']->query("UPDATE " . S::sqlMetadata($postTable) . " SET ifshield=1 WHERE pid=" . S::sqlEscape($pid));
     $bool = $GLOBALS['db']->affected_rows();
     return $this->buildResponse($bool == 1 ? 0 : 1);
 }
Beispiel #3
0
 /**
  * @param $uid			用户ID
  * @param $page			当前页数
  * @return unknown_type	返回类型
  */
 function getReplaysByUser($uid, $page = 1)
 {
     global $db_ptable;
     $uid = (int) $uid;
     if (!$uid) {
         return array();
     }
     $pw_posts = GetPtable($db_ptable);
     (int) $page < 1 && ($page = 1);
     $start = ($page - 1) * $this->perPage;
     $limit = pwLimit($start, $this->perPage);
     $sql = "SELECT p.pid,p.postdate,t.tid,t.fid,t.subject,t.authorid,t.author,t.replies,t.hits,t.topped,t.digest,t.ifupload\r\n\t\t\t FROM {$pw_posts} p LEFT JOIN pw_threads t USING(tid) WHERE p.fid != 0 AND p.authorid= " . pwEscape($uid) . " \r\n\t\t\t AND p.fid != '0' ORDER BY p.postdate DESC {$limit}";
     return $this->_query($sql, $start, 're');
 }
Beispiel #4
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 #5
0
 function execute($postdata)
 {
     global $timestamp, $db_ptable, $onlineip, $db_plist;
     $this->setPostData($postdata);
     if ($db_plist && count($db_plist) > 1) {
         $this->db->update("INSERT INTO pw_pidtmp(pid) VALUES('')");
         $pid = $this->db->insert_id();
     } else {
         $pid = '';
     }
     $ipTable = L::loadClass('IPTable');
     $pwSQL = pwSqlSingle(array('pid' => $pid, 'fid' => $this->data['fid'], 'tid' => $this->tid, 'aid' => $this->data['aid'], 'author' => $this->data['author'], 'authorid' => $this->data['authorid'], 'icon' => $this->data['icon'], 'postdate' => $timestamp, 'subject' => $this->data['title'], 'userip' => $onlineip, 'ifsign' => $this->data['ifsign'], 'ipfrom' => $ipTable->getIpFrom($onlineip), 'ifconvert' => $this->data['convert'], 'ifwordsfb' => $this->data['ifwordsfb'], 'ifcheck' => $this->data['ifcheck'], 'content' => $this->data['content'], 'anonymous' => $this->data['anonymous'], 'ifhide' => $this->data['hideatt']));
     $pw_posts = GetPtable($this->tpcArr['ptable']);
     $this->db->update("INSERT INTO {$pw_posts} SET {$pwSQL}");
     !$pid && ($pid = $this->db->insert_id());
     $this->tpcArr['openIndex'] && $this->setPostFloor($pid);
     $this->pid = $pid;
     if (is_object($this->att) && ($aids = $this->att->getAids())) {
         $this->db->update("UPDATE pw_attachs SET " . pwSqlSingle(array('tid' => $this->tid, 'pid' => $this->pid)) . ' WHERE aid IN(' . pwImplode($aids) . ')');
     }
     if ($this->data['ifcheck'] == 1) {
         $sqladd1 = '';
         $sqladd = array('lastposter' => $this->data['lastposter']);
         $this->tpcArr['locked'] < 3 && $this->tpcArr['lastpost'] < $timestamp && ($sqladd['lastpost'] = $timestamp);
         $this->data['ifupload'] && ($sqladd['ifupload'] = $this->data['ifupload']);
         $ret = $this->sendMail();
         if ($ret & 2) {
             $sqladd['ifmail'] = 4;
         } elseif ($ret & 1) {
             $sqladd1 = "ifmail=ifmail-1,";
         }
         $this->db->update("UPDATE pw_threads SET {$sqladd1}replies=replies+1,hits=hits+1," . pwSqlSingle($sqladd) . " WHERE tid=" . pwEscape($this->tid));
         if (getstatus($this->tpcArr['tpcstatus'], 1)) {
             $this->db->update("UPDATE pw_argument SET lastpost=" . pwEscape($timestamp) . ' WHERE tid=' . pwEscape($this->tid));
         }
     }
     $this->post->updateUserInfo($this->type, $this->creditSet(), $this->data['content']);
     $this->afterReply();
 }
Beispiel #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;
}
Beispiel #7
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']);
}
Beispiel #8
0
 function sendPost($tid, $uid, $title, $content)
 {
     global $winddb, $winduid, $windid, $groupid, $fid, $timestamp, $pwforum, $pwpost, $_G, $db_uploadfiletype, $uploadcredit, $uploadmoney, $manager, $isBM, $_time;
     $timestamp = time();
     $_time = array('hours' => get_date($timestamp, 'G'), 'day' => get_date($timestamp, 'j'), 'week' => get_date($timestamp, 'w'));
     list($uid, $tid, $title, $content) = array(intval($uid), intval($tid), trim($title), trim($content));
     if ($uid < 1 || $tid < 1 || !$content) {
         return $this->buildResponse(THREAD_INVALID_PARAMS);
     }
     ACloud_Sys_Core_Common::setGlobal('customized_current_uid', $uid);
     $user = $this->getCurrentUser();
     if (!$user->isLogin()) {
         return $this->buildResponse(USER_NOT_LOGIN);
     }
     if ($user->groupid == 6 || getstatus($user->info['userstatus'], PW_USERSTATUS_BANUSER)) {
         return $this->buildResponse(THREAD_USER_NOT_RIGHT);
     }
     $user->initRight();
     $winduid = $user->uid;
     $groupid = $user->groupid;
     $windid = $user->username;
     $winddb = $user->info;
     $_G = $user->_G;
     if ($_G['postlimit'] && $winddb['todaypost'] >= $_G['postlimit']) {
         return $this->buildResponse(POST_GP_LIMIT);
     }
     $tpcarray = $GLOBALS['db']->get_one("SELECT t.tid,t.fid,t.locked,t.ifcheck,t.author,t.authorid,t.postdate,t.lastpost,t.ifmail,t.special,t.subject,t.type,t.ifshield,t.anonymous,t.ptable,t.replies,t.tpcstatus FROM pw_threads t WHERE t.tid=" . pwEscape($tid));
     L::loadClass('forum', 'forum', false);
     $pwforum = new PwForum($tpcarray['fid']);
     if (!$pwforum->isForum()) {
         return $this->buildResponse(THREAD_FORUM_NOT_EXIST);
     }
     $fid = $tpcarray['fid'];
     $isBM = $pwforum->isBM($windid);
     $isGM = S::inArray($windid, $manager);
     if (!$isGM && $tpcarray['locked'] % 3 != 0 && !pwRights($isBM, 'replylock')) {
         return $this->buildResponse(THREAD_LOCKED);
     }
     L::loadClass('post', 'forum', false);
     require_once ACLOUD_VERSION_PATH . '/customized/ver.customized.bbscode.php';
     $pwpost = new PwPost($pwforum);
     $pwpost->errMode = true;
     $pwpost->forumcheck();
     $pwpost->postcheck();
     L::loadClass('replypost', 'forum', false);
     $replypost = new replyPost($pwpost);
     $replypost->setTpc($tpcarray);
     $replypost->check();
     $pw_posts = GetPtable($replypost->tpcArr['ptable']);
     $postdata = new replyPostData($pwpost);
     $postdata->setTitle($title);
     $postdata->setContent($content);
     $postdata->conentCheck();
     if ($pwpost->errMsg && ($msg = reset($pwpost->errMsg))) {
         return $this->buildResponse(THREAD_SYSTEM_ERROR, $msg);
     }
     require_once ACLOUD_VERSION_PATH . '/customized/ver.customized.attupload.php';
     if (PwUpload::getUploadNum()) {
         $_G['uploadtype'] && ($db_uploadfiletype = $_G['uploadtype']);
         $db_uploadfiletype = !empty($db_uploadfiletype) ? is_array($db_uploadfiletype) ? $db_uploadfiletype : unserialize($db_uploadfiletype) : array();
         $postdata->att = new AttUpload($user->uid);
         $return = $postdata->att->check();
         if ($return) {
             $msginfo = getLangInfo('msg', $return);
             return $this->errMessage(THREAD_USER_NOT_RIGHT, $msginfo);
         }
         list($windVersion) = explode(',', WIND_VERSION);
         if ($windVersion && $windVersion < '8.5') {
             $postdata->att->transfer();
             PwUpload::upload($postdata->att);
         }
     }
     $replypost->execute($postdata);
     $pid = $replypost->getNewId();
     return $this->buildResponse(0, array('pid' => $pid));
 }
Beispiel #9
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 #10
0
             list($hidefid, $hideforum) = GetHiddenForum();
             $sql = $hidefid ? "fid NOT IN({$hidefid})" : '1';
         }
     } else {
         $forumcache = '';
         $sql = '';
     }
     if ($sql) {
         $sysinfo['tcheck'] = $db->get_value("SELECT COUNT(*) FROM pw_threads WHERE {$sql} AND ifcheck='0'");
         $sysinfo['pcheck'] = 0;
         if ($db_plist && count($db_plist) > 1) {
             foreach ($db_plist as $key => $val) {
                 if ($key == 0) {
                     continue;
                 }
                 $pw_posts = GetPtable($key);
                 $sysinfo['pcheck'] += $db->get_value("SELECT COUNT(*) FROM {$pw_posts} WHERE ifcheck='0' AND {$sql}");
             }
         } else {
             $sysinfo['pcheck'] = $db->get_value("SELECT COUNT(*) FROM pw_posts WHERE ifcheck='0' AND {$sql}");
         }
     } else {
         $sysinfo['tcheck'] = 0;
         $sysinfo['pcheck'] = 0;
     }
     $sysinfo['report'] = $db->get_value("SELECT COUNT(*) FROM pw_report WHERE state=0");
 }
 $lastinfo = $slog = array();
 $userService = L::loadClass('UserService', 'user');
 /* @var $userService PW_UserService */
 $userdb = $userService->getByUserName($admin_name);
Beispiel #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']);
}
Beispiel #12
0
 /**
  * 改变帖子归属版块
  * @param int $cyid 群组id
  * @param int $ifTopicShowInForum 帖子是否显示在版块中
  * @param int $tocid 目标群组
  * @param int $fromcid 来源群组
  * void
  */
 function changeTopicToForum($cyid, $ifTopicShowInForum, $tocid, $fromcid)
 {
     global $db_plist;
     $tocid = intval($tocid);
     $ifcheck = $tocid > 0 && $ifTopicShowInForum ? 1 : 2;
     $this->_db->update("REPLACE INTO pw_poststopped \r\n\t\t\tSELECT {$tocid},p.tid,p.pid,p.floor,p.uptime,p.overtime \r\n\t\t\tFROM pw_poststopped p \r\n\t\t\tLEFT JOIN pw_argument a ON p.tid=a.tid \r\n\t\t\tWHERE p.fid=" . S::sqlEscape($fromcid) . " AND p.pid=0 AND a.cyid=" . S::sqlEscape($cyid));
     $_sql_Where = $fromcid > 0 ? ' AND t.fid>0' : " AND t.ifcheck='2'";
     /*$this->_db->update("UPDATE pw_argument a LEFT JOIN pw_threads t ON a.tid=t.tid 
     			SET t.fid=" . S::sqlEscape($tocid) . ",t.ifcheck=" . S::sqlEscape($ifcheck) . 
     			" WHERE a.cyid=" . S::sqlEscape($cyid) . $_sql_Where
     		);*/
     $this->_db->update(pwQuery::buildClause("UPDATE :pw_table1 a LEFT JOIN :pw_table2 t ON a.tid=t.tid SET t.fid=:fid,t.ifcheck=:ifcheck WHERE a.cyid=:cyid {$_sql_Where}", array('pw_argument', 'pw_threads', $tocid, $ifcheck, $cyid)));
     $this->_db->update("UPDATE pw_argument a LEFT JOIN pw_posts p ON a.tid=p.tid SET p.fid=" . S::sqlEscape($tocid) . " WHERE a.cyid=" . S::sqlEscape($cyid));
     if ($db_plist && count($db_plist) > 1) {
         foreach ($db_plist as $key => $value) {
             if ($key == 0) {
                 continue;
             }
             $pw_posts = GetPtable($key);
             $this->_db->update("UPDATE pw_argument a LEFT JOIN {$pw_posts} p ON a.tid=p.tid SET p.fid=" . S::sqlEscape($tocid) . " WHERE a.cyid=" . S::sqlEscape($cyid));
         }
     }
     require_once R_P . 'require/updateforum.php';
     if ($tocid > 0) {
         $this->_db->update("UPDATE pw_cnclass SET cnsum=cnsum+1 WHERE fid=" . S::sqlEscape($tocid));
         updateforum($tocid);
     }
     if ($fromcid > 0) {
         $this->_db->update("UPDATE pw_cnclass SET cnsum=cnsum-1 WHERE fid=" . S::sqlEscape($fromcid) . " AND cnsum>0");
         updateforum($fromcid);
     }
     updatetop();
 }
Beispiel #13
0
     wap_header('post', $db_bbsname);
     require_once PrintEot('wap_post');
     wap_footer();
 } else {
     if (!$tp['ifcheck']) {
         wap_msg('reply_ifcheck');
     }
     if ($tp['locked'] > 0) {
         wap_msg("reply_lockatc");
     }
     InitGP(array('subject', 'content'), 'P', 0);
     wap_check($fid, 'reply');
     $subject = wap_cv($subject);
     $content = wap_cv($content);
     $ipfrom = Char_cv(cvipfrom($onlineip));
     $pw_posts = GetPtable($tp['ptable']);
     if ($db_plist && count($db_plist) > 1) {
         $db->update("INSERT INTO pw_pidtmp(pid) values('')");
         $pid = $db->insert_id();
     } else {
         $pid = '';
     }
     $db->update("INSERT INTO {$pw_posts}" . " SET " . pwSqlSingle(array('pid' => $pid, 'tid' => $tid, 'fid' => $fid, 'ifcheck' => 1, 'subject' => $subject, 'author' => $windid, 'authorid' => $winduid, 'postdate' => $timestamp, 'userip' => $onlineip, 'ipfrom' => $ipfrom, 'content' => $content)));
     !$pid && ($pid = $db->insert_id());
     $db->update("UPDATE pw_threads" . " SET " . pwSqlSingle(array('lastpost' => $timestamp, 'lastposter' => $windid)) . ",replies=replies+1,hits=hits+1" . " WHERE tid=" . pwEscape($tid));
     #增加高楼索引
     if ($openIndex && $pid) {
         $db->update("INSERT INTO pw_postsfloor SET pid=" . pwEscape($pid) . ", tid=" . pwEscape($tid));
     }
     # memcache refresh
     $threadList = L::loadClass("threadlist");
Beispiel #14
0
 /**
  * 获取帖子信息
  * @param $tid
  * @param $pid
  */
 function getPostInfo($tid, $pid = 0)
 {
     $tid = intval($tid);
     $pid = intval($pid);
     if ($tid > 0) {
         //* $threadService = L::loadClass('threads', 'forum'); /* @var $threadService PW_Threads */
         //* $threadInfo = $threadService->getThreads($tid,true);
         $_cacheService = Perf::gatherCache('pw_threads');
         $threadInfo = $_cacheService->getThreadAndTmsgByThreadId($tid);
         if (!$threadInfo) {
             return false;
         }
         $fid = $threadInfo['fid'];
         $userip = $threadInfo['userip'];
         //回复
         if ($pid > 0) {
             $postTable = GetPtable($threadInfo['ptable']);
             $postInfo = $this->db->get_one("SELECT authorid,userip FROM {$postTable} \n\t\t\t\t\t\tWHERE pid= " . S::sqlEscape($pid) . " \n\t\t\t\t\t\tAND tid=" . S::sqlEscape($tid) . "\n\t\t\t\t\t\tAND authorid= " . S::sqlEscape($uid));
             if (!$postInfo) {
                 return false;
             }
             $userip = $postInfo['userip'];
         }
         return array('fid' => $fid, 'userip' => $userip);
     }
     return false;
 }
Beispiel #15
0
S::gp(array('type', 'stylepath'));
S::gp(array('fpage', 'uid', 'toread'), 'GP', 2);
$_showSmallImg = 5;
$ordertype = S::getGP('ordertype');
$fieldadd = $tablaadd = $sqladd = $fastpost = $special = $ifmagic = $urladd = $fieldinfo = $tableinfo = '';
$_uids = $_pids = array();
$page = S::getGP('page');
//* $threads = L::loadClass('Threads', 'forum');
//* $read = $threads->getThreads($tid);
$_cacheService = Perf::gatherCache('pw_threads');
$read = $_cacheService->getThreadByThreadId($tid);
!$read && Showmsg('illegal_tid');
$_uids[$read['authorid']] = 'UID_' . $read['authorid'];
#用户
list($fid, $ptable, $ifcheck, $openIndex) = array($read['fid'], $read['ptable'], $read['ifcheck'], getstatus($read['tpcstatus'], 2));
$pw_posts = GetPtable($ptable);
/*The app client*/
if ($db_siteappkey && ($db_apps_list['17']['status'] == 1 || is_array($db_threadconfig))) {
    $appclient = L::loadClass('appclient');
    if ($db_apps_list['17']['status'] == 1) {
        $forumappinfo = array();
        $forumappinfo = $appclient->showForumappinfo($fid, 'read', '17');
    }
    if (is_array($db_threadconfig)) {
        $threadright = array();
        $threadright = $appclient->getThreadRight();
    }
}
/*The app client*/
//读取版块信息及权限判断
if (!($foruminfo = L::forum($fid))) {
Beispiel #16
0
function nextReply($tid, $pid, $ptable, $order)
{
    global $db;
    $pw_posts = GetPtable($ptable);
    if ($order == 1) {
        $sql = "SELECT pid,content,author,authorid,content,postdate,anonymous FROM {$pw_posts} WHERE tid=" . pwEscape($tid) . " AND ifcheck=1 and pid>" . pwEscape($pid) . " ORDER BY postdate limit 1";
    } else {
        $sql = "SELECT pid,subject,author,authorid,content,postdate,anonymous FROM {$pw_posts} WHERE tid=" . pwEscape($tid) . " AND ifcheck=1 and pid<" . pwEscape($pid) . " ORDER BY postdate desc limit 1";
    }
    $ct = $db->get_one($sql);
    if ($ct) {
        $ct['content'] = replySubject($ct['content']);
    } else {
        $ct = array("pid" => 0, "content" => "");
    }
    return $ct;
}
Beispiel #17
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;
 }
Beispiel #18
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);
     }
 }
Beispiel #19
0
 /**
  * get post lists
  * $type must in array('newsubject','newreply','replysort','hitsort')
  *
  * @param string $type
  * @param int $fid
  * @param int $num
  * @param int $hour
  * @return array
  */
 function getPostList($type, $fid, $num = 0, $hour = 0, $special = 0)
 {
     global $db_ptable, $timestamp, $db_tidblacklist;
     $posttype = array('newsubject', 'newreply', 'replysort', 'hitsort');
     if (!in_array($type, $posttype)) {
         return false;
     }
     !$fid && ($fid = getCommonFid());
     $num = (int) $num;
     $hour = (int) $hour;
     $special = (int) $special;
     !$num && ($num = $this->cachenum);
     $time = $hour ? strlen($hour) == 10 ? $hour : $timestamp - intval($hour) * 3600 : 0;
     $sqladd = '';
     if ($type == 'replysort' || $type == 'newsubject') {
         $forceindex = '';
         $special && ($sqladd .= 'AND t.special=' . S::sqlEscape($special));
         $sqladd .= $time ? ' AND t.postdate>' . S::sqlEscape($time) : '';
         if ($fid) {
             if (strpos($fid, ',') === false) {
                 $fid = trim($fid, "'");
                 $sqladd .= " AND t.fid=" . S::sqlEscape($fid, false);
                 if ($type == 'newsubject') {
                     $forumpost = $this->db->get_value("SELECT topic FROM pw_forumdata WHERE fid=" . S::sqlEscape($fid, false));
                     if ($forumpost < 100) {
                         $forceindex = 'FORCE INDEX(' . getForceIndex('idx_fid_ifcheck_specialsort_lastpost') . ')';
                     } else {
                         $forceindex = 'FORCE INDEX(' . getForceIndex('idx_postdate') . ')';
                     }
                 }
             } else {
                 $sqladd .= " AND t.fid IN ({$fid}) ";
                 if ($type == 'newsubject') {
                     $forceindex = 'FORCE INDEX(' . getForceIndex('idx_postdate') . ')';
                 }
             }
         }
         $sqladd .= $this->_getBlackList('t.tid', $db_tidblacklist);
     } else {
         $sqladd .= $time ? ' AND postdate>' . S::sqlEscape($time) : '';
         if ($fid) {
             if (is_numeric($fid)) {
                 $sqladd .= " AND fid ={$fid} ";
             } else {
                 $sqladd .= " AND fid IN ({$fid}) ";
             }
         }
         $sqladd .= $this->_getBlackList('tid', $db_tidblacklist);
     }
     if ($type == 'newsubject') {
         if ($this->reality == false) {
             $sql = "SELECT t.tid AS id,t.postdate AS value FROM pw_threads t {$forceindex} WHERE t.ifcheck=1 AND t.anonymous != 1 AND t.ifshield != 1 AND t.locked != 2 {$sqladd} ORDER BY t.postdate DESC " . S::sqlLimit($num);
         } else {
             if ($special == 2) {
                 $sql = "SELECT a.*,t.fid FROM pw_threads t LEFT JOIN pw_activity a ON t.tid=a.tid WHERE t.ifcheck='1' AND t.anonymous != 1 AND t.ifshield != 1 AND t.locked != 2 {$sqladd} ORDER BY t.tid DESC " . S::sqlLimit($num);
             } elseif ($special == 3) {
                 global $db_moneyname, $db_rvrcname, $db_creditname, $db_currencyname, $_CREDITDB;
                 $cType = array('money' => $db_moneyname, 'rvrc' => $db_rvrcname, 'credit' => $db_creditname, 'currency' => $db_currencyname);
                 foreach ($_CREDITDB as $k => $v) {
                     $cType[$k] = $v[0];
                 }
                 $sql = "SELECT r.tid,r.cbtype,r.catype,r.cbval,r.caval,r.timelimit,t.fid,t.author,t.authorid,t.subject,t.type,t.postdate,t.hits,t.replies ,t.lastpost FROM pw_threads t LEFT JOIN pw_reward r ON t.tid=r.tid WHERE t.ifcheck='1' AND t.anonymous != 1 AND t.ifshield != 1 AND t.locked != 2 {$sqladd} ORDER BY t.tid DESC " . S::sqlLimit($num);
             } elseif ($special == 4) {
                 $sql = "SELECT tr.tid,tr.name,tr.icon,tr.price,t.fid FROM pw_threads t LEFT JOIN pw_trade tr ON t.tid=tr.tid WHERE t.ifcheck='1' AND t.anonymous != 1 AND t.ifshield != 1 AND t.locked != 2 {$sqladd} ORDER BY t.tid DESC " . S::sqlLimit($num);
             } else {
                 $sql = "SELECT t.tid,t.fid,t.author,t.authorid,t.subject,t.type,t.postdate,t.hits,t.replies,t.lastpost FROM pw_threads t {$forceindex} WHERE ifcheck=1 AND t.anonymous != 1 AND t.ifshield != 1 AND t.locked != 2 {$sqladd} ORDER BY postdate DESC " . S::sqlLimit($num);
             }
         }
     } elseif ($type == 'newreply') {
         $pw_posts = GetPtable($db_ptable);
         $sql = "SELECT DISTINCT tid FROM {$pw_posts} FORCE INDEX(PRIMARY) WHERE ifcheck=1 {$sqladd} ORDER BY pid DESC " . S::sqlLimit($num);
         $tids = array();
         $query = $this->db->query($sql);
         while ($reply = $this->db->fetch_array($query)) {
             $tids[] = $reply['tid'];
         }
         if ($tids) {
             if ($this->reality == false) {
                 $sql = "SELECT tid AS id,postdate AS value FROM pw_threads WHERE tid IN(" . S::sqlImplode($tids) . ") AND anonymous != 1 AND ifshield != 1 AND locked != 2 ORDER BY lastpost DESC";
             } else {
                 $sql = "SELECT tid,fid,author,authorid,subject,type,postdate,hits,replies,lastpost FROM pw_threads WHERE tid IN(" . S::sqlImplode($tids) . ") AND anonymous != 1 AND ifshield != 1 AND locked != 2 ORDER BY lastpost DESC";
             }
         } else {
             return false;
         }
     } elseif ($type == 'replysort') {
         if ($this->reality == false) {
             $sql = "SELECT t.tid AS id,t.replies AS value,t.postdate AS addition FROM pw_threads t WHERE t.ifcheck='1' AND t.replies>0 AND t.ifshield != 1 AND t.locked != 2 {$sqladd} ORDER BY t.replies DESC " . S::sqlLimit($num);
         } else {
             if ($special == 2) {
                 $sql = "SELECT a.*,t.fid FROM pw_threads t LEFT JOIN pw_activity a ON t.tid=a.tid WHERE t.ifcheck='1' AND t.replies>0 AND t.ifshield != 1 AND t.locked != 2 {$sqladd} ORDER BY t.replies DESC " . S::sqlLimit($num);
             } elseif ($special == 3) {
                 global $db_moneyname, $db_rvrcname, $db_creditname, $db_currencyname, $_CREDITDB;
                 $cType = array('money' => $db_moneyname, 'rvrc' => $db_rvrcname, 'credit' => $db_creditname, 'currency' => $db_currencyname);
                 foreach ($_CREDITDB as $k => $v) {
                     $cType[$k] = $v[0];
                 }
                 $sql = "SELECT r.tid,r.cbtype,r.catype,r.cbval,r.caval,r.timelimit,t.fid,t.author,t.authorid,t.subject,t.type,t.postdate,t.hits,t.replies,t.lastpost FROM pw_threads t LEFT JOIN pw_reward r ON t.tid=r.tid WHERE t.ifcheck='1' AND t.replies>0 AND t.ifshield != 1 AND t.locked != 2 {$sqladd} ORDER BY t.replies DESC " . S::sqlLimit($num);
             } elseif ($special == 4) {
                 $sql = "SELECT tr.tid,tr.name,tr.icon,tr.price,t.fid,t.postdate FROM pw_threads t LEFT JOIN pw_trade tr ON t.tid=tr.tid WHERE t.ifcheck='1' AND t.replies>0 AND t.ifshield != 1 AND t.locked != 2 {$sqladd} ORDER BY t.replies DESC " . S::sqlLimit($num);
             } else {
                 $sql = "SELECT t.tid,t.fid,t.author,t.authorid,t.subject,t.type,t.postdate,t.hits,t.replies,t.lastpost FROM pw_threads t WHERE t.ifcheck='1' AND t.replies>0 AND t.ifshield != 1 AND t.locked != 2 {$sqladd} ORDER BY t.replies DESC " . S::sqlLimit($num);
             }
         }
     } elseif ($type == 'hitsort') {
         if ($this->reality == false) {
             $sql = "SELECT tid AS id,hits AS value,postdate AS addition FROM pw_threads WHERE ifcheck='1' AND hits>0 AND ifshield != 1 AND locked != 2 {$sqladd} ORDER BY hits DESC " . S::sqlLimit($num);
         } else {
             $sql = "SELECT tid,fid,author,authorid,subject,type,postdate,hits,replies,lastpost FROM pw_threads WHERE ifcheck='1' AND hits>0 AND ifshield != 1 AND locked != 2 {$sqladd} ORDER BY hits DESC " . S::sqlLimit($num);
         }
     }
     $posts = array();
     $query = $this->db->query($sql);
     while ($post = $this->db->fetch_array($query)) {
         if ($this->reality == false) {
             $type != 'newreply' && ($post['special'] = $special);
             $posts[] = $post;
         } else {
             $tem = array();
             $tem['url'] = 'read.php?tid=' . $post['tid'];
             $tem['authorurl'] = 'u.php?uid=' . $post['authorid'];
             if ($type == 'replysort' || $type == 'newsubject') {
                 if ($special == 2) {
                     $tem['title'] = $post['subject'];
                     $tem['value'] = $post['deadline'];
                     $tem['image'] = '';
                 } elseif ($special == 3) {
                     $tem['title'] = $post['subject'];
                     $tem['value'] = $cType[$post['cbtype']] . ":" . $post['cbval'];
                     $tem['image'] = '';
                 } elseif ($special == 4) {
                     $tem['title'] = $post['name'];
                     $tem['value'] = $post['price'];
                     $pic = geturl($post['icon'], 'show', 1);
                     if (is_array($pic)) {
                         $tem['image'] = $pic[0];
                     } else {
                         $tem['image'] = 'images/noproduct.gif';
                     }
                 } else {
                     $tem['title'] = $post['subject'];
                     $tem['value'] = $type == 'replysort' ? $post['replies'] : $post['postdate'];
                     $tem['image'] = '';
                 }
             } elseif ($type == 'hitsort') {
                 $tem['title'] = $post['subject'];
                 $tem['value'] = $post['hits'];
                 $tem['image'] = '';
             } else {
                 $tem['title'] = $post['subject'];
                 $tem['value'] = $post['postdate'];
                 $tem['image'] = '';
             }
             $tem['forumname'] = getForumName($post['fid']);
             $tem['forumurl'] = getForumUrl($post['fid']);
             list($tem['topictypename'], $tem['topictypeurl']) = getTopicType($post['type'], $post['fid']);
             $tem['addition'] = $post;
             $posts[] = $tem;
         }
     }
     return $posts;
 }
Beispiel #20
0
        $delarticle->delReply($readdb, $db_recycle, $ifdel, true, array('reason' => $atc_content));
        $jurl = "index.php?a=read&tid={$seltid}";
    } else {
        $delarticle->delTopic($readdb, $db_recycle, $ifdel, array('reason' => $atc_content));
    }
    $credit->runsql();
    foreach ($msgdb as $key => $val) {
        pwSendMsg($val);
    }
    if ($db_ifpwcache ^ 1) {
        $db->update("DELETE FROM pw_elements WHERE type !='usersort' AND id IN(" . pwImplode($delids) . ')');
    }
    P_unlink(D_P . 'data/bbscache/c_cache.php');
    wap_msg("wap_post_del", $jurl);
} else {
    $sql = "SELECT * FROM pw_threads WHERE tid = " . pwEscape($seltid);
    $threadb = $db->get_one($sql);
    if (!$threadb) {
        wap_msg('data_error');
    }
    $threadb['postdate'] = get_date($threadb['postdate'], "m-d H:i");
    //获取回复信息
    if ($selpid) {
        $ptables = GetPtable('N', $seltid);
        $replydb = $db->get_one("SELECT * FROM {$ptables} WHERE pid=" . pwEscape($selpid));
    }
    $template = 'mawhole';
}
wap_header();
require_once PrintWAP($template);
wap_footer();
Beispiel #21
0
 if (!$pwpost->admincheck && !$pwforum->allowreply($pwpost->user, $pwpost->groupid)) {
     Showmsg('reply_forum_right');
 }
 if (!$pwforum->foruminfo['allowrp'] && !$pwpost->admincheck && $_G['allowrp'] == 0) {
     Showmsg('reply_group_right');
 }
 InitGP(array('pid', 'article', 'page'));
 if ($article == '0') {
     $pw_tmsgs = GetTtable($tid);
     $S_sql = ',tm.ifsign,tm.content,m.uid,m.groupid,m.userstatus';
     $J_sql = "LEFT JOIN {$pw_tmsgs} tm ON tm.tid=t.tid LEFT JOIN pw_members m ON t.authorid=m.uid";
 } else {
     $S_sql = $J_sql = '';
 }
 $tpcarray = $db->get_one("SELECT t.fid,t.locked,t.ifcheck,t.author,t.authorid,t.subject,t.postdate,t.ifshield,t.anonymous,t.ptable {$S_sql} FROM pw_threads t {$J_sql} WHERE t.tid=" . pwEscape($tid));
 $pw_posts = GetPtable($tpcarray['ptable']);
 if ($tpcarray['fid'] != $fid) {
     Showmsg('illegal_tid');
 }
 if ($pwforum->forumset['lock'] && !$pwpost->isGM && $timestamp - $tpcarray['postdate'] > $pwforum->forumset['lock'] * 86400 && !pwRights($pwpost->isBM, 'replylock')) {
     Showmsg('forum_locked');
 }
 if (!$pwpost->isGM && !$pwpost->isBM && !$tpcarray['ifcheck']) {
     Showmsg('reply_ifcheck');
 }
 if (!$pwpost->isGM && $tpcarray['locked'] % 3 != 0 && !pwRights($pwpost->isBM, 'replylock')) {
     Showmsg('reply_lockatc');
 }
 require_once R_P . 'require/bbscode.php';
 if ($article == '0') {
     $atcarray = $tpcarray;
Beispiel #22
0
function ifpost($tid)
{
    global $admincheck, $tpc_author, $winduid, $windid, $db, $pwPostHide;
    static $ifview = null;
    if (!isset($ifview)) {
        if ($windid && $tpc_author == $windid) {
            $ifview = 2;
        } elseif ($pwPostHide) {
            $ifview = 3;
        } elseif ($admincheck) {
            $ifview = 4;
        } else {
            $pw_posts = GetPtable($GLOBALS['ptable']);
            $rs = $db->get_one("SELECT count(*) AS count FROM {$pw_posts} WHERE tid=" . pwEscape($tid) . " AND authorid=" . pwEscape($winduid));
            $ifview = $rs['count'] > 0 ? 1 : 0;
        }
    }
    return $ifview;
}
Beispiel #23
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']);
}
Beispiel #24
0
         } else {
             $montime = PwStrtoTime(get_date($timestamp, 'Y-m') . '-1');
             $sql = "SELECT m.uid,m.username,m.icon as face FROM pw_memberdata md LEFT JOIN pw_members m USING(uid) WHERE md.lastpost>" . pwEscape($montime) . " AND md.postnum>0 ORDER BY md.monthpost DESC " . pwLimit(6);
         }
         $query = $db->query($sql);
         while ($rt = $db->fetch_array($query)) {
             list($rt['face']) = showfacedesign($rt['face'], '1', 'm');
             $mosort[] = $rt;
         }
         $mosort['time'] = $timestamp;
         writeover(D_P . 'data/bbscache/mode_o_mosort.php', "<?php\r\n\$mosort=" . pw_var_export($mosort) . ";\r\n?>");
     }
     $ifmosortcache = 1;
     unset($mosort['time']);
 }
 $lastposttable = GetPtable($db_ptable);
 #'pw_posts'.$db_ptable;
 //经常回复我帖子的用户
 $query = $db->query("SELECT tid FROM pw_threads WHERE authorid=" . pwEscape($winduid) . " ORDER BY RAND() LIMIT 10");
 while ($rt = $db->fetch_array($query)) {
     $tiddb[] = $rt['tid'];
 }
 if (isset($tiddb) && count($tiddb) > 0) {
     $query = $db->query("SELECT COUNT(*) AS count,p.authorid as uid,m.username,m.icon as face FROM {$lastposttable} p LEFT JOIN pw_members m ON p.authorid=m.uid WHERE p.tid IN(" . pwImplode($tiddb) . ") AND p.authorid!=" . pwEscape($winduid) . " GROUP BY p.authorid ORDER BY count DESC LIMIT 9");
     while ($rt = $db->fetch_array($query)) {
         if (in_array($rt['uid'], $friendkeys)) {
             continue;
         }
         list($rt['face']) = showfacedesign($rt['face'], '1', 'm');
         $reply_to_me_users[] = $rt;
     }
Beispiel #25
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;
 }
 function _postReply($id, $postAudit, $expand)
 {
     if (!isset($expand['tid']) || $expand['tid'] < 1) {
         return false;
     }
     $postVerifyService = $this->getPostVerifyService();
     $postVerifyService->insertPostVerify(2, $expand['tid'], $id);
     $postTable = GetPtable('N', $expand['tid']);
     return $GLOBALS['db']->query("UPDATE " . CLOUDWIND_SECURITY_SERVICE::sqlMetadata($postTable) . " SET ifshield=1 WHERE pid=" . CLOUDWIND_SECURITY_SERVICE::sqlEscape($id));
 }
Beispiel #27
0
     $forumset = unserialize($rs['forumset']);
 } else {
     $forumset = array();
 }
 L::loadClass('rss', 'utility', false);
 $title = decodeRssHtml($rs['subject']);
 $title = xmlEscape($title);
 if ($db_htmifopen) {
     $link = "{$db_bbsurl}/read{$db_dir}tid-{$tid}{$db_ext}";
 } else {
     $link = "{$db_bbsurl}/read.php?tid={$tid}";
 }
 $channel = array('title' => $title, 'link' => $link, 'description' => "最新回复", 'copyright' => "Copyright(C) {$db_bbsname}", 'generator' => "http://www.phpwind.com", 'lastBuildDate' => date('r'), 'ttl' => $ttl, 'pubDate' => date('r', $rs['lastpost']));
 $Rss = new Rss(array('xml' => "1.0", 'rss' => "2.0", 'encoding' => $db_charset));
 $Rss->channel($channel);
 $pw_posts = GetPtable($rs['ptable']);
 $query = $db->query("SELECT aid,ifhide,pid,tid,subject,aid,author,postdate,anonymous,content \n\t\t\t\t\t\tFROM {$pw_posts} \n\t\t\t\t\t\tWHERE tid=" . pwEscape($tid) . " AND ifshield=0\n\t\t\t\t\t\tORDER BY postdate DESC LIMIT {$Rss_listnum}");
 while ($rt = $db->fetch_array($query)) {
     $rt['anonymous'] && ($rt['author'] = $db_anonymousname);
     $link = "{$db_bbsurl}/job.php?action=topost&tid={$rt['tid']}&pid={$rt['pid']}";
     $postTitle = decodeRssHtml($rt['subject']);
     $postTitle = xmlEscape($postTitle);
     $allow = is_array($db_windpost) ? $db_windpost : array();
     $allow['flash'] = 0;
     $allow['mpeg'] = 0;
     $allow['checkurl'] = 0;
     $description = $rt['content'];
     $pid = $rt['pid'];
     $attachShow = new attachShow(false, isset($forumset['uploadset']) ? $forumset['uploadset'] : '', isset($forumset['viewpic']) ? $forumset['viewpic'] : 0);
     $attachShow->init($rt['tid'], array($pid));
     if ($rt['aid']) {
Beispiel #28
0
    $J_sql = "LEFT JOIN {$pw_tmsgs} tm ON t.tid=tm.tid";
}
$read = $db->get_one("SELECT t.*,m.uid,m.groupid,m.userstatus {$S_sql} FROM pw_threads t LEFT JOIN pw_members m ON t.authorid=m.uid {$J_sql} WHERE t.tid=" . S::sqlEscape($tid));
!$read && Showmsg('illegal_tid');
$fid = $read['fid'];
if (!($foruminfo = L::forum($fid))) {
    Showmsg('data_error');
}
wind_forumcheck($foruminfo);
if (!$foruminfo['allowvisit'] && $_G['allowread'] == 0 && $_COOKIE) {
    Showmsg('read_group_right');
}
$subject = $read['subject'];
$forumname = strip_tags($foruminfo['name']);
$forumset = $foruminfo['forumset'];
$pw_posts = GetPtable($read['ptable']);
$openIndex = getstatus($read['tpcstatus'], 2);
#是否开启高楼索引
if ($forumset['link']) {
    ObHeader(str_replace("&amp;", "&", $forumset['link']));
}
//SEO setting
$_summary = strip_tags(stripWindCode($read['content']));
$_summary = str_replace(array('"', "\n", "\r", '&nbsp;', '&amp;', '&lt;', '', '&#160;'), '', $_summary);
$_summary = substrs($_summary, 255);
if ($ifConvert) {
    $wordsfb = L::loadClass('FilterUtil', 'filter');
    $_summary = $wordsfb->convert($_summary);
}
bbsSeoSettings('read', '', $foruminfo['name'], $read['type'], $read['subject'], $read['tags'], $_summary);
//SEO setting
Beispiel #29
0
    }
    $db_metakeyword = str_replace(array('|', ' - '), ',', $forumtitle) . 'phpwind';
    $db_metadescrip = substrs(strip_tags(str_replace('"', '&quot;', $atc_content)), 50);
    require_once R_P . 'require/header.php';
    $msg_guide = $pwforum->headguide($guidename);
    require_once PrintEot('post');
    footer();
} elseif ($_POST['step'] == 1) {
    if (!$pwpost->isGM) {
        if ($winduid != $atcdb['authorid'] && !pwRights($pwpost->isBM, 'modother')) {
            Showmsg('modify_del_right');
        } elseif ($_G['allowdelatc'] == 0) {
            Showmsg('modify_group_right');
        }
    }
    $pw_posts = GetPtable('N', $tid);
    $rt = $db->get_one("SELECT COUNT(*) AS count FROM {$pw_posts} WHERE tid=" . pwEscape($tid) . " AND ifcheck='1'");
    $count = $rt['count'] + 1;
    if ($article == 0 && !$admincheck && $count > 1) {
        Showmsg('modify_replied');
    }
    $rs = $db->get_one("SELECT replies,topped,tpcstatus FROM pw_threads WHERE tid=" . pwEscape($tid));
    $thread_tpcstatus = $rs['tpcstatus'];
    if ($rs['replies'] != $rt['count']) {
        $db->update("UPDATE pw_threads SET replies=" . pwEscape($rt['count']) . "WHERE tid=" . pwEscape($tid));
    }
    require_once R_P . 'require/credit.php';
    $creditset = $credit->creditset($creditset, $db_creditset);
    if ($atcdb['aid']) {
        require_once R_P . 'require/updateforum.php';
        delete_att($atcdb['aid']);
Beispiel #30
0
 //* $threadManager->deleteByThreadId($fromdb['fid'], $fromdb['tid']);
 $threadService = L::loadclass('threads', 'forum');
 $threadService->deleteByThreadId($fromdb['tid']);
 Perf::gatherInfo('changeThreadWithForumIds', array('fid' => $fromdb['fid']));
 $pw_tmsgsf = GetTtable($fromdb['tid']);
 //* $db->update("DELETE FROM $pw_tmsgsf WHERE tid=" . S::sqlEscape($fromdb['tid']));
 pwQuery::delete($pw_tmsgsf, 'tid=:tid', array($fromdb['tid']));
 if ($db_guestread) {
     require_once R_P . 'require/guestfunc.php';
     clearguestcache($fromdb['tid'], $replies);
 }
 if ($todb['ptable'] == $fromdb['ptable']) {
     //$db->update("UPDATE $pw_posts SET tid=" . S::sqlEscape($totid) . ' WHERE tid=' . S::sqlEscape($fromdb['tid']));
     pwQuery::update($pw_posts, 'tid=:tid', array($fromdb['tid']), array('tid' => $totid));
 } else {
     $pw_postsf = GetPtable($fromdb['ptable']);
     $db->update("INSERT INTO {$pw_posts} SELECT * FROM {$pw_postsf} WHERE tid=" . S::sqlEscape($fromdb['tid']));
     //$db->update("UPDATE $pw_posts SET tid=" . S::sqlEscape($totid) . " WHERE tid=" . S::sqlEscape($fromdb['tid']));
     pwQuery::update($pw_posts, 'tid=:tid', array($fromdb['tid']), array('tid' => $totid));
     //$db->update("DELETE FROM $pw_postsf WHERE tid=" . S::sqlEscape($fromdb['tid']));
     pwQuery::delete($pw_postsf, 'tid=:tid', array($fromdb['tid']));
 }
 if ($fromdb['aid']) {
     $pw_attachs->updateByTid($fromdb['tid'], 0, array('pid' => $pid, 'tid' => $totid));
 }
 $pw_attachs->updateByTid($fromdb['tid'], array('tid' => $totid));
 if ($ifmsg) {
     $msgdb[] = array('toUser' => $fromdb['author'], 'title' => getLangInfo('writemsg', 'unite_title', array('manager' => $windid)), 'content' => getLangInfo('writemsg', 'unite_content', array('manager' => $windid, 'fid' => $fid, 'tid' => $totid, 'subject' => $todb['subject'], 'postdate' => get_date($todb['postdate']), 'forum' => strip_tags($forum[$fid]['name']), 'admindate' => get_date($timestamp), 'reason' => stripslashes($atc_content))));
 }
 $log = array('type' => 'unite', 'username1' => $fromdb['author'], 'username2' => $windid, 'field1' => $fid, 'field2' => '', 'field3' => '', 'descrip' => 'unite_descrip', 'timestamp' => $timestamp, 'ip' => $onlineip, 'tid' => $totid, 'subject' => substrs($todb['subject'], 28), 'forum' => $forum[$fid]['name'], 'reason' => stripslashes($atc_content));
 writelog($log);