Beispiel #1
0
 function topicPost($tid, $postdata)
 {
     global $timestamp, $winduid, $windid;
     if (!$this->info) {
         return false;
     }
     $this->_db->update("INSERT INTO pw_argument SET " . S::sqlSingle(array('tid' => $tid, 'cyid' => $this->info['id'], 'postdate' => $timestamp, 'lastpost' => $timestamp)));
     if ($postdata['ifcheck'] > 0) {
         require_once R_P . 'u/require/core.php';
         //tnum加一
         //* $this->_db->update("UPDATE pw_colonys SET tnum=tnum+'1',pnum=pnum+'1',todaypost=todaypost+'1' WHERE id=" . S::sqlEscape($this->cyid));
         $this->_db->update(pwQuery::buildClause("UPDATE :pw_table SET tnum=tnum+1,pnum=pnum+1,todaypost=todaypost+1 WHERE id=:id", array('pw_colonys', $this->cyid)));
         $this->info['tnum']++;
         $this->info['pnum']++;
         updateGroupLevel($this->cyid, $this->info);
         if ($this->info['ifopen']) {
             $weiboService = L::loadClass('weibo', 'sns');
             /* @var $weiboService PW_Weibo */
             $weiboContent = substrs(stripWindCode($postdata['content']), 125);
             $weiboExtra = array('cyid' => $this->cyid, 'title' => stripslashes($postdata['title']), 'cname' => $this->info['cname']);
             $weiboService->send($winduid, $weiboContent, 'group_article', $tid, $weiboExtra);
         }
     }
     //更新群成员表里面的最后发言时间
     $this->_db->update("UPDATE pw_cmembers SET lastpost=" . S::sqlEscape($timestamp) . " WHERE uid=" . S::sqlEscape($winduid));
 }
 function getSourceData($sourceId)
 {
     $data = $this->_getDiaryData($sourceId);
     if (!$data) {
         return array();
     }
     $data['descrip'] = substrs(stripWindCode($data['content']), 100);
     $data['frominfo'] = 'хуж╬';
     $data['author'] = $data['username'];
     return $data;
 }
 function getSourceData($sourceId)
 {
     $data = $this->_getThreadData($sourceId);
     if (!$data || $this->_checkIfDelete($data)) {
         return array();
     }
     $data['content'] = preg_replace("/\\[attachment=[0-9]+\\]/is", '', $data['content']);
     $data['descrip'] = substrs(stripWindCode($data['content']), 100);
     $data['frominfo'] = 'ÂÛ̳';
     return $data;
 }
Beispiel #4
0
 function _cookData($data)
 {
     global $db_bbsurl;
     $data['url'] = $db_bbsurl . '/apps.php?q=group&cyid=' . $data['id'];
     $data['title'] = $data['cname'];
     $data['image'] = $this->_getGroupImage($data['cnimg']);
     $data['descrip'] = substrs(strip_tags(stripWindCode($data['descrip'])), 100);
     if ($data['credit']) {
         $data['credit'] = (int) $data['credit'];
     }
     return $data;
 }
Beispiel #5
0
 /**
  * @param $_summary the $_summary to set
  */
 function set_summary($_summary, $convert)
 {
     if ($_summary) {
         $_summary = stripWindCode($_summary);
         $_summary = strip_tags($_summary);
         $_summary = str_replace(array('"', "\n", "\r", ' ', '&', '<', '', ' '), '', $_summary);
         $_summary = substrs($_summary, 255);
         if ($convert) {
             $wordsfb = L::loadClass('FilterUtil');
             $_summary = $wordsfb->convert($_summary);
         }
         $this->_summary = trim($_summary);
     }
 }
