• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP get_inactive_forums函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中get_inactive_forums函数的典型用法代码示例。如果您正苦于以下问题:PHP get_inactive_forums函数的具体用法?PHP get_inactive_forums怎么用?PHP get_inactive_forums使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了get_inactive_forums函数的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: getUnviewable

 function getUnviewable($tableName = '')
 {
     global $db;
     if ($tableName) {
         $tableName = $tableName . '.';
     }
     $wheres = array();
     $wheres[] = '1=1';
     // get forums user cannot view
     $unviewable = get_unviewable_forums(true);
     if ($unviewable) {
         $wheres[] = "{$tableName}fid NOT IN ({$unviewable})";
     }
     // get inactive forums
     $inactive = get_inactive_forums();
     if ($inactive) {
         $wheres[] = "{$tableName}fid NOT IN ({$inactive})";
     }
     // get disallowed forums
     $disallowedforums = $db->escape_string($mybb->settings['tags_disallowedforums']);
     if ($disallowedforums) {
         $wheres[] = "{$tableName} NOT IN ({$disallowedforums})";
     }
     return implode(' AND ', $wheres);
 }
开发者ID:ATofighi,项目名称:MyBB-Tags,代码行数:25,代码来源:tags.php


示例2: get_forum_func

function get_forum_func()
{
    global $db, $lang, $theme, $plugins, $mybb, $session, $settings, $cache, $time, $mybbgroups, $forumpermissions, $fcache, $forum_cache;
    $lang->load("index");
    $inactiveforums = get_inactive_forums();
    if ($mybb->user['uid'] == 0) {
        // Build a forum cache.
        $query = $db->query("\n            SELECT *, threads as unread_count\n            FROM " . TABLE_PREFIX . "forums\n            WHERE active != 0 " . ($inactiveforums ? " AND fid NOT IN ({$inactiveforums})" : '') . "\n            ORDER BY pid, disporder\n        ");
        $forumsread = unserialize($mybb->cookies['mybb']['forumread']);
    } else {
        // Build a forum cache.
        $query = $db->query("\n            SELECT f.*, fr.dateline AS lastread, fs.fsid, (\n                select count(*) from " . TABLE_PREFIX . "threads where fid=f.fid and lastpost > fr.dateline\n            ) as unread_count\n            FROM " . TABLE_PREFIX . "forums f\n            LEFT JOIN " . TABLE_PREFIX . "forumsread fr ON (fr.fid=f.fid AND fr.uid='{$mybb->user['uid']}')\n            LEFT JOIN " . TABLE_PREFIX . "forumsubscriptions fs ON (fs.fid=f.fid AND fs.uid='{$mybb->user['uid']}')\n            WHERE f.active != 0 " . ($inactiveforums ? " AND f.fid NOT IN ({$inactiveforums})" : '') . "\n            ORDER BY pid, disporder\n        ");
    }
    while ($forum = $db->fetch_array($query)) {
        if ($mybb->user['uid'] == 0) {
            if ($forumsread[$forum['fid']]) {
                $forum['lastread'] = $forumsread[$forum['fid']];
            }
        }
        $fcache[$forum['pid']][$forum['disporder']][$forum['fid']] = $forum;
    }
    $forumpermissions = forum_permissions();
    $excols = "index";
    $permissioncache['-1'] = "1";
    $showdepth = 10;
    $xml_nodes = new xmlrpcval(array(), 'array');
    $done = array();
    $xml_tree = treeBuild(0, $fcache, $xml_nodes, $done);
    $xml_nodes->addArray($xml_tree);
    return new xmlrpcresp($xml_nodes);
}
开发者ID:dthiago,项目名称:tapatalk-mybb,代码行数:31,代码来源:get_forum.php


示例3: explode

 // Divide up the cookie using our delimeter
 $multiquoted = explode("|", $mybb->cookies['multiquote']);
 $plugins->run_hooks("xmlhttp_get_multiquoted_start");
 // No values - exit
 if (!is_array($multiquoted)) {
     exit;
 }
 // Loop through each post ID and sanitize it before querying
 foreach ($multiquoted as $post) {
     $quoted_posts[$post] = (int) $post;
 }
 // Join the post IDs back together
 $quoted_posts = implode(",", $quoted_posts);
 // Fetch unviewable forums
 $unviewable_forums = get_unviewable_forums();
 $inactiveforums = get_inactive_forums();
 if ($unviewable_forums) {
     $unviewable_forums = "AND t.fid NOT IN ({$unviewable_forums})";
 }
 if ($inactiveforums) {
     $inactiveforums = "AND t.fid NOT IN ({$inactiveforums})";
 }
 $message = '';
 // Are we loading all quoted posts or only those not in the current thread?
 if (empty($mybb->input['load_all'])) {
     $from_tid = "p.tid != '" . $mybb->get_input('tid', MyBB::INPUT_INT) . "' AND ";
 } else {
     $from_tid = '';
 }
 require_once MYBB_ROOT . "inc/class_parser.php";
 $parser = new postParser();
开发者ID:olada,项目名称:mybbintegrator,代码行数:31,代码来源:xmlhttp.php


示例4: build_friendly_wol_location

/**
 * Builds a friendly named Who's Online location from an "activity" and array of user data. Assumes fetch_wol_activity has already been called.
 *
 * @param array Array containing activity and essential IDs.
 * @return string Location name for the activity being performed.
 */
