Example #1
0
    function __destruct()
    {
        //flush();  //个别web配置下会出错

        if (!empty($_GET['inajax'])) return;
        if (empty($_GET['action']) || 'newthread' !== $_GET['action']) return;
        if ('yes' !== $_GET['topicsubmit']) return;
        if ($_POST['formhash'] != FORMHASH) return;

        global $tid;
        if (empty($tid)) return;

        if (defined("_bds_w9x_{$tid}")) return;
        define("_bds_w9x_{$tid}", true);

        if (!baidu_get_plugin_setting('openping')) return;
        if (baidu_senddata_error()) return;

        //发新帖
        $thread = get_thread_by_tid($tid);
        if ($thread) {
            $url = baidu_gen_thread_url($tid, 1, 1, $thread['fid']);
            $schema = new BaiduThreadSchema();
            $schema->setThreadUrl($url);
            baidu_send_data($schema, 1);
        }
    }
Example #2
0
require_once libfile('function/blog');
$content['content'] = blog_bbcode($content['content']);
if (!empty($_G['setting']['makehtml']['flag']) && $article['htmlmade']) {
    $_caturl = $_G['cache']['portalcategory'][$cat['topid']]['domain'] ? $_G['cache']['portalcategory'][$cat['topid']]['caturl'] : '';
    $viewurl = $_caturl . $article['htmldir'] . $article['htmlname'] . '{page}.' . $_G['setting']['makehtml']['extendname'];
    unset($_caturl);
} else {
    $viewurl = "portal.php?mod=view&aid={$aid}";
}
$multi = multi($article['contents'], 1, $page, $viewurl);
$org = array();
if ($article['idtype'] == 'tid' || $content['idtype'] == 'pid') {
    $thread = $firstpost = array();
    require_once libfile('function/discuzcode');
    require_once libfile('function/forum');
    $thread = get_thread_by_tid($article[id]);
    if (!empty($thread)) {
        if ($content['idtype'] == 'pid') {
            $firstpost = C::t('forum_post')->fetch($thread['posttableid'], $content['id']);
        } else {
            $firstpost = C::t('forum_post')->fetch_threadpost_by_tid_invisible($article['id']);
        }
        if ($firstpost && $firstpost['tid'] == $article['id']) {
            $firstpost['uid'] = $firstpost['authorid'];
            $firstpost['username'] = $firstpost['author'];
        }
    }
    if (!empty($firstpost) && !empty($thread) && $thread['displayorder'] != -1) {
        $_G['tid'] = $article['id'];
        $aids = array();
        $firstpost['message'] = $content['content'];
Example #3
0
    dexit();
} elseif ($_GET['action'] == 'setthreadcover') {
    $aid = intval($_GET['aid']);
    $imgurl = $_GET['imgurl'];
    require_once libfile('function/post');
    if ($_G['forum'] && ($aid || $imgurl)) {
        if ($imgurl) {
            $tid = intval($_GET['tid']);
            $pid = intval($_GET['pid']);
        } else {
            $threadimage = C::t('forum_attachment_n')->fetch('aid:' . $aid, $aid);
            $tid = $threadimage['tid'];
            $pid = $threadimage['pid'];
        }
        if ($tid && $pid) {
            $thread = get_thread_by_tid($tid);
        } else {
            $thread = array();
        }
        if (empty($thread) || !$_G['forum']['ismoderator'] && $_G['uid'] != $thread['authorid']) {
            if ($_GET['newthread']) {
                showmessage('set_cover_faild', '', array(), array('msgtype' => 3));
            } else {
                showmessage('set_cover_faild', '', array(), array('closetime' => 3));
            }
        }
        if (setthreadcover($pid, $tid, $aid, 0, $imgurl)) {
            if (empty($imgurl)) {
                C::t('forum_threadimage')->delete_by_tid($threadimage['tid']);
                C::t('forum_threadimage')->insert(array('tid' => $threadimage['tid'], 'attachment' => $threadimage['attachment'], 'remote' => $threadimage['remote']));
            }
function loadforum($fid = null, $tid = null)
{
    global $_G;
    $tid = intval(isset($tid) ? $tid : getgpc('tid'));
    if (isset($fid)) {
        $fid = intval($fid);
    } else {
        $fid = getgpc('fid');
        if (!$fid && getgpc('gid')) {
            $fid = intval(getgpc('gid'));
        }
    }
    if (isset($_G['forum']['fid']) && $_G['forum']['fid'] == $fid || isset($_G['thread']['tid']) && $_G['thread']['tid'] == $tid) {
        return null;
    }
    if (!empty($_GET['archiver'])) {
        //X1.5的Archiver兼容
        if ($fid) {
            dheader('location: archiver/?fid-' . $fid . '.html');
        } elseif ($tid) {
            dheader('location: archiver/?tid-' . $tid . '.html');
        } else {
            dheader('location: archiver/');
        }
    }
    if (defined('IN_ARCHIVER') && $_G['setting']['archiverredirect'] && !IS_ROBOT) {
        dheader('location: ../forum.php' . ($_G['mod'] ? '?mod=' . $_G['mod'] . (!empty($_GET['fid']) ? '&fid=' . $_GET['fid'] : (!empty($_GET['tid']) ? '&tid=' . $_GET['tid'] : '')) : ''));
    }
    if ($_G['setting']['forumpicstyle']) {
        $_G['setting']['forumpicstyle'] = dunserialize($_G['setting']['forumpicstyle']);
        empty($_G['setting']['forumpicstyle']['thumbwidth']) && ($_G['setting']['forumpicstyle']['thumbwidth'] = 203);
        empty($_G['setting']['forumpicstyle']['thumbheight']) && ($_G['setting']['forumpicstyle']['thumbheight'] = 999);
    } else {
        $_G['setting']['forumpicstyle'] = array('thumbwidth' => 203, 'thumbheight' => 999);
    }
    if ($fid) {
        $fid = is_numeric($fid) ? intval($fid) : (!empty($_G['setting']['forumfids'][$fid]) ? $_G['setting']['forumfids'][$fid] : 0);
    }
    $modthreadkey = isset($_GET['modthreadkey']) && $_GET['modthreadkey'] == modauthkey($tid) ? $_GET['modthreadkey'] : '';
    $_G['forum_auditstatuson'] = $modthreadkey ? true : false;
    $metadescription = $hookscriptmessage = '';
    $adminid = $_G['adminid'];
    if (!empty($tid) || !empty($fid)) {
        if (!empty($tid)) {
            $archiveid = !empty($_GET['archiveid']) ? intval($_GET['archiveid']) : null;
            $_G['thread'] = get_thread_by_tid($tid, $archiveid);
            $_G['thread']['allreplies'] = $_G['thread']['replies'] + $_G['thread']['comments'];
            if (!$_G['forum_auditstatuson'] && !empty($_G['thread']) && !($_G['thread']['displayorder'] >= 0 || in_array($_G['thread']['displayorder'], array(-4, -3, -2)) && $_G['uid'] && $_G['thread']['authorid'] == $_G['uid'])) {
                $_G['thread'] = null;
            }
            $_G['forum_thread'] =& $_G['thread'];
            if (empty($_G['thread'])) {
                $fid = $tid = 0;
            } else {
                $fid = $_G['thread']['fid'];
                $tid = $_G['thread']['tid'];
            }
        }
        if ($fid) {
            $forum = C::t('forum_forum')->fetch_info_by_fid($fid);
        }
        if ($forum) {
            if ($_G['uid']) {
                if ($_G['member']['accessmasks']) {
                    $query = C::t('forum_access')->fetch_all_by_fid_uid($fid, $_G['uid']);
                    $forum['allowview'] = $query[0]['allowview'];
                    $forum['allowpost'] = $query[0]['allowpost'];
                    $forum['allowreply'] = $query[0]['allowreply'];
                    $forum['allowgetattach'] = $query[0]['allowgetattach'];
                    $forum['allowgetimage'] = $query[0]['allowgetimage'];
                    $forum['allowpostattach'] = $query[0]['allowpostattach'];
                    $forum['allowpostimage'] = $query[0]['allowpostimage'];
                }
                if ($adminid == 3) {
                    $forum['ismoderator'] = C::t('forum_moderator')->fetch_uid_by_fid_uid($fid, $_G['uid']);
                }
            }
            $forum['ismoderator'] = !empty($forum['ismoderator']) || $adminid == 1 || $adminid == 2 ? 1 : 0;
            $fid = $forum['fid'];
            $gorup_admingroupids = $_G['setting']['group_admingroupids'] ? dunserialize($_G['setting']['group_admingroupids']) : array('1' => '1');
            if ($forum['status'] == 3) {
                if (!empty($forum['moderators'])) {
                    $forum['moderators'] = dunserialize($forum['moderators']);
                } else {
                    require_once libfile('function/group');
                    $forum['moderators'] = update_groupmoderators($fid);
                }
                if ($_G['uid'] && $_G['adminid'] != 1) {
                    $forum['ismoderator'] = !empty($forum['moderators'][$_G['uid']]) ? 1 : 0;
                    $_G['adminid'] = 0;
                    if ($forum['ismoderator'] || $gorup_admingroupids[$_G['groupid']]) {
                        $_G['adminid'] = $_G['adminid'] ? $_G['adminid'] : 3;
                        if (!empty($gorup_admingroupids[$_G['groupid']])) {
                            $forum['ismoderator'] = 1;
                            $_G['adminid'] = 2;
                        }
                        $group_userperm = dunserialize($_G['setting']['group_userperm']);
                        if (is_array($group_userperm)) {
                            $_G['group'] = array_merge($_G['group'], $group_userperm);
                            $_G['group']['allowmovethread'] = $_G['group']['allowcopythread'] = $_G['group']['allowedittypethread'] = 0;
                        }
                    }
                }
            }
            foreach (array('threadtypes', 'threadsorts', 'creditspolicy', 'modrecommend') as $key) {
                $forum[$key] = !empty($forum[$key]) ? dunserialize($forum[$key]) : array();
                if (!is_array($forum[$key])) {
                    $forum[$key] = array();
                }
            }
            if ($forum['status'] == 3) {
                $_G['isgroupuser'] = 0;
                $_G['basescript'] = 'group';
                if ($forum['level'] == 0) {
                    $levelinfo = C::t('forum_grouplevel')->fetch_by_credits($forum['commoncredits']);
                    $levelid = $levelinfo['levelid'];
                    $forum['level'] = $levelid;
                    C::t('forum_forum')->update_group_level($levelid, $fid);
                }
                if ($forum['level'] != -1) {
                    loadcache('grouplevels');
                    $grouplevel = $_G['grouplevels'][$forum['level']];
                    if (!empty($grouplevel['icon'])) {
                        $valueparse = parse_url($grouplevel['icon']);
                        if (!isset($valueparse['host'])) {
                            $grouplevel['icon'] = $_G['setting']['attachurl'] . 'common/' . $grouplevel['icon'];
                        }
                    }
                }
                $group_postpolicy = $grouplevel['postpolicy'];
                if (is_array($group_postpolicy)) {
                    $forum = array_merge($forum, $group_postpolicy);
                }
                $forum['allowfeed'] = $_G['setting']['group_allowfeed'];
                if ($_G['uid']) {
                    if (!empty($forum['moderators'][$_G['uid']])) {
                        $_G['isgroupuser'] = 1;
                    } else {
                        $groupuserinfo = C::t('forum_groupuser')->fetch_userinfo($_G['uid'], $fid);
                        $_G['isgroupuser'] = $groupuserinfo['level'];
                        if ($_G['isgroupuser'] <= 0 && empty($forum['ismoderator'])) {
                            $_G['group']['allowrecommend'] = $_G['cache']['usergroup_' . $_G['groupid']]['allowrecommend'] = 0;
                            $_G['group']['allowcommentpost'] = $_G['cache']['usergroup_' . $_G['groupid']]['allowcommentpost'] = 0;
                            $_G['group']['allowcommentitem'] = $_G['cache']['usergroup_' . $_G['groupid']]['allowcommentitem'] = 0;
                            $_G['group']['raterange'] = $_G['cache']['usergroup_' . $_G['groupid']]['raterange'] = array();
                            $_G['group']['allowvote'] = $_G['cache']['usergroup_' . $_G['groupid']]['allowvote'] = 0;
                        } else {
                            $_G['isgroupuser'] = 1;
                        }
                    }
                }
            }
        } else {
            $fid = 0;
        }
    }
    $_G['fid'] = $fid;
    $_G['tid'] = $tid;
    $_G['forum'] =& $forum;
    $_G['current_grouplevel'] =& $grouplevel;
    if (empty($_G['uid'])) {
        $_G['group']['allowpostactivity'] = $_G['group']['allowpostpoll'] = $_G['group']['allowvote'] = $_G['group']['allowpostreward'] = $_G['group']['allowposttrade'] = $_G['group']['allowpostdebate'] = $_G['group']['allowpostrushreply'] = 0;
    }
    if (!empty($_G['forum']['widthauto'])) {
        $_G['widthauto'] = $_G['forum']['widthauto'];
    }
}
Example #5
0
function loadforum()
{
    global $_G;
    $tid = intval(getgpc('tid'));
    $fid = getgpc('fid');
    if (!$fid && getgpc('gid')) {
        $fid = intval(getgpc('gid'));
    }
    /*vot*/
    if (!empty($_G['gp_archiver'])) {
        //Archiver X1.5 compatible
        if ($fid) {
            dheader('location: archiver/?fid-' . $fid . '.html');
        } elseif ($tid) {
            dheader('location: archiver/?tid-' . $tid . '.html');
        } else {
            dheader('location: archiver/');
        }
    }
    if (defined('IN_ARCHIVER') && $_G['setting']['archiverredirect'] && !IS_ROBOT) {
        dheader('location: ../forum.php' . ($_G['mod'] ? '?mod=' . $_G['mod'] . (!empty($_GET['fid']) ? '&fid=' . $_GET['fid'] : (!empty($_GET['tid']) ? '&tid=' . $_GET['tid'] : '')) : ''));
    }
    if ($_G['setting']['forumpicstyle']) {
        $_G['setting']['forumpicstyle'] = unserialize($_G['setting']['forumpicstyle']);
        empty($_G['setting']['forumpicstyle']['thumbwidth']) && ($_G['setting']['forumpicstyle']['thumbwidth'] = 214);
        empty($_G['setting']['forumpicstyle']['thumbheight']) && ($_G['setting']['forumpicstyle']['thumbheight'] = 160);
    } else {
        $_G['setting']['forumpicstyle'] = array('thumbwidth' => 214, 'thumbheight' => 160);
    }
    if ($fid) {
        $fid = is_numeric($fid) ? intval($fid) : (!empty($_G['setting']['forumfids'][$fid]) ? $_G['setting']['forumfids'][$fid] : 0);
    }
    $modthreadkey = isset($_G['gp_modthreadkey']) && $_G['gp_modthreadkey'] == modauthkey($tid) ? $_G['gp_modthreadkey'] : '';
    $_G['forum_auditstatuson'] = $modthreadkey ? true : false;
    $accessadd1 = $accessadd2 = $modadd1 = $modadd2 = $metadescription = $hookscriptmessage = '';
    $adminid = $_G['adminid'];
    if ($_G['uid']) {
        if ($_G['member']['accessmasks']) {
            $accessadd1 = ', a.allowview, a.allowpost, a.allowreply, a.allowgetattach, a.allowgetimage, a.allowpostattach, a.allowpostimage';
            /*vot*/
            $accessadd2 = "LEFT JOIN " . DB::table('forum_access') . " a ON (a.uid='{$_G['uid']}' AND a.fid=f.fid)";
        }
        if ($adminid == 3) {
            $modadd1 = ', m.uid AS ismoderator';
            /*vot*/
            $modadd2 = "LEFT JOIN " . DB::table('forum_moderator') . " m ON (m.uid='{$_G['uid']}' AND m.fid=f.fid)";
        }
    }
    if (!empty($tid) || !empty($fid)) {
        if (!empty($tid)) {
            $archiveid = !empty($_G['gp_archiveid']) ? intval($_G['gp_archiveid']) : null;
            $_G['thread'] = get_thread_by_tid($tid, '*', '', $archiveid);
            if (!$_G['forum_auditstatuson'] && !empty($_G['thread']) && !($_G['thread']['displayorder'] >= 0 || in_array($_G['thread']['displayorder'], array(-4, -3, -2)) && $_G['thread']['authorid'] == $_G['uid'])) {
                $_G['thread'] = null;
            }
            $_G['forum_thread'] =& $_G['thread'];
            if (empty($_G['thread'])) {
                $fid = $tid = 0;
            } else {
                $fid = $_G['thread']['fid'];
                $tid = $_G['thread']['tid'];
            }
        }
        if ($fid) {
            $forum = DB::fetch_first("SELECT f.fid, f.*, ff.* {$accessadd1} {$modadd1}, f.fid AS fid\r\n\t\t\tFROM " . DB::table('forum_forum') . " f\r\n\t\t\tLEFT JOIN " . DB::table("forum_forumfield") . " ff ON ff.fid=f.fid {$accessadd2} {$modadd2}\r\n\t\t\tWHERE f.fid='{$fid}'");
        }
        if ($forum) {
            $forum['ismoderator'] = !empty($forum['ismoderator']) || $adminid == 1 || $adminid == 2 ? 1 : 0;
            $fid = $forum['fid'];
            $gorup_admingroupids = $_G['setting']['group_admingroupids'] ? unserialize($_G['setting']['group_admingroupids']) : array('1' => '1');
            if ($forum['status'] == 3) {
                if (!$_G['setting']['groupstatus']) {
                    showmessage('group_status_off');
                }
                if (!empty($forum['moderators'])) {
                    $forum['moderators'] = unserialize($forum['moderators']);
                } else {
                    require_once libfile('function/group');
                    $forum['moderators'] = update_groupmoderators($fid);
                }
                if ($_G['uid'] && $_G['adminid'] != 1) {
                    $forum['ismoderator'] = !empty($forum['moderators'][$_G['uid']]) ? 1 : 0;
                    $_G['adminid'] = 0;
                    if ($forum['ismoderator'] || $gorup_admingroupids[$_G['groupid']]) {
                        $_G['adminid'] = $_G['adminid'] ? $_G['adminid'] : 3;
                        if (!empty($gorup_admingroupids[$_G['groupid']])) {
                            $forum['ismoderator'] = 1;
                            $_G['adminid'] = 2;
                        }
                        $group_userperm = unserialize($_G['setting']['group_userperm']);
                        if (is_array($group_userperm)) {
                            $_G['group'] = array_merge($_G['group'], $group_userperm);
                            $_G['group']['allowmovethread'] = $_G['group']['allowcopythread'] = $_G['group']['allowedittypethread'] = 0;
                        }
                    }
                }
            }
            foreach (array('threadtypes', 'threadsorts', 'creditspolicy', 'modrecommend') as $key) {
                $forum[$key] = !empty($forum[$key]) ? unserialize($forum[$key]) : array();
                if (!is_array($forum[$key])) {
                    $forum[$key] = array();
                }
            }
            if ($forum['status'] == 3) {
                $_G['isgroupuser'] = 0;
                $_G['basescript'] = 'group';
                if (empty($forum['level'])) {
                    $levelid = DB::result_first("SELECT levelid FROM " . DB::table('forum_grouplevel') . " WHERE creditshigher<='{$forum['commoncredits']}' AND '{$forum['commoncredits']}'<creditslower LIMIT 1");
                    $forum['level'] = $levelid;
                    DB::query("UPDATE " . DB::table('forum_forum') . " SET level='{$levelid}' WHERE fid='{$fid}'");
                }
                loadcache('grouplevels');
                $grouplevel = $_G['grouplevels'][$forum['level']];
                if (!empty($grouplevel['icon'])) {
                    $valueparse = parse_url($grouplevel['icon']);
                    if (!isset($valueparse['host'])) {
                        $grouplevel['icon'] = $_G['setting']['attachurl'] . 'common/' . $grouplevel['icon'];
                    }
                }
                $group_postpolicy = $grouplevel['postpolicy'];
                if (is_array($group_postpolicy)) {
                    $forum = array_merge($forum, $group_postpolicy);
                }
                $forum['allowfeed'] = $_G['setting']['group_allowfeed'];
                if ($_G['uid']) {
                    if (!empty($forum['moderators'][$_G['uid']])) {
                        $_G['isgroupuser'] = 1;
                    } else {
                        $_G['isgroupuser'] = DB::result_first("SELECT level FROM " . DB::table('forum_groupuser') . " WHERE fid='{$fid}' AND uid='{$_G['uid']}' LIMIT 1");
                        if ($_G['isgroupuser'] <= 0 && empty($forum['ismoderator'])) {
                            $_G['group']['allowrecommend'] = $_G['cache']['usergroup_' . $_G['groupid']]['allowrecommend'] = 0;
                            $_G['group']['allowcommentpost'] = $_G['cache']['usergroup_' . $_G['groupid']]['allowcommentpost'] = 0;
                            $_G['group']['allowcommentitem'] = $_G['cache']['usergroup_' . $_G['groupid']]['allowcommentitem'] = 0;
                            $_G['group']['raterange'] = $_G['cache']['usergroup_' . $_G['groupid']]['raterange'] = array();
                            $_G['group']['allowvote'] = $_G['cache']['usergroup_' . $_G['groupid']]['allowvote'] = 0;
                        } else {
                            $_G['isgroupuser'] = 1;
                        }
                    }
                }
            }
        } else {
            $fid = 0;
        }
    }
    $_G['fid'] = $fid;
    $_G['tid'] = $tid;
    $_G['forum'] =& $forum;
    $_G['current_grouplevel'] =& $grouplevel;
    if (isset($_G['cookie']['widthauto']) && $_G['setting']['switchwidthauto'] && empty($_G['forum']['widthauto'])) {
        $_G['forum_widthauto'] = $_G['cookie']['widthauto'] > 0;
    } else {
        $_G['forum_widthauto'] = empty($_G['forum']['widthauto']) ? !$_G['setting']['allowwidthauto'] : $_G['forum']['widthauto'] > 0;
        if (!empty($_G['forum']['widthauto'])) {
            $_G['setting']['switchwidthauto'] = 0;
        }
    }
}
/**
 *      [Discuz!] (C)2001-2099 Comsenz Inc.
 *      This is NOT a freeware, use is subject to license terms
 *
 *      $Id: resourcepush.inc.php 34814 2014-08-07 01:46:48Z nemohou $
 */
if (!defined('IN_DISCUZ')) {
    exit('Access Denied');
}
if ($_G['adminid'] != 1) {
    showmessage('undefined_action');
}
require_once libfile('function/forum');
require_once libfile('function/post');
$thread = get_thread_by_tid($_GET['tid']);
if (!$thread) {
    showmessage('undefined_action');
}
$post = C::t('forum_post')->fetch_threadpost_by_tid_invisible($_GET['tid']);
if ($thread['cover']) {
    $picurl = getthreadcover($thread['tid'], $thread['cover']);
} else {
    $attach = C::t('forum_attachment_n')->fetch_all_by_id('tid:' . $_GET['tid'], 'pid', array($post['pid']), '', true);
    $picurl = '';
    if ($attach) {
        $attach = array_shift($attach);
        $picurl = ($attach['remote'] ? $_G['setting']['ftp']['attachurl'] : $_G['setting']['attachurl']) . 'forum/' . $attach['attachment'];
    }
}
$data = array('name' => lang('plugin/wechat', 'resource_thread_push') . ': ' . $thread['subject'], 'data' => array('title' => $thread['subject'], 'pic' => $picurl ? (preg_match('/^http:/', $picurl) ? '' : $_G['siteurl']) . $picurl : '', 'desc' => messagecutstr($post['message'], 0, 120), 'content' => nl2br(messagecutstr($post['message'])), 'url' => $_G['siteurl'] . 'forum.php?mod=viewthread&tid=' . $_GET['tid']));
Example #7
0
             } elseif ($result['idtype'] == 'blogid') {
                 $itemid = $result[itemid];
                 $blogidarray[$itemid] = $blogidarray[$itemid] == '' ? 'tag' : $blogidarray[$itemid];
                 $blogidarray[$itemid] = "(REPLACE({$blogidarray[$itemid]}, '{$result['tagid']},{$result['tagname']}\t', ''))";
             }
         }
         DB::query("DELETE FROM " . DB::table('common_tag') . " WHERE tagid IN (" . dimplode($tagidarray) . ")");
         $newid = DB::fetch_first("SELECT tagid FROM " . DB::table('common_tag') . " WHERE tagname='{$newtag}'");
         if (!$newid) {
             DB::query("INSERT INTO " . DB::table('common_tag') . " (tagname, status) VALUES ('{$newtag}', '0')");
             $newid = DB::insert_id();
         }
         DB::query("UPDATE " . DB::table('common_tagitem') . " SET tagid='{$newid}',tagname='{$newtag}' WHERE tagid IN (" . dimplode($tagidarray) . ")");
         if ($tidarray) {
             foreach ($tidarray as $key => $var) {
                 $thread = get_thread_by_tid($key);
                 DB::query("UPDATE " . DB::table($thread[posttable]) . " SET tags={$var} WHERE tid='{$key}' AND first=1");
                 DB::query("UPDATE " . DB::table($thread[posttable]) . " SET tags=concat(tags, '{$newid},{$newtag}\t') WHERE tid='{$key}' AND first=1");
             }
         }
         if ($blogidarray) {
             foreach ($blogidarray as $key => $var) {
                 DB::query("UPDATE " . DB::table('home_blogfield') . " SET tag={$var} WHERE blogid='{$key}'");
                 DB::query("UPDATE " . DB::table('home_blogfield') . " SET tag=concat(tag, '{$newid},{$newtag}\t') WHERE blogid='{$key}'");
             }
         }
     } else {
         cpmsg('tag_length');
     }
 }
 cpmsg('tag_admin_updated', 'action=tag&operation=admin&searchsubmit=yes&tagname=' . $_G['gp_tagname'] . '&perpage=' . $_G['gp_perpage'] . '&status=' . $_G['gp_status'] . '&page=' . $_G['gp_page'], 'succeed');
Example #8
0
function baidu_gen_thread_url($tid, $page, $prevpage, $fid = '')
{
    global $_G;
//是否启用伪静态
    if (is_array($_G['setting']['rewritestatus']) && in_array('forum_viewthread', $_G['setting']['rewritestatus'])) {
        $rule = $_G['setting']['rewriterule']['forum_viewthread'];
        if (!$fid && false !== strpos($rule, '{fid}')) {
            $thread = get_thread_by_tid($tid);
            $fid = $thread['fid'];
        }
        $url = $_G['siteurl'] . str_replace(
                        array('{tid}', '{page}', '{prevpage}', '{fid}'), array($tid, $page, $prevpage, $fid), $rule);
    } else {
        $url = $_G['siteurl'] . 'forum.php?mod=viewthread&tid=' . $tid;
    }
    return $url;
}
Example #9
0
 public function reportPost($type, $tid, $pid, $extra = NULL, $isFollow = 0)
 {
     global $_G;
     $utilService = Cloud::loadClass('Service_Util');
     if (!self::$_secStatus) {
         return false;
     }
     $startTime = microtime(true);
     $tid = dintval($tid);
     $pid = dintval($pid);
     $url = $_G['siteurl'] . "forum.php?mod=redirect&goto=findpost&ptid={$tid}&pid={$pid}";
     include_once libfile('function/forum');
     $thread = get_thread_by_tid($tid);
     if (!is_array($thread)) {
         return true;
     }
     $post = get_post_by_pid($pid);
     $member = C::t('common_member')->fetch($post['authorid'], 0, 1);
     $memberField = C::t('common_member_field_forum')->fetch($post['authorid'], 0, 1);
     $memberStatus = C::t('common_member_status')->fetch($post['authorid'], 0, 1);
     $memberVerify = C::t('common_member_verify')->fetch($post['authorid']);
     if ($post['first'] == 1) {
         $type = $type . 'Thread';
     } else {
         $type = $type . 'Post';
     }
     $id = 'pid:' . $pid;
     $aids = C::t('forum_attachment')->fetch_all_by_id('pid', $pid);
     $aids = array_keys($aids);
     $postAttachs = C::t('forum_attachment_n')->fetch_all($id, $aids);
     if (!$post['first']) {
         $firstPost = C::t('forum_post')->fetch_all_by_tid($thread['posttableid'], $tid, 1, '', 0, 0, 1);
         $firstPost = array_pop($firstPost);
         $id = 'pid:' . $firstPost['pid'];
         $aids = C::t('forum_attachment')->fetch_all_by_id('pid', $firstPost['pid']);
         $aids = array_keys($aids);
         $threadAttachs = C::t('forum_attachment_n')->fetch_all($id, $aids);
     } else {
         $firstPost = $post;
         $firstPostAttachs = $postAttachs;
     }
     $views = dintval($thread['views']);
     $replies = dintval($thread['replies']);
     $favourites = dintval($thread['favtimes']);
     $supports = dintval($thread['recommend_add']);
     $opposes = dintval($thread['recommend_sub']);
     $shares = dintval($thread['sharetimes']);
     $openId = $this->_getOpenId($_G['uid']);
     if (!$thread || !$post) {
         return true;
     }
     $fid = $thread["fid"];
     if ($post['first']) {
         $threadShield = $post['status'] & 1 ? 1 : 2;
         $threadWarning = $post['status'] & 2 ? 1 : 2;
     } else {
         $threadShield = $firstPost['status'] & 1 ? 1 : 2;
         $threadWarning = $firstPost['status'] & 2 ? 1 : 2;
     }
     $contentBitMap = array('onTop' => $thread['displayorder'] ? 1 : 2, 'hide' => strpos($post['message'], '[hide') ? 1 : 2, 'digest' => $thread['digest'] ? 1 : 2, 'highLight' => $thread['highlight'] ? 1 : 2, 'special' => $thread['special'] ? 1 : 2, 'threadAttach' => 2, 'threadAttachFlash' => 2, 'threadAttachPic' => 2, 'threadAttachVideo' => 2, 'threadAttachAudio' => 2, 'threadShield' => $threadShield, 'threadWarning' => $threadWarning, 'postAttach' => 2, 'postAttachFlash' => 2, 'postAttachPic' => 2, 'postAttachVideo' => 2, 'postAttachAudio' => 2, 'postShield' => $post['status'] & 1 ? 1 : 2, 'postWarning' => $post['status'] & 2 ? 1 : 2, 'isAdmin' => $member['adminid'] ? 1 : 2, 'isRush' => getstatus($thread['status'], 3) ? 1 : 2, 'hasReadPerm' => $thread['readperm'] ? 1 : 2, 'hasStamp' => $thread['stamp'] >= 0 ? 1 : 2, 'hasIcon' => $thread['icon'] >= 0 ? 1 : 2, 'isPushed' => $thread['pushedaid'] ? 1 : 2, 'hasCover' => $thread['cover'] ? 1 : 2, 'hasReward' => $thread['replycredit'] ? 1 : 2, 'isFollow' => $isFollow ? 1 : 2, 'threadStatus' => $thread['status'], 'postStatus' => $post['status']);
     if ($post['first']) {
         $contentBitMap['isMobile'] = $utilService->isMobile($thread['status']) ? 1 : 2;
         if ($contentBitMap['isMobile'] == 1) {
             $contentBitMap['isMobileSound'] = $utilService->mobileHasSound($thread['status']) ? 1 : 2;
             $contentBitMap['isMobilePhoto'] = $utilService->mobileHasPhoto($thread['status']) ? 1 : 2;
             $contentBitMap['isMobileGPS'] = $utilService->mobileHasGPS($thread['status']) ? 1 : 2;
         }
     } else {
         $contentBitMap['isMobile'] = getstatus($post['status'], 4) ? 1 : 2;
     }
     $userBitMap['isAdmin'] = $member['adminid'] ? 1 : 2;
     $userBitMap['hasMedal'] = $memberField['medals'] ? 1 : 2;
     $userBitMap['hasAvatar'] = $member['avatarstatus'] ? 1 : 2;
     $userBitMap['hasVerify'] = count($memberVerify) ? 1 : 2;
     $videoExt = array('.rm', '.flv', '.mkv', '.rmvb', '.avi', '.wmv', '.mp4', '.mpeg', '.mpg');
     $audioExt = array('.wav', '.mid', '.mp3', '.m3u', '.wma', '.asf', '.asx');
     if ($firstPostAttachs) {
         foreach ($firstPostAttachs as $attach) {
             $fileExt = substr($attach['filename'], strrpos($attach['filename'], '.'));
             if ($fileExt == '.bmp' || $fileExt == '.jpg' || $fileExt == '.jpeg' || $fileExt == '.gif' || $fileExt == '.png') {
                 $contentBitMap['threadAttachPic'] = 1;
             }
             if ($fileExt == '.swf' || $fileExt == '.fla') {
                 $contentBitMap['threadAttachFlash'] = 1;
             }
             if (in_array($fileExt, $videoExt)) {
                 $contentBitMap['threadAttachVideo'] = 1;
             }
             if (in_array($fileExt, $audioExt)) {
                 $contentBitMap['threadAttachAudio'] = 1;
             }
         }
         $contentBitMap['threadAttach'] = 1;
     }
     if ($postAttachs) {
         foreach ($postAttachs as $attach) {
             $fileExt = substr($attach['filename'], strrpos($attach['filename'], '.'));
             if ($fileExt == '.bmp' || $fileExt == '.jpg' || $fileExt == '.jpeg' || $fileExt == '.gif' || $fileExt == '.png') {
                 $contentBitMap['postAttachPic'] = 1;
             }
             if ($fileExt == '.swf' || $fileExt == '.fla') {
                 $contentBitMap['postAttachFlash'] = 1;
             }
             if (in_array($fileExt, $videoExt)) {
                 $contentBitMap['postAttachVideo'] = 1;
             }
             if (in_array($fileExt, $audioExt)) {
                 $contentBitMap['postAttachAudio'] = 1;
             }
         }
         $contentBitMap['postAttach'] = 1;
     }
     if ($thread['authorid'] == $_G['uid']) {
         $threadEmail = $_G['member']['email'];
     } else {
         $threadMember = C::t('common_member')->fetch($thread['authorid'], 0, 1);
         $threadEmail = $threadMember['email'];
     }
     if ($post['authorid'] == $_G['uid']) {
         $postEmail = $_G['member']['email'];
     } else {
         $postEmail = $member['email'];
     }
     if ($thread['special']) {
         if (array_key_exists($thread['special'], $this->specialType)) {
             $threadSpecial = self::$specialType[$thread['special']];
         } else {
             $threadSpecial = 'other';
         }
     }
     $threadSort = 2;
     if ($thread['sortid']) {
         $threadSort = 1;
         if ($post['first']) {
             $sortMessage = $this->_convertSortInfo($thread['sortid'], $thread['tid']);
         }
     }
     $contentBitMap['threadSort'] = $threadSort;
     if ($_GET['action'] == 'newtrade') {
         $type = 'newThread';
         $pid = $firstPost['pid'];
     }
     $batchData[] = array('tId' => $tid, 'pId' => $pid, 'threadUid' => dintval($thread['authorid']), 'threadUsername' => $thread['author'], 'threadEmail' => $threadEmail, 'postUid' => dintval($post['authorid']), 'postUsername' => $post['author'], 'postEmail' => $postEmail, 'openId' => $openId, 'fId' => dintval($fid), 'threadUrl' => $url, 'operateTime' => $_G['timestamp'], 'clientIp' => $_G['clientip'], 'remoteIp' => $_SERVER['REMOTE_ADDR'], 'views' => $views, 'replies' => $replies, 'favourites' => $favourites, 'supports' => $supports, 'opposes' => $opposes, 'shares' => $shares, 'title' => $post['subject'], 'content' => $post['message'], 'sortMessage' => $sortMessage, 'attachList' => $postAttachs, 'reportType' => $type, 'contentBitMap' => $contentBitMap, 'userBitMap' => $userBitMap, 'extra' => $extra, 'specialType' => $threadSpecial, 'signature' => $memberField['sightml'], 'userAgent' => $this->_getUA());
     $result = false;
     try {
         $result = self::$_secClient->securityReportPost($batchData);
     } catch (Cloud_Service_Client_RestfulException $e) {
         $ids = array($tid, $pid);
         $this->logFailed($type, $ids);
     } catch (Exception $e) {
     }
     $this->benchMarkLog($startTime, $pid, $batchData, $type);
     return $result;
 }
Example #10
0
if (empty($_GET['goto']) && $ptid) {
    $_GET['goto'] = 'findpost';
}
if ($_GET['goto'] == 'findpost') {
    $post = $thread = array();
    if ($ptid) {
        $thread = get_thread_by_tid($ptid);
    }
    if ($pid) {
        if ($thread) {
            $post = C::t('forum_post')->fetch($thread['posttableid'], $pid);
        } else {
            $post = get_post_by_pid($pid);
        }
        if ($post && empty($thread)) {
            $thread = get_thread_by_tid($post['tid']);
        }
    }
    if (empty($thread)) {
        showmessage('thread_nonexistence');
    } else {
        $tid = $thread['tid'];
    }
    if (empty($pid)) {
        if ($postno) {
            if (getstatus($thread['status'], 3)) {
                $rowarr = C::t('forum_post')->fetch_all_by_tid_position($thread['posttableid'], $ptid, $postno);
                $pid = $rowarr[0]['pid'];
            }
            if ($pid) {
                $post = C::t('forum_post')->fetch($thread['posttableid'], $pid);
Example #11
0
 /**
  * 获取文章内容
  *
  * @param int|array $aid
  * @param int $page
  * @return array
  */
 public static function getNewsContent($aid, $page = 1)
 {
     global $_G;
     $article = $aid;
     !is_array($aid) && ($article = PortalUtils::getNewsInfo($aid));
     $content = C::t('portal_article_content')->fetch_by_aid_page($article['aid'], $page);
     if (empty($content)) {
         return $content;
     }
     $content['content'] = PortalUtils::preParseArticleContent($content['content']);
     require_once libfile('function/blog');
     $content['content'] = blog_bbcode($content['content']);
     if ($article['idtype'] == 'tid' || $content['idtype'] == 'pid') {
         $thread = $firstpost = array();
         require_once libfile('function/discuzcode');
         require_once libfile('function/forum');
         $thread = get_thread_by_tid($article['id']);
         if (!empty($thread)) {
             if ($content['idtype'] == 'pid') {
                 $firstpost = C::t('forum_post')->fetch($thread['posttableid'], $content['id']);
             } else {
                 $firstpost = C::t('forum_post')->fetch_threadpost_by_tid_invisible($article['id']);
             }
             if ($firstpost && $firstpost['tid'] == $article['id']) {
                 $firstpost['uid'] = $firstpost['authorid'];
                 $firstpost['username'] = $firstpost['author'];
             }
         }
         if (!empty($firstpost) && !empty($thread) && $thread['displayorder'] != -1) {
             $_G['tid'] = $article['id'];
             $aids = array();
             $firstpost['message'] = $content['content'];
             if ($thread['attachment']) {
                 $_G['group']['allowgetimage'] = 1;
                 if (preg_match_all("/\\[attach\\](\\d+)\\[\\/attach\\]/i", $firstpost['message'], $matchaids)) {
                     $aids = $matchaids[1];
                 }
             }
             if ($aids) {
                 parseforumattach($firstpost, $aids);
             }
             $content['content'] = $firstpost['message'];
             $content['pid'] = $firstpost['pid'];
         } else {
             C::t('portal_article_title')->update($aid, array('id' => 0, 'idtype' => ''));
             C::t('portal_article_content')->update_by_aid($aid, array('id' => 0, 'idtype' => ''));
         }
     } elseif ($article['idtype'] == 'blogid') {
         $content['content'] = '';
     }
     return PortalUtils::transArticleContent($content['content']);
 }
Example #12
0
 function _jumpThread($postno)
 {
     global $_G;
     $ptid = !empty($_GET['tid']) ? intval($_GET['tid']) : 0;
     if ($ptid) {
         $thread = get_thread_by_tid($ptid);
     }
     if ($postno) {
         if (getstatus($thread['status'], 3)) {
             $rowarr = C::t('forum_post')->fetch_all_by_tid_position($thread['posttableid'], $ptid, $postno);
             $pid = $rowarr[0]['pid'];
         }
         if ($pid) {
             $post = C::t('forum_post')->fetch($thread['posttableid'], $pid);
             if ($post['invisible'] != 0) {
                 $post = array();
             }
             $pid = 0;
         } else {
             $postno = $postno > 1 ? $postno - 1 : 0;
             $post = C::t('forum_post')->fetch_visiblepost_by_tid($thread['posttableid'], $ptid, $postno);
             $pid = $post['pid'];
         }
     }
     $ordertype = !isset($_GET['ordertype']) && getstatus($thread['status'], 4) ? 1 : $ordertype;
     if ($thread['special'] == 2 || C::t('forum_threaddisablepos')->fetch($tid)) {
         $curpostnum = C::t('forum_post')->count_by_tid_dateline($thread['posttableid'], $tid, $post['dateline']);
     } else {
         if ($thread['maxposition']) {
             $maxposition = $thread['maxposition'];
         } else {
             $maxposition = C::t('forum_post')->fetch_maxposition_by_tid($thread['posttableid'], $tid);
         }
         $thread['replies'] = $maxposition;
         $curpostnum = $post['position'];
     }
     if ($ordertype != 1) {
         $page = ceil($curpostnum / $_G['ppp']);
     } elseif ($curpostnum > 1) {
         $page = ceil(($thread['replies'] - $curpostnum + 3) / $_G['ppp']);
     } else {
         $page = 1;
     }
     $_G['jump#pid'] = $ret['pid'] = isset($pid) ? $pid : 0;
     $_G['page'] = $ret['page'] = $page;
     return $ret;
 }
Example #13
0
 protected function _checkThreadIgnore($tid)
 {
     if (!intval($tid)) {
         return true;
     }
     require_once libfile('function/forum');
     $checkFiled = array('highlight', 'displayorder', 'digest');
     $thread = get_thread_by_tid($tid);
     $checkResult = false;
     $checkResult = $this->_checkBoardIgnore($thread['fid']);
     $checkResult = $checkResult ? true : $this->_checkUserIgnore($thread['authorid']);
     foreach ($checkFiled as $field) {
         if ($thread[$field] > 0) {
             $checkResult = true;
         }
     }
     return $checkResult;
 }