Beispiel #6
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);
}
Beispiel #7
0
 /**
  * 有条件处理日志内容和标题
  *
  * @param array() 	$data		日志数据
  * @param bool 		$islist		是否是列表,列表页日志内容显示字节
  */
 function _getContentANDSubjectByDiary($data, $islist = false, $isFilterFace = false)
 {
     global $groupid, $db_shield, $db_windpost, $o_shownum;
     $result = array();
     if ($data['groupid'] == 6 && $db_shield && $groupid != 3) {
         $data['subject'] = '';
         $data['content'] = appShield('ban_diary');
     }
     $wordsService = $this->_serviceFactory('FilterUtil', 'filter');
     /* @var $wordsService PW_FilterUtil */
     if (!$wordsService->equal($data['ifwordsfb'])) {
         $data['content'] = $wordsService->convert($data['content'], array('id' => $data['did'], 'type' => 'diary', 'code' => $data['ifwordsfb']));
     }
     $isFilterFace == true && ($data['content'] = preg_replace("/\\[s:(.+?)\\]/eis", '', $data['content']));
     require_once R_P . 'require/bbscode.php';
     $data['ifconvert'] == 2 && ($data['content'] = convert($data['content'], $db_windpost));
     if ($islist) {
         $data['content'] = strip_tags($data['content']);
         $data['content'] = stripWindCode($this->escapeStr($data['content']));
         $o_shownum && ($data['content'] = substrs($data['content'], $o_shownum));
     }
     $data['content'] = preg_replace('/\\[upload=(\\d+)\\]/Ui', "", $data['content']);
     $data['content'] = str_replace("\n", "<br />", $data['content']);
     $result = array($data['subject'], $data['content']);
     return $result;
 }
Beispiel #8
0
function wap_clscode($string)
{
    return stripWindCode($string);
}
Beispiel #9
0
}
if (!$admincheck && $foruminfo['forumsell']) {
    forum_sell($fid);
}
if ($read['ifcheck'] == 0 && !$isGM && $windid != $read['author'] && !pwRights($isBM, 'viewcheck')) {
    Showmsg('read_check');
}
if ($read['locked'] % 3 == 2 && !$isGM && !pwRights($isBM, 'viewclose')) {
    Showmsg('read_locked');
}
$db_metakeyword = substr($read['tags'], 0, strpos($read['tags'], "\t"));
$db_metakeyword = (empty($db_metakeyword) ? $subject : $db_metakeyword) . ',' . $forumtitle;
$db_metakeyword = trim(str_replace(array('|', ' - ', "\t", ' ', ',,,', ',,'), ',', $db_metakeyword), ',');
if ($groupid == 'guest' && !$read['ifshield'] && !isban($read, $fid)) {
    if ($read['ifconvert'] == 2) {
        $metadescrip = stripWindCode($read['content']);
        $metadescrip = strip_tags($metadescrip);
    } else {
        $metadescrip = strip_tags($read['content']);
    }
    $metadescrip = str_replace(array('"', "\n", "\r", '&nbsp;', '&amp;', '&lt;', '', '&#160;'), '', $metadescrip);
    $metadescrip = substrs($metadescrip, 255, false);
    if ($read['ifwordsfb'] != $db_wordsfb) {
        //$metadescrip = wordsfb($metadescrip,$read['ifwordsfb']);
        $wordsfb = L::loadClass('FilterUtil', 'filter');
        $metadescrip = $wordsfb->convert($metadescrip);
    }
    if (trim($metadescrip)) {
        $db_metadescrip = $metadescrip;
    }
    unset($metadescrip, $tmpAllow);
Beispiel #10
0
     $sqltab .= ' LEFT JOIN pw_cmembers cm ON c.id=cm.colonyid';
     $sqlsel .= ' AND cm.uid IN(' . S::sqlImplode($uids) . ')';
 }
 $total = $db->get_value("SELECT COUNT(DISTINCT c.id) AS sum FROM pw_colonys c {$sqltab} WHERE 1 {$sqlsel}");
 if ($total) {
     require_once R_P . 'require/bbscode.php';
     list($pages, $limit) = pwLimitPages($total, $page, "group.php?q=all" . ($members ? "&members={$members}" : '') . ($isFriends ? "&friends={$isFriends}" : '') . "&keyword=" . rawurlencode($keyword) . "&" . ($styleid ? "styleid=" . $styleid : "") . "&");
     $query = $db->query("SELECT DISTINCT c.* FROM pw_colonys c {$sqltab} WHERE 1 {$sqlsel} ORDER BY c.id DESC {$limit}");
     while ($rt = $db->fetch_array($query)) {
         if ($rt['cnimg']) {
             list($rt['cnimg']) = geturl("cn_img/{$rt['cnimg']}", 'lf');
         } else {
             $rt['cnimg'] = $GLOBALS['imgpath'] . '/g/groupnopic.gif';
         }
         $rt['cname'] = str_replace($keyword, '<font color="#FF0000">' . $keyword . '</font>', $rt['cname']);
         $rt['descrip'] = str_replace($keyword, '<font color="#FF0000">' . $keyword . '</font>', stripWindCode($rt['descrip']));
         $rt['colonyNums'] = PwColony::calculateCredit($rt);
         $rt['createtime'] = get_date($rt['createtime'], 'Y-m-d');
         $group[$rt['id']] = $rt;
     }
 }
 $colonyids = S::sqlImplode(array_keys($group));
 if ($colonyids) {
     $query = $db->query("SELECT id,ifadmin,colonyid FROM pw_cmembers WHERE colonyid IN ({$colonyids}) AND uid=" . S::sqlEscape($winduid, false));
     while ($rt = $db->fetch_array($query)) {
         $cMembers[$rt['colonyid']] = $rt['ifadmin'];
     }
 }
 $u = $winduid;
 $username = $windid;
 /*
Beispiel #11
0
         }
         $description = "Latest {$Rss_newnum} article of all forums";
         if ($fids) {
             $sql = "WHERE fid IN({$fids}) AND ifcheck=1 AND topped='0' AND postdate>" . pwEscape($timestamp - 604800) . " ORDER BY postdate DESC LIMIT {$Rss_newnum}";
             $forceindex = 'FORCE INDEX (postdate)';
         }
     }
     $channel = array('title' => $db_bbsname, 'link' => $db_bbsurl, 'description' => $description, 'copyright' => "Copyright(C) {$db_bbsname}", 'generator' => "PHPWind Forums by PHPWind Studio", 'lastBuildDate' => date('r'));
     $image = array('url' => "{$imgpath}/{$stylepath}/rss.gif", 'title' => 'PHPWind Board', 'link' => $db_bbsurl, 'description' => $db_bbsname);
     $Rss = new Rss(array('xml' => "1.0", 'rss' => "2.0", 'encoding' => $db_charset));
     $Rss->channel($channel);
     $Rss->image($image);
     if ($sql) {
         $query = $db->query("SELECT t.tid,t.fid,t.subject,t.author,t.postdate,t.anonymous,tm.content FROM pw_threads t {$forceindex} RIGHT JOIN {$pw_tmsgs} tm ON tm.tid=t.tid {$sql}");
         while ($rt = $db->fetch_array($query)) {
             $rt['content'] = substrs(stripWindCode($rt['content']), 300);
             $rt['anonymous'] && ($rt['author'] = $db_anonymousname);
             if ($db_htmifopen) {
                 $link = "{$db_bbsurl}/read{$db_dir}tid-{$rt['tid']}{$db_ext}";
             } else {
                 $link = "{$db_bbsurl}/read.php?tid={$rt['tid']}";
             }
             $item = array('title' => $rt['subject'], 'description' => $rt['content'], 'link' => $link, 'author' => $rt['author'], 'category' => $forum[$rt['fid']]['name'], 'pubdate' => date('r', $rt['postdate']));
             $Rss->item($item);
         }
     }
     $Rss->generate($cache_path);
 }
 header("Content-type: application/xml");
 @readfile($cache_path);
 exit;
Beispiel #12
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();
 }
Beispiel #13
0
 function _buildGroups($groups, $keywords)
 {
     if (!$groups) {
         return array();
     }
     $result = array();
     $keywords = $keywords ? explode(",", $keywords) : array();
     foreach ($groups as $group) {
         $group['id'] = $group['id'];
         $group['createtime'] = get_date($group['createtime'], "Y-m-d H:i");
         $group['descrip'] = substrs(stripWindCode(strip_tags($group['descrip'])), 100);
         $group['credit'] = $this->_calculateCredit($group);
         $group['sname'] = $group['sname'] ? $group['sname'] : '末分类';
         foreach ($keywords as $keyword) {
             $keyword && ($group['cname'] = $this->_highlighting($keyword, $group['cname']));
             $keyword && ($group['descrip'] = $this->_highlighting($keyword, $group['descrip']));
         }
         if ($group['cnimg']) {
             list($group['cnimg']) = geturl("cn_img/" . $group['cnimg'], 'lf');
         } else {
             $group['cnimg'] = "images/search/group.png";
         }
         $result[] = $group;
     }
     return $result;
 }
Beispiel #14
0
     $uids = $friends ? array_keys($friends) : array(0);
     $sqltab .= ' LEFT JOIN pw_cmembers cm ON c.id=cm.colonyid';
     $sqlsel .= ' AND cm.uid IN(' . S::sqlImplode($uids) . ')';
 }
 $total = $db->get_value("SELECT COUNT(DISTINCT c.id) AS sum FROM pw_colonys c {$sqltab} WHERE 1 {$sqlsel}");
 if ($total) {
     require_once R_P . 'require/bbscode.php';
     list($pages, $limit) = pwLimitPages($total, $page, "{$basename}a=all&keyword=" . rawurlencode($keyword) . "&" . ($styleid ? "styleid=" . $styleid : "") . "&");
     $query = $db->query("SELECT DISTINCT c.* FROM pw_colonys c {$sqltab} WHERE 1 {$sqlsel} ORDER BY c.id DESC {$limit}");
     while ($rt = $db->fetch_array($query)) {
         if ($rt['cnimg']) {
             list($rt['cnimg']) = geturl("cn_img/{$rt['cnimg']}", 'lf');
         } else {
             $rt['cnimg'] = $GLOBALS['imgpath'] . '/g/groupnopic.gif';
         }
         $rt['descrip'] = stripWindCode($rt['descrip']);
         $rt['colonyNums'] = PwColony::calculateCredit($rt);
         $rt['createtime'] = get_date($rt['createtime'], 'Y-m-d');
         $group[$rt['id']] = $rt;
     }
 }
 $colonyids = S::sqlImplode(array_keys($group));
 if ($colonyids) {
     $query = $db->query("SELECT id,ifadmin,colonyid FROM pw_cmembers WHERE colonyid IN ({$colonyids}) AND uid=" . S::sqlEscape($winduid, false));
     while ($rt = $db->fetch_array($query)) {
         $cMembers[$rt['colonyid']] = $rt['ifadmin'];
     }
 }
 $u = $winduid;
 $username = $windid;
 /*
 function getLatestImgThread($fids, $offset, $limit)
 {
     list($fids, $offset, $limit) = array($fids ? explode(',', $fids) : array(), intval($offset), intval($limit));
     global $attachpath;
     $tmpData = $result['threads'] = $tmpThreadInfos = array();
     $sqlLimit = $offset > 0 ? ' AND tid < ' . intval($offset) : '';
     $fidLimit = S::isArray($fids) ? ' AND fid IN (' . S::sqlImplode($fids) . ') ' : '';
     $result['count'] = intval($GLOBALS['db']->get_value("SELECT COUNT(distinct tid) as count FROM pw_attachs WHERE `pid`=0 AND `did`=0 AND `type`='img' {$fidLimit}"));
     if ($result['count'] > 0) {
         $query = $GLOBALS['db']->query("SELECT tid,attachurl,ifthumb,count(attachurl) as count FROM pw_attachs WHERE `pid`=0 AND `did`=0 AND `type`='img' {$sqlLimit} {$fidLimit} GROUP BY tid ORDER BY uploadtime DESC LIMIT " . intval($limit));
         while ($rt = $GLOBALS['db']->fetch_array($query)) {
             $rt['tid'] > 0 && ($tmpData[$rt['tid']]['picurl'] = current($this->getCustomizedCommonService()->getAttachWithThumblist(array($rt))));
             $rt['tid'] > 0 && ($tmpData[$rt['tid']]['piccount'] = $rt['count']);
         }
     }
     if (count($tmpData) > 0) {
         $tmpThreadInfos = $this->getThreadsByTids(array_filter(array_unique(array_keys($tmpData))));
         foreach ($tmpData as $tid => $value) {
             $tmpResult = isset($tmpThreadInfos[$tid]) ? $tmpThreadInfos[$tid] : array();
             if (isset($tmpResult['content'])) {
                 $tmpResult['content'] = preg_replace('|\\[attachment=\\d+\\]|i', '', $tmpResult['content']);
                 $tmpResult['content'] = strip_tags(stripWindCode($tmpResult['content']));
             }
             $tmpData[$tid] = array_merge($value, $tmpResult);
         }
     }
     $result['threads'] = $tmpData;
     return $this->buildResponse(0, $result);
 }
Beispiel #16
0
             $rt['image'] = $temp['photo']['image'];
             $temp_uid = $temp['photo']['uid'];
             $rt['title'] = $belong . "<a href=\"u.php?uid={$temp_uid}\" target=\"_blank\">" . $temp['photo']['username'] . "</a>";
         } elseif ($rt['type'] == 'album') {
             $belong = getLangInfo('app', 'photo_belong');
             $rt['image'] = $temp['album']['image'];
             $temp_uid = $temp['album']['uid'];
             $rt['title'] = $belong . "<a href=\"u.php?uid={$temp_uid}\" target=\"_blank\">" . $temp['album']['username'] . "</a>";
         } elseif ($rt['type'] == 'group') {
             $rt['image'] = $temp['group']['image'];
             $rt['title'] = "<a href=\"{$rt['link']}\" target=\"_blank\">" . $temp['group']['name'] . "</a>";
         } elseif ($rt['type'] == 'diary') {
             $rt['title'] = "<a href=\"{$rt['link']}\" target=\"_blank\">" . $temp['diary']['subject'] . "</a>";
         } elseif ($rt['type'] == 'topic') {
             $rt['title'] = "<a href=\"{$rt['link']}\" target=\"_blank\">" . $temp['topic']['subject'] . "</a>";
             $rt['abstract'] = stripWindCode($temp['topic']['abstract']);
             $rt['imgs'] = unserialize($temp['topic']['imgs']);
         } else {
             $rt['title'] = "<a href=\"{$rt['link']}\" target=\"_blank\">" . substrs($rt['link'], 40) . "</a>";
         }
         $rt['descrip'] = $temp['descrip'];
         if ($rt['ifhidden']) {
             $rt['type_name'] = getLangInfo('app', $rt['type'] . '_self');
         } else {
             $rt['type_name'] = getLangInfo('app', $rt['type']);
         }
         list($rt['icon']) = showfacedesign($rt['icon'], 1);
         unset($rt['content']);
         $shares[] = $rt;
     }
 }
 /**
  * new reply update
  *
  * @param int $tid
  * @param int $fid
  * @param string $postdate
  * @return
  */
 function newPicUpdate($aid, $fid, $tid, $addition, $ifthumb = 0, $atc_content)
 {
     if (!($this->ifcache & 512)) {
         return false;
     }
     $ifthumb = (int) $ifthumb;
     $atc_content = substrs(stripWindCode($atc_content), 30);
     $additions = array('0' => $addition, '1' => $atc_content);
     $addition = addslashes(serialize($additions));
     $this->updatelist[] = array('newpic', $fid, $tid, $aid, $addition, $ifthumb);
     $this->updatetype['newpic'] = 1;
     return true;
 }
Beispiel #18
0
 $db->update("UPDATE pw_diarytype SET num=num+1 WHERE uid=" . S::sqlEscape($winduid) . " AND dtid=" . S::sqlEscape($dtid));
 //更新分类日志数
 if ($aids) {
     $diaryService = L::loadClass('Diary', 'diary');
     $diaryService->updateDiaryContentByAttach($did, $attachIds);
     $db->update("UPDATE pw_attachs SET did=" . S::sqlEscape($did) . " WHERE aid IN(" . S::sqlImplode($aids) . ")");
     $pwInfoSQL = array('uploadtime' => $winddb['uploadtime'], 'uploadnum' => $winddb['uploadnum']);
 }
 if (!$privacy && !$myAppsData['index_privacy'] && !$myAppsData['diary_privacy']) {
     $userCache = L::loadClass('Usercache', 'user');
     $userCache->delete($winduid, 'carddiary');
     updateDatanalyse($did, 'diaryNew', $timestamp);
     if ($sendWeiboPrivacy && $ifsendweibo) {
         $weiboService = L::loadClass('weibo', 'sns');
         /* @var $weiboService PW_Weibo */
         $atc_content = substrs(stripWindCode($weiboService->escapeStr($atc_content)), 125);
         $weiboExtra = array('did' => $did, 'title' => stripslashes($atc_title));
         $weiboService->send($winduid, $atc_content, 'diary', $did, $weiboExtra);
     }
 }
 countPosts('+1');
 //积分变动
 require_once R_P . 'require/credit.php';
 $o_diary_creditset = unserialize($o_diary_creditset);
 $creditset = getCreditset($o_diary_creditset['Post']);
 $creditset = array_diff($creditset, array(0));
 if (!empty($creditset)) {
     $credit->sets($winduid, $creditset, true);
     updateMemberid($winduid);
 }
 if ($creditlog = unserialize($o_diary_creditlog)) {
Beispiel #19
0
 $db->update("INSERT INTO pw_diary SET {$pwSQL}");
 $did = $db->insert_id();
 $db->update("UPDATE pw_diarytype SET num=num+1 WHERE uid=" . pwEscape($winduid) . " AND dtid=" . pwEscape($dtid));
 //更新分类日志数
 if ($aids) {
     $db->update("UPDATE pw_attachs SET did=" . pwEscape($did) . " WHERE aid IN({$aids})");
 }
 if ($privacy != 2) {
     pwAddFeed($winduid, 'diary', $did, array('lang' => 'diary_data', 'username' => $windid, 'uid' => $winduid, 'did' => $did, 'subject' => $atc_title));
 }
 countPosts('+1');
 if (!$privacy) {
     //会员资讯缓存
     $usercachedata = array();
     $usercache = L::loadDB('Usercache');
     $usercachedata['content'] = substrs(stripWindCode($atc_content), 100, N);
     $usercachedata['subject'] = $atc_title;
     $usercachedata['postdate'] = $timestamp;
     if ($attachs) {
         foreach ($attachs as $value) {
             if ($value['type'] == 'img') {
                 $usercachedata['attimages'][] = array('attachurl' => $value['attachurl'], 'ifthumb' => $value['ifthumb']);
             }
         }
     }
     $usercache->update($winduid, 'diary', $did, $usercachedata);
 }
 //积分变动
 require_once R_P . 'require/credit.php';
 $o_diary_creditset = unserialize($o_diary_creditset);
 $creditset = getCreditset($o_diary_creditset['Post']);
Beispiel #20
0
    return;
}
// 站点是否绑定该类型
$weiboSiteBindService = L::loadClass('WeiboSiteBindService', 'sns/weibotoplatform/service');
if (!$weiboSiteBindService->isBind($type)) {
    return;
}
$db_bbsurl .= "/";
if ($tid) {
    // 取帖子内容
    //$threads = L::loadClass('Threads', 'forum');
    //$read = $threads->getByThreadId($tid);
    $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));
    if (!empty($read)) {
        $sinaWeiboContentTranslator = L::loadClass('SinaWeiboContentTranslator', 'sns/weibotoplatform/');
        $shareContent = $sinaWeiboContentTranslator->translate('article', array('content' => preg_replace(array('/(&nbsp;){1,}/', '/( ){1,}/'), array(' ', ' '), substrs(stripWindCode(str_replace("\n", " ", strip_tags($read['content']))), 100)), 'objectid' => $tid), array('title' => $read['subject']));
        $title = urlencode(pwConvert($shareContent, 'UTF8', $db_charset));
        $query = $db->query("SELECT aid,attachurl,pid,type,ifthumb FROM pw_attachs WHERE pid=0 AND tid=" . S::sqlEscape($tid));
        $attachImg = '';
        while ($rt = $db->fetch_array($query)) {
            if ($rt['type'] != 'img') {
                continue;
            }
            $tmpUrl = geturl($rt['attachurl'], $rt['ifthumb']);
            if (is_array($tmpUrl)) {
                $attachImg[] = false !== strpos($tmpUrl[0], 'http://') ? $tmpUrl[0] : $db_bbsurl . $tmpUrl[0];
            }
        }
        $photoCount = count($attachImg);
    }
}
Beispiel #21
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);
}
Beispiel #22
0
 function adminSearch($usernames, $contents, $startDate, $endDate, $orderby = 'desc', $page = 1, $perpage = 20)
 {
     if ($usernames) {
         $usernames = is_array($usernames) ? $usernames : array($usernames);
     }
     $uids = array();
     if (is_array($usernames) && count($usernames) > 0) {
         $userService = L::loadClass('UserService', 'user');
         /* @var $userService PW_UserService */
         $users = $userService->getByUserNames($usernames);
         $uids = $this->_getFieldOfRecords($users, 'uid');
     }
     $startDate && !is_numeric($startDate) && ($startDate = PwStrtoTime($startDate));
     $endDate && !is_numeric($endDate) && ($endDate = PwStrtoTime($endDate));
     $type = intval($type);
     $commentDao = L::loadDB('weibo_comment', 'sns');
     $result = $commentDao->adminSearch($uids, $contents, $startDate, $endDate, $orderby, $page, $perpage);
     foreach ($result[1] as $key => $value) {
         $result[1][$key]['content'] = substr(stripWindCode($value['content']), 0, 30);
     }
     $weibos = $this->_buildData($result[1]);
     return array($result[0], $weibos);
 }