function build_friendly_wol_location($user_activity)
{
    global $db, $lang, $uid_list, $aid_list, $pid_list, $tid_list, $fid_list, $ann_list, $eid_list, $plugins, $parser, $mybb;
    global $threads, $forums, $forums_linkto, $forum_cache, $posts, $announcements, $events, $usernames, $attachments;
    // Fetch forum permissions for this user
    $unviewableforums = get_unviewable_forums();
    $inactiveforums = get_inactive_forums();
    $fidnot = '';
    $unviewablefids = $inactivefids = array();
    if ($unviewableforums) {
        $fidnot = " AND fid NOT IN ({$unviewableforums})";
        $unviewablefids = explode(',', $unviewableforums);
    }
    if ($inactiveforums) {
        $fidnot .= " AND fid NOT IN ({$inactiveforums})";
        $inactivefids = explode(',', $inactiveforums);
    }
    // Fetch any users
    if (!is_array($usernames) && count($uid_list) > 0) {
        $uid_sql = implode(",", $uid_list);
        if ($uid_sql != $mybb->user['uid']) {
            $query = $db->simple_select("users", "uid,username", "uid IN ({$uid_sql})");
            while ($user = $db->fetch_array($query)) {
                $usernames[$user['uid']] = $user['username'];
            }
        } else {
            $usernames[$mybb->user['uid']] = $mybb->user['username'];
        }
    }
    // Fetch any attachments
    if (!is_array($attachments) && count($aid_list) > 0) {
        $aid_sql = implode(",", $aid_list);
        $query = $db->simple_select("attachments", "aid,pid", "aid IN ({$aid_sql})");
        while ($attachment = $db->fetch_array($query)) {
            $attachments[$attachment['aid']] = $attachment['pid'];
            $pid_list[] = $attachment['pid'];
        }
    }
    // Fetch any announcements
    if (!is_array($announcements) && count($ann_list) > 0) {
        $aid_sql = implode(",", $ann_list);
        $query = $db->simple_select("announcements", "aid,subject", "aid IN ({$aid_sql}) {$fidnot}");
        while ($announcement = $db->fetch_array($query)) {
            $announcement_title = htmlspecialchars_uni($parser->parse_badwords($announcement['subject']));
            $announcements[$announcement['aid']] = $announcement_title;
        }
    }
    // Fetch any posts
    if (!is_array($posts) && count($pid_list) > 0) {
        $pid_sql = implode(",", $pid_list);
        $query = $db->simple_select("posts", "pid,tid", "pid IN ({$pid_sql}) {$fidnot}");
        while ($post = $db->fetch_array($query)) {
            $posts[$post['pid']] = $post['tid'];
            $tid_list[] = $post['tid'];
        }
    }
    // Fetch any threads
    if (!is_array($threads) && count($tid_list) > 0) {
        $perms = array();
        $tid_sql = implode(",", $tid_list);
        $query = $db->simple_select('threads', 'uid, fid, tid, subject, visible, prefix', "tid IN({$tid_sql}) {$fidnot}");
        $threadprefixes = build_prefixes();
        while ($thread = $db->fetch_array($query)) {
            $thread['threadprefix'] = '';
            if ($thread['prefix'] && !empty($threadprefixes[$thread['prefix']])) {
                $thread['threadprefix'] = $threadprefixes[$thread['prefix']]['displaystyle'];
            }
            if (empty($perms[$thread['fid']])) {
                $perms[$thread['fid']] = forum_permissions($thread['fid']);
            }
            if (isset($perms[$thread['fid']]['canonlyviewownthreads']) && $perms[$thread['fid']]['canonlyviewownthreads'] == 1 && $thread['uid'] != $mybb->user['uid'] && !is_moderator($thread['fid'])) {
                continue;
            }
            if (is_moderator($thread['fid']) || $thread['visible'] == 1) {
                $thread_title = '';
                if ($thread['threadprefix']) {
                    $thread_title = $thread['threadprefix'] . ' ';
                }
                $thread_title .= htmlspecialchars_uni($parser->parse_badwords($thread['subject']));
                $threads[$thread['tid']] = $thread_title;
                $fid_list[] = $thread['fid'];
            }
        }
    }
    // Fetch any forums
    if (!is_array($forums) && count($fid_list) > 0) {
        $fidnot = array_merge($unviewablefids, $inactivefids);
        foreach ($forum_cache as $fid => $forum) {
            if (in_array($fid, $fid_list) && !in_array($fid, $fidnot)) {
                $forums[$fid] = $forum['name'];
                $forums_linkto[$fid] = $forum['linkto'];
            }
        }
    }
//.........这里部分代码省略.........
开发者ID:olada,项目名称:mybbintegrator,代码行数:101,代码来源:functions_online.php


示例5: google_seo_sitemap_gen

/**
 * Generate the list of items for a sitemap.
 * This will be handed to google_seo_sitemap() to produce the XML output.
 *
 * @param string XML Sitemap URL scheme
 * @param string type of items to list in sitemap
 * @param int page number
 * @param int number of items per page
 * @return array List of items (in case of main index)
 */
function google_seo_sitemap_gen($scheme, $type, $page, $pagination)
{
    global $lang, $db, $mybb, $settings;
    global $google_seo_url_optimize;
    if (!$settings["google_seo_sitemap_{$type}"]) {
        return;
    }
    switch ($type) {
        case "forums":
            $table = 'forums';
            $idname = 'fid';
            $datename = 'lastpost';
            $getlink = 'get_forum_link';
            // Additional permission check.
            $unviewableforums = get_unviewable_forums();
            $inactiveforums = get_inactive_forums();
            if ($unviewableforums) {
                $condition[] = "fid NOT IN ({$unviewableforums})";
            }
            if ($inactiveforums) {
                $condition[] = "fid NOT IN ({$inactiveforums})";
            }
            // passwords already taken care of unviewable forums,
            // but linkto needs special treatment...
            $condition[] = "linkto=''";
            if ($condition) {
                $condition = implode(" AND ", $condition);
            }
            // Include pages?
            if ($settings['google_seo_sitemap_forums'] == 2) {
                $pagescount = ', threads AS pagescount';
                $perpage = $mybb->settings['threadsperpage'];
                if (!$perpage) {
                    $perpage = 20;
                }
            }
            break;
        case "threads":
            $table = 'threads';
            $idname = 'tid';
            $datename = 'lastpost';
            $getlink = 'get_thread_link';
            $condition = "visible>0 AND closed NOT LIKE 'moved|%'";
            // Additional permission check.
            $unviewableforums = get_unviewable_forums(true);
            $inactiveforums = get_inactive_forums();
            if ($unviewableforums) {
                $condition .= " AND fid NOT IN ({$unviewableforums})";
            }
            if ($inactiveforums) {
                $condition .= " AND fid NOT IN ({$inactiveforums})";
            }
            // Include pages?
            if ($settings['google_seo_sitemap_threads'] == 2) {
                $pagescount = ', replies+1 AS pagescount';
                $perpage = $settings['postsperpage'];
                if (!$perpage) {
                    $perpage = 20;
                }
            }
            break;
        case "users":
            if (!$mybb->usergroup['canviewprofiles']) {
                return;
            }
            $table = 'users';
            $idname = 'uid';
            $datename = 'regdate';
            $getlink = 'get_profile_link';
            $condition = '1=1';
            break;
        case "announcements":
            $table = 'announcements';
            $idname = 'aid';
            $datename = 'startdate';
            $getlink = 'get_announcement_link';
            $time = TIME_NOW;
            $condition = "startdate <= '{$time}' AND (enddate >= '{$time}' OR enddate='0')";
            // Additional permission check.
            $unviewableforums = get_unviewable_forums(true);
            $inactiveforums = get_inactive_forums();
            if ($unviewableforums) {
                $condition .= " AND fid NOT IN ({$unviewableforums})";
            }
            if ($inactiveforums) {
                $condition .= " AND fid NOT IN ({$inactiveforums})";
            }
            break;
        case "calendars":
            if ($mybb->settings['enablecalendar'] == 0 || $mybb->usergroup['canviewcalendar'] == 0) {
//.........这里部分代码省略.........
开发者ID:learnix-xx,项目名称:MyBB-Google-SEO,代码行数:101,代码来源:sitemap.php


示例6: implode

     $reputation_cache[] = $reputation_vote;
     // If this is a post, hold it and gather some information about it
     if ($reputation_vote['pid'] && !isset($post_cache[$reputation_vote['pid']])) {
         $post_cache[$reputation_vote['pid']] = $reputation_vote['pid'];
     }
 }
 if (!empty($post_cache)) {
     $pids = implode(',', $post_cache);
     $sql = array("p.pid IN ({$pids})");
     // get forums user cannot view
     $unviewable = get_unviewable_forums(true);
     if ($unviewable) {
         $sql[] = "p.fid NOT IN ({$unviewable})";
     }
     // get inactive forums
     $inactive = get_inactive_forums();
     if ($inactive) {
         $sql[] = "p.fid NOT IN ({$inactive})";
     }
     if (!$mybb->user['ismoderator']) {
         $sql[] = "p.visible='1'";
         $sql[] = "t.visible='1'";
     }
     $sql = implode(' AND ', $sql);
     $query = $db->query("\n\t\t\tSELECT p.pid, p.uid, p.fid, p.visible, p.message, t.tid, t.subject, t.visible AS thread_visible\n\t\t\tFROM " . TABLE_PREFIX . "posts p\n\t\t\tLEFT JOIN " . TABLE_PREFIX . "threads t ON (t.tid=p.tid)\n\t\t\tWHERE {$sql}\n\t\t");
     $forumpermissions = array();
     while ($post = $db->fetch_array($query)) {
         if (($post['visible'] == 0 || $post['thread_visible'] == 0) && !is_moderator($post['fid'], 'canviewunapprove')) {
             continue;
         }
         if (($post['visible'] == -1 || $post['thread_visible'] == -1) && !is_moderator($post['fid'], 'canviewdeleted')) {
开发者ID:styv300,项目名称:ToRepublic2.5,代码行数:31,代码来源:reputation.php


示例7: perform_search_mysql_ft


//.........这里部分代码省略.........
            $thread_replycut = " AND t.replies <= '" . intval($search['numreplies']) . "'";
        }
    }
    $forumin = '';
    $fidlist = array();
    $searchin = array();
    if ($search['forums'] != "all") {
        if (!is_array($search['forums'])) {
            $search['forums'] = array(intval($search['forums']));
        }
        foreach ($search['forums'] as $forum) {
            $forum = intval($forum);
            if (!$searchin[$forum]) {
                switch ($db->type) {
                    case "pgsql":
                    case "sqlite3":
                    case "sqlite2":
                        $query = $db->query("\n\t\t\t\t\t\t\tSELECT f.fid \n\t\t\t\t\t\t\tFROM " . TABLE_PREFIX . "forums f \n\t\t\t\t\t\t\tLEFT JOIN " . TABLE_PREFIX . "forumpermissions p ON (f.fid=p.fid AND p.gid='" . $mybb->user['usergroup'] . "') \n\t\t\t\t\t\t\tWHERE INSTR(','||parentlist||',',',{$forum},') > 0 AND active!=0 AND (ISNULL(p.fid) OR p.cansearch=1)\n\t\t\t\t\t\t");
                        break;
                    default:
                        $query = $db->query("\n\t\t\t\t\t\t\tSELECT f.fid \n\t\t\t\t\t\t\tFROM " . TABLE_PREFIX . "forums f \n\t\t\t\t\t\t\tLEFT JOIN " . TABLE_PREFIX . "forumpermissions p ON (f.fid=p.fid AND p.gid='" . $mybb->user['usergroup'] . "') \n\t\t\t\t\t\t\tWHERE INSTR(CONCAT(',',parentlist,','),',{$forum},') > 0 AND active!=0 AND (ISNULL(p.fid) OR p.cansearch=1)\n\t\t\t\t\t\t");
                }
                while ($sforum = $db->fetch_array($query)) {
                    $fidlist[] = $sforum['fid'];
                }
            }
        }
        if (count($fidlist) == 1) {
            $forumin .= " AND t.fid='{$forum}' ";
            $searchin[$fid] = 1;
        } else {
            if (count($fidlist) > 1) {
                $forumin = " AND t.fid IN (" . implode(',', $fidlist) . ")";
            }
        }
    }
    $unsearchforums = get_unsearchable_forums();
    if ($unsearchforums) {
        $permsql = " AND t.fid NOT IN ({$unsearchforums})";
    }
    $inactiveforums = get_inactive_forums();
    if ($inactiveforums) {
        $permsql .= " AND t.fid NOT IN ({$inactiveforums})";
    }
    // Searching a specific thread?
    if ($search['tid']) {
        $tidsql = " AND t.tid='" . intval($search['tid']) . "'";
    }
    $limitsql = '';
    if (intval($mybb->settings['searchhardlimit']) > 0) {
        $limitsql = "LIMIT " . intval($mybb->settings['searchhardlimit']);
    }
    // Searching both posts and thread titles
    $threads = array();
    $posts = array();
    $firstposts = array();
    if ($search['postthread'] == 1) {
        // No need to search subjects when looking for results within a specific thread
        if (!$search['tid']) {
            $query = $db->query("\n\t\t\t\tSELECT t.tid, t.firstpost\n\t\t\t\tFROM " . TABLE_PREFIX . "threads t\n\t\t\t\tWHERE 1=1 {$thread_datecut} {$thread_replycut} {$forumin} {$thread_usersql} {$permsql} AND t.visible>=0 AND t.closed NOT LIKE 'moved|%' {$subject_lookin}\n\t\t\t\t{$limitsql}\n\t\t\t");
            while ($thread = $db->fetch_array($query)) {
                $threads[$thread['tid']] = $thread['tid'];
                if ($thread['firstpost']) {
                    $posts[$thread['tid']] = $thread['firstpost'];
                }
            }
        }
        $query = $db->query("\n\t\t\tSELECT p.pid, p.tid\n\t\t\tFROM " . TABLE_PREFIX . "posts p\n\t\t\tLEFT JOIN " . TABLE_PREFIX . "threads t ON (t.tid=p.tid)\n\t\t\tWHERE 1=1 {$post_datecut} {$thread_replycut} {$forumin} {$post_usersql} {$permsql} {$tidsql} AND p.visible>=0 AND t.visible>=0 AND t.closed NOT LIKE 'moved|%' {$message_lookin}\n\t\t\t{$limitsql}\n\t\t");
        while ($post = $db->fetch_array($query)) {
            $posts[$post['pid']] = $post['pid'];
            $threads[$post['tid']] = $post['tid'];
        }
        if (count($posts) < 1 && count($threads) < 1) {
            error($lang->error_nosearchresults);
        }
        $threads = implode(',', $threads);
        $posts = implode(',', $posts);
    } else {
        $query = $db->query("\n\t\t\tSELECT t.tid, t.firstpost\n\t\t\tFROM " . TABLE_PREFIX . "threads t\n\t\t\tWHERE 1=1 {$thread_datecut} {$thread_replycut} {$forumin} {$thread_usersql} {$permsql} AND t.visible>=0 {$subject_lookin}\n\t\t\t{$limitsql}\n\t\t");
        while ($thread = $db->fetch_array($query)) {
            $threads[$thread['tid']] = $thread['tid'];
            if ($thread['firstpost']) {
                $firstposts[$thread['tid']] = $thread['firstpost'];
            }
        }
        if (count($threads) < 1) {
            error($lang->error_nosearchresults);
        }
        $threads = implode(',', $threads);
        $firstposts = implode(',', $firstposts);
        if ($firstposts) {
            $query = $db->simple_select("posts", "pid", "pid IN ({$firstposts}) AND visible >= '0' {$limitsql}");
            while ($post = $db->fetch_array($query)) {
                $posts[$post['pid']] = $post['pid'];
            }
            $posts = implode(',', $posts);
        }
    }
    return array("threads" => $threads, "posts" => $posts, "querycache" => '');
}
开发者ID:benn0034,项目名称:SHIELDsite2.old,代码行数:101,代码来源:functions_search.php


示例8: postParser

require_once MYBB_ROOT . "inc/class_parser.php";
$parser = new postParser();
// Load global language phrases
$lang->load("portal");
// Fetch the current URL
$portal_url = get_current_location();
add_breadcrumb($lang->nav_portal, "portal.php");
$plugins->run_hooks("portal_start");
// get forums user cannot view
$unviewable = get_unviewable_forums(true);
if ($unviewable) {
    $unviewwhere = " AND fid NOT IN ({$unviewable})";
    $tunviewwhere = " AND t.fid NOT IN ({$unviewable})";
}
// get inactive forums
$inactive = get_inactive_forums(true);
if ($inactive) {
    $inactivewhere = " AND fid NOT IN ({$inactive})";
    $tinactivewhere = " AND t.fid NOT IN ({$inactive})";
}
// If user is known, welcome them
if ($mybb->settings['portal_showwelcome'] != 0) {
    if ($mybb->user['uid'] != 0) {
        // Get number of new posts, threads, announcements
        $query = $db->simple_select("posts", "COUNT(pid) AS newposts", "visible=1 AND dateline>'" . $mybb->user['lastvisit'] . "' {$unviewwhere}{$inactivewhere}");
        $newposts = $db->fetch_field($query, "newposts");
        if ($newposts) {
            // If there aren't any new posts, there is no point in wasting two more queries
            $query = $db->simple_select("threads", "COUNT(tid) AS newthreads", "visible=1 AND dateline>'" . $mybb->user['lastvisit'] . "' {$unviewwhere}{$inactivewhere}");
            $newthreads = $db->fetch_field($query, "newthreads");
            if (!empty($mybb->settings['portal_announcementsfid'])) {
开发者ID:dequeues,项目名称:mybb,代码行数:31,代码来源:portal.php


示例9: asb_rand_quote_get_quote

function asb_rand_quote_get_quote($settings, $width)
{
    global $db, $mybb, $templates, $lang, $theme;
    if (!$lang->asb_addon) {
        $lang->load('asb_addon');
    }
    // get forums user cannot view
    $unviewable = get_unviewable_forums(true);
    if ($unviewable) {
        $unviewwhere = " AND p.fid NOT IN ({$unviewable})";
    }
    // get inactive forums
    $inactive = get_inactive_forums();
    if ($inactive) {
        $inactivewhere = " AND p.fid NOT IN ({$inactive})";
    }
    if ($settings['important_threads_only']) {
        $important_threads = ' AND NOT t.sticky=0';
    }
    // build the exclude conditions
    $show['fids'] = asb_build_id_list($settings['forum_show_list'], 'p.fid');
    $show['tids'] = asb_build_id_list($settings['thread_show_list'], 'p.tid');
    $hide['fids'] = asb_build_id_list($settings['forum_hide_list'], 'p.fid');
    $hide['tids'] = asb_build_id_list($settings['thread_hide_list'], 'p.tid');
    $where['show'] = asb_build_SQL_where($show, ' OR ');
    $where['hide'] = asb_build_SQL_where($hide, ' OR ', ' NOT ');
    $query_where = $important_threads . $unviewwhere . $inactivewhere . asb_build_SQL_where($where, ' AND ', ' AND ');
    $post_query = $db->query("\n\t\tSELECT\n\t\t\tp.pid, p.message, p.fid, p.tid, p.subject, p.uid,\n\t\t\tu.username, u.usergroup, u.displaygroup, u.avatar,\n\t\t\tt.sticky\n\t\tFROM {$db->table_prefix}posts p\n\t\tLEFT JOIN {$db->table_prefix}users u ON (u.uid=p.uid)\n\t\tLEFT JOIN {$db->table_prefix}threads t ON (t.tid=p.tid)\n\t\tWHERE\n\t\t\tp.visible='1'{$query_where}\n\t\tORDER BY\n\t\t\tRAND()\n\t\tLIMIT 1;");
    // if there was 1 . . .
    if ($db->num_rows($post_query) == 0) {
        return false;
    }
    $rand_post = $db->fetch_array($post_query);
    // build a post parser
    require_once MYBB_ROOT . 'inc/class_parser.php';
    $parser = new postParser();
    // we just need the text and smilies (we'll parse them after we check length)
    $pattern = "|[[\\/\\!]*?[^\\[\\]]*?]|si";
    $new_message = asb_strip_url(preg_replace($pattern, '$1', $rand_post['message']));
    // get some dimensions that make sense in relation to column width
    $asb_width = (int) $width;
    $asb_inner_size = $asb_width * 0.83;
    $avatar_size = (int) ($asb_inner_size / 5);
    $font_size = $asb_width / 4.5;
    $font_size = max(10, min(16, $font_size));
    $username_font_size = (int) ($font_size * 0.9);
    $title_font_size = (int) ($font_size * 0.65);
    $message_font_size = (int) $font_size;
    if (strlen($new_message) < $settings['min_length']) {
        if ($settings['default_text']) {
            $new_message = $settings['default_text'];
        } else {
            // nothing to show
            return false;
        }
    }
    if ($settings['max_length'] && strlen($new_message) > $settings['max_length']) {
        $new_message = substr($new_message, 0, $settings['max_length']) . ' . . .';
    }
    // set up the user name link so that it displays correctly for the display group of the user
    $plain_text_username = htmlspecialchars_uni($rand_post['username']);
    $username = format_name($plain_text_username, $rand_post['usergroup'], $rand_post['displaygroup']);
    $author_link = get_profile_link($rand_post['uid']);
    $post_link = get_post_link($rand_post['pid'], $rand_post['tid']) . '#pid' . $rand_post['pid'];
    $thread_link = get_thread_link($rand_post['tid']);
    // allow smilies, but kill
    $parser_options = array("allow_smilies" => 1);
    $new_message = str_replace(array('<br />', '/me'), array('', " * {$plain_text_username}"), $parser->parse_message($new_message . ' ', $parser_options));
    // if the user has an avatar then display it, otherwise force the default avatar.
    $avatar_filename = "{$theme['imgdir']}/default_avatar.gif";
    if ($rand_post['avatar'] != '') {
        $avatar_filename = $rand_post['avatar'];
    }
    $avatar_alt = $lang->sprintf($lang->asb_random_quote_users_profile, $plain_text_username);
    eval("\$read_more = \"" . $templates->get('asb_rand_quote_read_more') . "\";");
    if (my_strlen($rand_post['subject']) > 40) {
        $rand_post['subject'] = my_substr($rand_post['subject'], 0, 40) . ' . . .';
    }
    if (substr(strtolower($rand_post['subject']), 0, 3) == 're:') {
        $rand_post['subject'] = substr($rand_post['subject'], 3);
    }
    $rand_post['subject'] = htmlspecialchars_uni($parser->parse_badwords($rand_post['subject']));
    $thread_title_link = <<<EOF
<strong><a href="{$thread_link}" title="{$lang->asb_random_quotes_read_more_threadlink_title}"><span style="font-size: {$title_font_size}px;">{$rand_post['subject']}</span></a></strong>
EOF;
    // eval() the template
    eval("\$this_quote = \"" . $templates->get("asb_rand_quote_sidebox") . "\";");
    return $this_quote;
}
开发者ID:badboy4life91,项目名称:Advanced-Sidebox,代码行数:89,代码来源:rand_quote.php


示例10: buildSQLWhere

 /**
  * Prepare WHERE statement for unread posts search query
  *      
  */
 private function buildSQLWhere()
 {
     if ($this->where != '') {
         return;
     }
     // Standard where
     $this->where .= "t.visible = 1 AND t.closed NOT LIKE 'moved|%'";
     // Only one fid theme
     if ($this->fid) {
         $this->where .= " AND t.fid = '{$this->fid}'";
     }
     // Exceptions
     if ($this->getConfig('Exceptions') != '') {
         $exceptions_list = explode(',', $this->getConfig('Exceptions'));
         $exceptions_list = array_map('intval', $exceptions_list);
         if (sizeof($exceptions_list) > 0) {
             $this->where .= " AND t.fid NOT IN (" . implode(',', $exceptions_list) . ")";
         }
     }
     // Permissions
     $onlyusfids = array();
     // Check group permissions if we can't view threads not started by us
     $group_permissions = forum_permissions();
     foreach ($group_permissions as $fid => $forum_permissions) {
         if ($forum_permissions['canonlyviewownthreads'] == 1) {
             $onlyusfids[] = $fid;
         }
     }
     if (!empty($onlyusfids)) {
         $this->where .= " AND ((t.fid IN(" . implode(',', $onlyusfids) . ") AND t.uid='{$mybb->user['uid']}') OR t.fid NOT IN(" . implode(',', $onlyusfids) . "))";
     }
     // Unsearchable forums
     if (!function_exists('get_unsearchable_forums')) {
         require_once MYBB_ROOT . "inc/functions_search.php";
     }
     global $permissioncache, $unsearchableforums;
     $permissioncache = $unsearchableforums = false;
     $unsearchforums = get_unsearchable_forums();
     if ($unsearchforums) {
         $this->where .= " AND t.fid NOT IN ({$unsearchforums})";
     }
     // Inactive forums
     $inactiveforums = get_inactive_forums();
     if ($inactiveforums) {
         $this->where .= " AND t.fid NOT IN ({$inactiveforums})";
     }
 }
开发者ID:kpietrek,项目名称:MyBB-View_Unread_posts,代码行数:51,代码来源:unreadPosts.php


示例11: latest_threads_get_threadlist

function latest_threads_get_threadlist($settings, $width)
{
    global $db, $mybb, $templates, $lang, $cache, $gotounread, $theme;
    if (!$lang->asb_addon) {
        $lang->load('asb_addon');
    }
    if ($mybb->user['uid'] == 0) {
        $query = $db->query("\n\t\t\tSELECT\n\t\t\t\tfid\n\t\t\tFROM {$db->table_prefix}forums\n\t\t\tWHERE\n\t\t\t\tactive != 0\n\t\t\tORDER BY\n\t\t\t\tpid, disporder\n\t\t");
        $forumsread = my_unserialize($mybb->cookies['mybb']['forumread']);
    } else {
        $query = $db->query("\n\t\t\tSELECT\n\t\t\t\tf.fid, fr.dateline AS lastread\n\t\t\tFROM {$db->table_prefix}forums f\n\t\t\tLEFT JOIN {$db->table_prefix}forumsread fr ON (fr.fid=f.fid AND fr.uid='{$mybb->user['uid']}')\n\t\t\tWHERE\n\t\t\t\tf.active != 0\n\t\t\tORDER BY\n\t\t\t\tpid, disporder\n\t\t");
    }
    while ($forum = $db->fetch_array($query)) {
        if ($mybb->user['uid'] == 0) {
            if ($forumsread[$forum['fid']]) {
                $forum['lastread'] = $forumsread[$forum['fid']];
            }
        }
        $readforums[$forum['fid']] = $forum['lastread'];
    }
    // Build a post parser
    require_once MYBB_ROOT . 'inc/class_parser.php';
    $parser = new postParser();
    // get forums user cannot view
    $unviewable = get_unviewable_forums(true);
    if ($unviewable) {
        $unviewwhere = " AND t.fid NOT IN ({$unviewable})";
    }
    // get inactive forums
    $inactive = get_inactive_forums();
    if ($inactive) {
        $inactivewhere = " AND t.fid NOT IN ({$inactive})";
    }
    // new threads only?
    if ((int) $settings['new_threads_only'] > 0) {
        // use admin's time limit
        $thread_time_limit = TIME_NOW - 60 * 60 * 24 * (int) $settings['new_threads_only'];
        $new_threads = " AND t.dateline > {$thread_time_limit}";
    }
    if ($settings['important_threads_only']) {
        $important_threads = ' AND NOT t.sticky=0';
    }
    // build the exclude conditions
    $show['fids'] = asb_build_id_list($settings['forum_show_list'], 't.fid');
    $show['tids'] = asb_build_id_list($settings['thread_show_list'], 't.tid');
    $hide['fids'] = asb_build_id_list($settings['forum_hide_list'], 't.fid');
    $hide['tids'] = asb_build_id_list($settings['thread_hide_list'], 't.tid');
    $where['show'] = asb_build_SQL_where($show, ' OR ');
    $where['hide'] = asb_build_SQL_where($hide, ' OR ', ' NOT ');
    $query_where = $new_threads . $important_threads . $unviewwhere . $inactivewhere . asb_build_SQL_where($where, ' AND ', ' AND ');
    $altbg = alt_trow();
    $maxtitlelen = 48;
    $threadlist = '';
    // query for the latest forum discussions
    $query = $db->query("\n\t\tSELECT\n\t\t\tt.*,\n\t\t\tu.username, u.avatar, u.usergroup, u.displaygroup\n\t\tFROM {$db->table_prefix}threads t\n\t\tLEFT JOIN {$db->table_prefix}users u ON (u.uid=t.lastposteruid)\n\t\tWHERE\n\t\t\tt.visible='1' AND t.closed NOT LIKE 'moved|%'{$query_where}\n\t\tORDER BY\n\t\t\tt.lastpost DESC\n\t\tLIMIT\n\t\t\t0, " . (int) $settings['max_threads']);
    if ($db->num_rows($query) == 0) {
        // no content
        return false;
    }
    $thread_cache = array();
    while ($thread = $db->fetch_array($query)) {
        $thread_cache[$thread['tid']] = $thread;
    }
    $thread_ids = implode(",", array_keys($thread_cache));
    // fetch the read threads.
    if ($mybb->user['uid'] && $mybb->settings['threadreadcut'] > 0) {
        $query = $db->simple_select('threadsread', 'tid,dateline', "uid='{$mybb->user['uid']}' AND tid IN({$thread_ids})");
        while ($readthread = $db->fetch_array($query)) {
            $thread_cache[$readthread['tid']]['lastread'] = $readthread['dateline'];
        }
    }
    foreach ($thread_cache as $thread) {
        $forumpermissions[$thread['fid']] = forum_permissions($thread['fid']);
        // make sure we can view this thread
        if ($forumpermissions[$thread['fid']]['canview'] == 0 || $forumpermissions[$thread['fid']]['canviewthreads'] == 0 || $forumpermissions[$thread['fid']]['canonlyviewownthreads'] == 1 && $thread['uid'] != $mybb->user['uid']) {
            continue;
        }
        $lastpostdate = my_date($mybb->settings['dateformat'], $thread['lastpost']);
        $lastposttime = my_date($mybb->settings['timeformat'], $thread['lastpost']);
        // don't link to guest's profiles (they have no profile).
        if ($thread['lastposteruid'] == 0) {
            $lastposterlink = $thread['lastposter'];
        } else {
            if ($settings['last_poster_avatar']) {
                if (strlen(trim($thread['avatar'])) == 0) {
                    $thread['avatar'] = "{$theme['imgdir']}/default_avatar.gif";
                }
                $avatar_width = (int) min($width / 2, max($width / 8, $settings['avatar_width']));
                $last_poster_name = <<<EOF
<img src="{$thread['avatar']}" alt="{$thread['last_post']}" title="{$thread['lastposter']}'s profile" style="width: {$avatar_width}px;"/>
EOF;
                format_name($thread['lastposter'], $thread['usergroup'], $thread['displaygroup']);
                $lp_template = 'asb_latest_threads_last_poster_avatar';
            } else {
                $last_poster_name = format_name($thread['lastposter'], $thread['usergroup'], $thread['displaygroup']);
                $lp_template = 'asb_latest_threads_last_poster_name';
            }
            $lastposterlink = build_profile_link($last_poster_name, $thread['lastposteruid']);
        }
        if (my_strlen($thread['subject']) > $maxtitlelen) {
//.........这里部分代码省略.........
开发者ID:badboy4life91,项目名称:Advanced-Sidebox,代码行数:101,代码来源:latest_threads.php


示例12: latestposts

function latestposts()
{
    global $mybb, $lang, $db, $templates, $postslist, $sidebar, $right, $left;
    $lang->load("latestposts");
    $threadlimit = (int) $mybb->settings['latestposts_threadcount'];
    $where = NULL;
    if (!$threadlimit) {
        $threadlimit = 15;
    }
    if ($mybb->settings['latestposts_forumskip']) {
        $where .= " AND t.fid NOT IN(" . $mybb->settings['latestposts_forumskip'] . ") ";
    }
    require_once MYBB_ROOT . "inc/functions_search.php";
    $unsearchforums = get_unsearchable_forums();
    if ($unsearchforums) {
        $where .= " AND t.fid NOT IN ({$unsearchforums})";
    }
    $inactiveforums = get_inactive_forums();
    if ($inactiveforums) {
        $where .= " AND t.fid NOT IN ({$inactiveforums})";
    }
    $permissions = forum_permissions();
    for ($i = 0; $i <= sizeof($permissions); $i++) {
        if (isset($permissions[$i]['fid']) && ($permissions[$i]['canview'] == 0 || $permissions[$i]['canviewthreads'] == 0)) {
            $where .= " AND t.fid <> " . $permissions[$i]['fid'];
        }
    }
    $where .= " AND p.visible <> -1";
    $query = $db->query("\r\n\t\tSELECT t.*, u.username AS userusername, u.usergroup, u.displaygroup, lp.usergroup AS lastusergroup, lp.displaygroup as lastdisplaygroup, p.visible\r\n\t\tFROM " . TABLE_PREFIX . "threads t\r\n\t\tLEFT JOIN " . TABLE_PREFIX . "users u ON (u.uid=t.uid)\r\n\t\tLEFT JOIN " . TABLE_PREFIX . "users lp ON (t.lastposteruid=lp.uid)\r\n\t\tLEFT JOIN " . TABLE_PREFIX . "posts p ON (t.tid=p.tid AND replyto = 0)\r\n        WHERE 1=1 {$where}\r\n\t\tORDER BY t.lastpost DESC\r\n\t\tLIMIT {$threadlimit}\r\n\t");
    while ($thread = $db->fetch_array($query)) {
        $tid = $thread['tid'];
        $postname = $thread['subject'];
        $lastpostlink = get_thread_link($thread['tid'], "", "lastpost");
        $lastposttimeago = my_date("relative", $thread['lastpost']);
        $lastposter = $thread['lastposter'];
        $lastposteruid = $thread['lastposteruid'];
        if ($mybb->settings['latestposts_showtime'] == 1) {
            $lang->latestposttime = $lang->sprintf($lang->latestposttime, $lastposttimeago);
        } else {
            $lang->latestposttime = NULL;
        }
        if ($lastposteruid == 0) {
            $lastposterlink = $lastposter;
        } else {
            $lastposterlink = build_profile_link(format_name($lastposter, $thread['lastusergroup'], $thread['lastdisplaygroup']), $lastposteruid);
        }
        eval("\$postslist .= \"" . $templates->get("index_sidebar_post") . "\";");
    }
    if ($mybb->settings['latestposts_rightorleft'] == "right") {
        $right = "right";
        $left = "left";
    } else {
        $right = "left";
        $left = "right";
    }
    eval("\$sidebar = \"" . $templates->get("index_sidebar") . "\";");
}
开发者ID:andarms,项目名称:python-gaming.com,代码行数:57,代码来源:latestposts.php


示例13: recent_posts_get_postlist

function recent_posts_get_postlist($settings)
{
    global $db, $mybb, $templates, $lang, $cache, $postlist, $gotounread, $theme;
    // load custom language phrases
    if (!$lang->asb_addon) {
        $lang->load('asb_addon');
    }
    // get forums user cannot view
    $unviewable = get_unviewable_forums(true);
    if ($unviewable) {
        $unviewwhere = " AND p.fid NOT IN ({$unviewable})";
    }
    // get inactive forums
    $inactive = get_inactive_forums();
    if ($inactive) {
        $inactivewhere = " AND p.fid NOT IN ({$inactive})";
    }
    if ($settings['important_threads_only']) {
        $important_threads = ' AND NOT t.sticky=0';
    }
    // build the exclude conditions
    $show['fids'] = asb_build_id_list($settings['forum_show_list'], 'p.fid');
    $show['tids'] = asb_build_id_list($settings['thread_show_list'], 'p.tid');
    $hide['fids'] = asb_build_id_list($settings['forum_hide_list'], 'p.fid');
    $hide['tids'] = asb_build_id_list($settings['thread_hide_list'], 'p.tid');
    $where['show'] = asb_build_SQL_where($show, ' OR ');
    $where['hide'] = asb_build_SQL_where($hide, ' OR ', ' NOT ');
    $query_where = $important_threads . $unviewwhere . $inactivewhere . asb_build_SQL_where($where, ' AND ', ' AND ');
    $altbg = alt_trow();
    $maxtitlelen = 48;
    $postlist = '';
    // Query for the latest forum discussions
    $query = $db->query("\n\t\tSELECT p.tid, p.pid, p.message, p.fid, p.dateline, p.subject,\n\t\t\tu.username, u.uid, u.displaygroup, u.usergroup,\n\t\t\tt.sticky\n\t\tFROM {$db->table_prefix}posts p\n\t\tLEFT JOIN {$db->table_prefix}users u ON (u.uid=p.uid)\n\t\tLEFT JOIN {$db->table_prefix}threads t ON (t.tid=p.tid)\n\t\tWHERE\n\t\t\tp.visible='1'{$query_where}\n\t\tORDER BY\n\t\t\tp.dateline DESC\n\t\tLIMIT\n\t\t\t0, " . (int) $settings['max_posts']);
    if ($db->num_rows($query) == 0) {
        // no content
        return false;
    }
    // Build a post parser
    require_once MYBB_ROOT . 'inc/class_parser.php';
    $parser = new postParser();
    $post_cache = array();
    while ($post = $db->fetch_array($query)) {
        $post_cache[$post['pid']] = $post;
    }
    foreach ($post_cache as $post) {
        $forumpermissions[$post['fid']] = forum_permissions($post['fid']);
        // make sure we can view this post
        if ($forumpermissions[$post['fid']]['canview'] == 0 || $forumpermissions[$post['fid']]['canviewthreads'] == 0 || $forumpermissions[$post['fid']]['canonlyviewownthreads'] == 1 && $post['uid'] != $mybb->user['uid']) {
            continue;
        }
        $lastposttime = my_date($mybb->settings['timeformat'], $post['dateline']);
        // don't link to guest's profiles (they have no profile).
        if ($post['uid'] == 0) {
            $post_author = $post['username'];
        } else {
            $post_author_name = format_name($post['username'], $post['usergroup'], $post['displaygroup']);
            $post_author = build_profile_link($post_author_name, $post['uid']);
        }
        if (my_strlen($post['subject']) > $maxtitlelen) {
            $post['subject'] = my_substr($post['subject'], 0, $maxtitlelen) . '...';
        }
        if (substr(strtolower($post['subject']), 0, 3) == 're:') {
            $post['subject'] = substr($post['subject'], 3);
        }
        $post['subject'] = htmlspecialchars_uni($parser->parse_badwords($post['subject']));
        $post['link'] = get_thread_link($post['tid']) . "&amp;pid={$post['pid']}#pid{$post['pid']}";
        // we just need the text and smilies (we'll parse them after we check length)
        $pattern = "|[[\\/\\!]*?[^\\[\\]]*?]|si";
        $post_excerpt = strip_tags(str_replace('<br />', '', asb_strip_url(preg_replace($pattern, '$1', $post['message']))));
        if (strlen($post_excerpt) > $settings['max_length']) {
            $post_excerpt = substr($post_excerpt, 0, $settings['max_length']) . ' . . .';
        }
        eval("\$postlist .= \"" . $templates->get("asb_recent_posts_post") . "\";");
        $altbg = alt_trow();
    }
    return $postlist;
}
开发者ID:badboy4life91,项目名称:Advanced-Sidebox,代码行数:77,代码来源:recent_posts.php



注:本文中的get_inactive_forums函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP get_include_contents函数代码示例发布时间:2022-05-15
下一篇:
PHP get_importers函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap