Beispiel #1
0
function forum(&$forum)
{
    global $_G;
    $lastvisit = $_G['member']['lastvisit'];
    if (!$forum['viewperm'] || $forum['viewperm'] && forumperm($forum['viewperm']) || !empty($forum['allowview']) || isset($forum['users']) && strstr($forum['users'], "\t{$_G['uid']}\t")) {
        $forum['permission'] = 2;
    } elseif (!$_G['setting']['hideprivate']) {
        $forum['permission'] = 1;
    } else {
        return FALSE;
    }
    if ($forum['icon']) {
        $forum['icon'] = get_forumimg($forum['icon']);
        $forum['icon'] = '<a href="forum.php?mod=forumdisplay&fid=' . $forum['fid'] . '"><img src="' . $forum['icon'] . '" align="left" alt="" /></a>';
    }
    $lastpost = array(0, 0, '', '');
    $forum['lastpost'] = is_string($forum['lastpost']) ? explode("\t", $forum['lastpost']) : $forum['lastpost'];
    $forum['lastpost'] = count($forum['lastpost']) != 4 ? $lastpost : $forum['lastpost'];
    list($lastpost['tid'], $lastpost['subject'], $lastpost['dateline'], $lastpost['author']) = $forum['lastpost'];
    $thisforumlastvisit = array();
    if ($_G['cookie']['forum_lastvisit']) {
        preg_match("/D\\_" . $forum['fid'] . "\\_(\\d+)/", $_G['cookie']['forum_lastvisit'], $thisforumlastvisit);
    }
    $forum['folder'] = ($thisforumlastvisit && $thisforumlastvisit[1] > $lastvisit ? $thisforumlastvisit[1] : $lastvisit) < $lastpost['dateline'] ? ' class="new"' : '';
    if ($lastpost['tid']) {
        $lastpost['dateline'] = dgmdate($lastpost['dateline'], 'u');
        $lastpost['authorusername'] = $lastpost['author'];
        if ($lastpost['author']) {
            $lastpost['author'] = '<a href="home.php?mod=space&username='******'author']) . '">' . $lastpost['author'] . '</a>';
        }
        $forum['lastpost'] = $lastpost;
    } else {
        $forum['lastpost'] = $lastpost['authorusername'] = '';
    }
    $forum['moderators'] = moddisplay($forum['moderators'], $_G['setting']['moddisplay'], !empty($forum['inheritedmod']));
    if (isset($forum['subforums'])) {
        $forum['subforums'] = implode(', ', $forum['subforums']);
    }
    return TRUE;
}
Beispiel #2
0
    }
    $_G['forum']['icon'] = get_groupimg($_G['forum']['icon'], 'icon');
    $_G['grouptypeid'] = $_G['forum']['fup'];
    $_G['forum']['dateline'] = dgmdate($_G['forum']['dateline'], 'd');
    $nav = get_groupnav($_G['forum']);
    $groupnav = $nav['nav'];
    $onlinemember = grouponline($_G['fid']);
    $groupmanagers = $_G['forum']['moderators'];
    $groupcache = getgroupcache($_G['fid'], array('replies', 'views', 'digest', 'lastpost', 'ranking', 'activityuser', 'newuserlist'));
    $seotype = 'grouppage';
    $seodata['first'] = $nav['first']['name'];
    $seodata['second'] = $nav['second']['name'];
    $seodata['gdes'] = $_G['forum']['description'];
    $forumseoset = array();
}
$_G['forum']['banner'] = get_forumimg($_G['forum']['banner']);
list($navtitle, $metadescription, $metakeywords) = get_seosetting($seotype, $seodata, $forumseoset);
if (!$navtitle) {
    $navtitle = get_title_page($_G['forum']['name'], $_G['page']);
    $nobbname = false;
} else {
    $nobbname = true;
}
if (!empty($_G['gp_typeid']) && !empty($_G['forum']['threadtypes']['types'][$_G['gp_typeid']])) {
    $navtitle = strip_tags($_G['forum']['threadtypes']['types'][$_G['gp_typeid']]) . ' - ' . $navtitle;
}
if (!$metakeywords) {
    $metakeywords = $_G['forum']['name'];
}
if (!$metadescription) {
    $metadescription = $_G['forum']['name'];
    foreach ($_G['forum_threadlist'] as $k => $thread) {
        $_G['forum_threadlist'][$k]['recommend'] = isset($memberrecommends[$thread['icontid']]) ? 1 : 0;
    }
}
foreach ($GLOBALS['sublist'] as $k => $sublist) {
    if ($sublist['icon']) {
        $icon = preg_match('/src="(.+?)"/', $sublist['icon'], $r) ? $r[1] : '';
        if (!preg_match('/^http:\\//', $icon)) {
            $icon = $_G['siteurl'] . $icon;
        }
        $GLOBALS['sublist'][$k]['icon'] = $icon;
    }
}
if ($_G['forum']['icon']) {
    require_once libfile('function/forumlist');
    if (strncasecmp($_G['forum']['icon'], 'http://', 7) !== 0) {
        $_G['forum']['icon'] = get_forumimg($_G['forum']['icon']);
        if (strncasecmp($_G['forum']['icon'], 'http://', 7) !== 0) {
            $_G['forum']['icon'] = $_G['siteurl'] . $_G['forum']['icon'];
        }
    }
}
$_G['forum']['threadcount'] = $_G['forum_threadcount'];
$variable = array('forum' => mobile_core::getvalues($_G['forum'], array('fid', 'fup', 'name', 'threads', 'posts', 'rules', 'autoclose', 'password', 'icon', 'threadcount', 'picstyle')), 'group' => mobile_core::getvalues($_G['group'], array('groupid', 'grouptitle')), 'forum_threadlist' => mobile_core::getvalues(array_values($_G['forum_threadlist']), array('/^\\d+$/'), array('tid', 'author', 'authorid', 'subject', 'subject', 'dbdateline', 'dateline', 'dblastpost', 'lastpost', 'lastposter', 'attachment', 'replies', 'readperm', 'views', 'digest', 'cover', 'recommend', 'recommend_add', 'reply', 'avatar', 'displayorder', 'coverpath', 'typeid')), 'groupiconid' => $groupiconIds, 'sublist' => mobile_core::getvalues($GLOBALS['sublist'], array('/^\\d+$/'), array('fid', 'name', 'threads', 'todayposts', 'posts', 'icon')), 'tpp' => $_G['tpp'], 'page' => $GLOBALS['page']);
if (!empty($_G['forum']['threadtypes']) || !empty($_GET['debug'])) {
    $variable['threadtypes'] = $_G['forum']['threadtypes'];
}
if (!empty($_G['forum']['threadsorts']) || !empty($_GET['debug'])) {
    $variable['threadsorts'] = $_G['forum']['threadsorts'];
}
$variable['forum']['password'] = $variable['forum']['password'] ? '1' : '0';
 private function _getForumInfo($fid)
 {
     global $_G;
     $forum = $_G['forum'];
     require_once libfile('function/forumlist');
     $forumImage = get_forumimg($forum['icon']);
     $forumImage = (string) WebUtils::getHttpFileName($forumImage);
     $forumInfo = array();
     $forumInfo['id'] = (int) $fid;
     $forumInfo['title'] = $fid != 0 ? (string) WebUtils::emptyHtml($forum['name']) : '';
     $forumInfo['description'] = (string) WebUtils::emptyHtml($forum['description']);
     $forumInfo['icon'] = (string) $forumImage;
     return $forumInfo;
 }