Beispiel #23
0
        $articleModule->setSourceType($cms_sourcetype);
        $articleModule->setSourceId($cms_sourceid);
        $articleModule->setRelate($cms_relate);
        $articleModule->showError();
        //解决因错误导致附件丢失问题
        $articleModule->setAttach($flashatt);
        $articleModule->showError();
        $result = $articleService->addArticle($articleModule);
        if ($result) {
            $jumpUrl = $addnewpage ? $basename . "q=post&action=edit&id=" . $result . "&page=add" : $basename . "q=view&id=" . $result;
            $columnService = C::loadClass('columnservice');
            /* @var $columnService PW_ColumnService */
            $cname = $columnService->getColumnNameByCIds($cid);
            $weiboService = L::loadClass('weibo', 'sns');
            /* @var $weiboService PW_Weibo */
            $weiboContent = substrs(stripWindCode($weiboService->escapeStr($articleModule->descrip)), 125);
            //	print_r ($weiboContent);exit;
            $weiboExtra = array('title' => stripslashes($cms_subject), 'cid' => $cid, 'cname' => $cname);
            $weiboService->send($winduid, $weiboContent, 'cms', $result, $weiboExtra);
            $msg = defined('AJAX') ? "success\t" . urlRewrite($jumpUrl) : '添加文章成功!';
            refreshto($jumpUrl, $msg);
        } else {
            Showmsg('添加文章失败');
        }
    }
} elseif ($action == 'edit') {
    S::gp(array('id', 'page'));
    $articleModule = $articleService->getArticleModule($id);
    $userid = $articleModule->userId;
    if (!checkEditPurview($windid, $articleModule->columnId) && $userid != $winduid) {
        Showmsg('你没有权限编辑本栏目的文章');
Beispiel #24
0
        }
        !$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');
    }
    require_once PrintEot('show');
    footer();
}
 function _filterWindCode()
 {
     return trim(str_replace(array($this->PAGECUT, '\\[s:[0-9]*\\]'), '', stripWindCode(strip_tags($this->content))), ' ');
 }
Beispiel #26
0
 function get_carddiary($uid, $num = 1)
 {
     $diaryServer = L::loadClass('Diary', 'diary');
     $array = $diaryServer->findUserDiarys($uid, 1, $num, null, array(0));
     if (empty($array)) {
         return array();
     }
     $array = array_shift($array);
     $rt = array('did' => $array['did'], 'uid' => $array['uid'], 'subject' => substrs(stripWindCode($array['subject']), 100, N), 'content' => substrs(stripWindCode($array['content']), 100, N), 'postdate_s' => get_date($array['postdate']));
     if ($array['aid']) {
         $atts = unserialize($array['aid']);
         $rt['attimages'] = array();
         $i = 0;
         foreach ($atts as $key => $val) {
             if ($val['type'] != 'img') {
                 continue;
             }
             $a_url = geturl('diary/' . $val['attachurl'], 'show', $val['ifthumb']);
             if ($a_url != 'nopic') {
                 $rt['attimages'][] = is_array($a_url) ? $a_url[0] : $a_url;
             }
             if (++$i > 3) {
                 break;
             }
         }
     }
     return $rt;
 }
Beispiel #27
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;
 }
Beispiel #28
0
 function afterpost()
 {
     global $db_ifpwcache, $timestamp;
     if ($this->data['ifcheck'] == 1) {
         if ($this->forum->foruminfo['allowhtm'] && !$this->forum->foruminfo['cms']) {
             $StaticPage = L::loadClass('StaticPage');
             $StaticPage->update($this->tid);
         }
         $lastpost = array('subject' => substrs($this->data['title'], 26), 'author' => $this->data['lastposter'], 'lastpost' => $timestamp, 'tid' => $this->tid, 't_date' => $timestamp);
         $this->forum->lastinfo('topic', '+', $lastpost);
         if ($this->forum->isOpen() && !$this->data['anonymous']) {
             pwAddFeed($this->post->uid, 'post', $this->tid, array('subject' => stripslashes($this->data['title']), 'tid' => $this->tid, 'fid' => $this->forum->fid));
             //会员资讯缓存
             $usercachedata = array();
             $usercache = L::loadDB('Usercache');
             $usercachedata['subject'] = substrs(stripWindCode($this->data['title']), 100, N);
             $usercachedata['content'] = substrs(stripWindCode($this->data['content']), 100, N);
             $usercachedata['postdate'] = $timestamp;
             if ($this->att) {
                 $usercachedata['attimages'] = $this->att->getImages(4);
             }
             $usercache->update($this->data['authorid'], 'topic', $this->tid, $usercachedata);
         }
         //Start elementupdate
         if ($db_ifpwcache & 128 || $db_ifpwcache & 512 && $this->att && $this->att->elementpic) {
             require_once R_P . 'lib/elementupdate.class.php';
             $elementupdate = new ElementUpdate($this->forum->fid);
             if ($db_ifpwcache & 128) {
                 $elementupdate->newSubjectUpdate($this->tid, $this->forum->fid, $timestamp, $this->data['special']);
             }
             if ($db_ifpwcache & 512 && $this->att && $this->att->elementpic) {
                 $elementupdate->newPicUpdate($this->att->elementpic['aid'], $this->forum->fid, $this->tid, $this->att->elementpic['attachurl'], $this->att->elementpic['ifthumb'], $this->data['content']);
             }
             $elementupdate->updateSQL();
         }
         updateDatanalyse($this->data['authorid'], 'memberThread', 1);
         //End elementupdate
     }
     if ($this->postdata->filter->filter_weight > 1) {
         $this->postdata->filter->insert($this->tid, 0, implode(',', $this->postdata->filter->filter_word), $this->postdata->filter->filter_weight);
     }
     if ($this->data['topped'] > 0) {
         require_once R_P . 'require/updateforum.php';
         setForumsTopped($this->tid, $this->data['fid'], $this->data['topped']);
         updatetop();
     }
 }
Beispiel #29
0
    $page = $numofpage;
}
$page == 1 && $read['aid'] && ($_pids['tpc'] = 0);
#附件 TODO 首页才读
//当前位置导航
list($guidename, $forumtitle) = getforumtitle(forumindex($foruminfo['fup'], 1), 1);
$forumtitle = '|' . $forumtitle;
/** Labs Code By cn0zz
if ($db_htmifopen) {
	$link_ref_canonical = ($_GET['fpage'] || $_GET['uid'] || $_GET['skinco']) ? "read{$db_dir}tid-$tid".($page>1 ? "-page-$page" : '').$db_ext : '';
} else {
	$link_ref_canonical = ($_GET['fpage'] || $_GET['uid'] || $_GET['skinco']) ? "read.php?tid=$tid".($page>1 ? "&page=$page" : '') : '';
}
*/
/*SEO*/
$_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'], $foruminfo['topictype'][$read['type']], $read['subject'], $read['tags'], $_summary);
/*SEO*/
require_once R_P . 'require/showimg.php';
Update_ol();
$readdb = $authorids = array();
//主题印戳
if ($forumset['overprint']) {
    $overPrintService = L::loadclass("overprint", 'forum');
    $overprint = $overPrintService->getOverPrintIcon($read['overprint']);
Beispiel #30
0
 /**
  * 随机取若干个群组
  * @param int $num 随机个数
  * return array 随机群组数组
  */
 function getRandColonys($num)
 {
     $query = $this->_db->query("SELECT id,cname,cnimg,descrip FROM pw_colonys ORDER BY RAND() LIMIT " . intval($num));
     while ($rt = $this->_db->fetch_array($query)) {
         $rt['cname'] = substrs($rt['cname'], 16);
         $rt['descrip'] = substrs(stripWindCode($rt['descrip']), 45);
         $rt['cnimg'] = $this->getColonyImg($rt['cnimg']);
         $colonys[] = $rt;
     }
     return $colonys;
 }