当前位置: 首页>>代码示例>>PHP>>正文


PHP verify_forum_password函数代码示例

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


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

示例1: getData

 public function getData()
 {
     if ($this->config['newposts_forumids']) {
         if (in_array(-1, $this->config['newposts_forumids'])) {
             $forumids = array_keys($this->registry->forumcache);
         } else {
             $forumids = $this->config['newposts_forumids'];
         }
     } else {
         $forumids = array_keys($this->registry->forumcache);
     }
     foreach ($forumids as $forumid) {
         $forumperms =& $this->registry->userinfo['forumpermissions']["{$forumid}"];
         if ($forumperms & $this->registry->bf_ugp_forumpermissions['canview'] and $forumperms & $this->registry->bf_ugp_forumpermissions['canviewothers'] and $forumperms & $this->registry->bf_ugp_forumpermissions['canviewthreads'] and verify_forum_password($forumid, $this->registry->forumcache["{$forumid}"]['password'], false)) {
             $forumchoice[] = $forumid;
         }
     }
     if (!empty($forumchoice)) {
         $forumsql = "AND thread.forumid IN(" . implode(',', $forumchoice) . ")";
         // remove threads from users on the global ignore list if user is not a moderator
         $globalignore = '';
         if (trim($this->registry->options['globalignore']) != '') {
             require_once DIR . '/includes/functions_bigthree.php';
             if ($Coventry = fetch_coventry('string')) {
                 $globalignore = "AND post.userid NOT IN ({$Coventry}) ";
             }
         }
         $datecut = TIMENOW - $this->config['datecut'] * 86400;
         $posts = $this->registry->db->query_read_slave("\n\t\t\t\tSELECT post.dateline, post.pagetext AS message, post.allowsmilie, post.postid,\n\t\t\t\t\tthread.threadid, thread.title, thread.prefixid, post.attach,\n\t\t\t\t\tforum.forumid,\n\t\t\t\t\tuser.*\n\t\t\t\t\t" . ($this->registry->options['avatarenabled'] ? ",avatar.avatarpath, NOT ISNULL(customavatar.userid) AS hascustomavatar, customavatar.dateline AS avatardateline,customavatar.width AS avwidth,customavatar.height AS avheight" : "") . "\n\t\t\t\tFROM " . TABLE_PREFIX . "post AS post\n\t\t\t\tJOIN " . TABLE_PREFIX . "thread AS thread ON (thread.threadid = post.threadid)\n\t\t\t\tJOIN " . TABLE_PREFIX . "forum AS forum ON(forum.forumid = thread.forumid)\n\t\t\t\tLEFT JOIN " . TABLE_PREFIX . "user AS user ON (post.userid = user.userid)\n\t\t\t\t" . ($this->registry->products['vbcms'] ? " LEFT JOIN " . TABLE_PREFIX . "cms_nodeinfo AS info ON info.associatedthreadid = thread.threadid \n" : '') . ($this->registry->options['avatarenabled'] ? "LEFT JOIN " . TABLE_PREFIX . "avatar AS avatar ON(avatar.avatarid = user.avatarid) LEFT JOIN " . TABLE_PREFIX . "customavatar AS customavatar ON(customavatar.userid = user.userid)" : "") . "\n\t\t\tWHERE 1=1\n\t\t\t\t{$forumsql}\n\t\t\t\tAND thread.visible = 1\n\t\t\t\tAND post.visible = 1\n\t\t\t\tAND thread.open <> 10\n\t\t\t\tAND post.dateline > {$datecut}\n\t\t\t\t{$globalignore}\n\t\t\t\t" . ($this->userinfo['ignorelist'] ? "AND post.userid NOT IN (" . implode(',', explode(' ', $this->userinfo['ignorelist'])) . ")" : '') . ($this->registry->products['vbcms'] ? " AND info.associatedthreadid IS NULL " : '') . "\n\t\t\tORDER BY post.dateline DESC\n\t\t\tLIMIT 0," . intval($this->config['newposts_limit']) . "\n\t\t\t");
         while ($post = $this->registry->db->fetch_array($posts)) {
             //$post['url'] = fetch_seo_url('thread', $post, array('p' => $post['postid'])) . '#post' . $post['postid'];
             //$post['newposturl'] = fetch_seo_url('thread', $post, array('goto' => 'newpost'));
             // trim the title after fetching the urls
             //$post['title'] = fetch_trimmed_title($post['title'], $this->config['newposts_titlemaxchars']);
             //still need to censor the title
             $post['title'] = fetch_censored_text($post['title']);
             $post['date'] = vbdate($this->registry->options['dateformat'], $post['dateline'], true);
             $post['time'] = vbdate($this->registry->options['timeformat'], $post['dateline']);
             $post['message'] = $this->get_summary($post['message'], $this->config['newposts_messagemaxchars']);
             // get avatar
             $this->fetch_avatarinfo($post);
             $postarray[$post['postid']] = $post;
         }
         return $postarray;
     }
 }
开发者ID:0hyeah,项目名称:yurivn,代码行数:46,代码来源:newposts.php

示例2: fr_construct_forum_bit

function fr_construct_forum_bit($parentid, $depth = 0, $subsonly = 0)
{
    global $vbulletin, $vbphrase, $show;
    global $imodcache, $lastpostarray, $counters, $inforum;
    // Get exclude IDs
    $exclude_ids = @explode(',', $vbulletin->options['forumrunner_exclude']);
    if (in_array('-1', $exclude_ids)) {
        $exclude_ids = array();
    }
    if (in_array($parentid, $exclude_ids)) {
        return;
    }
    // this function takes the constant MAXFORUMDEPTH as its guide for how
    // deep to recurse down forum lists. if MAXFORUMDEPTH is not defined,
    // it will assume a depth of 2.
    // call fetch_last_post_array() first to get last post info for forums
    if (!is_array($lastpostarray)) {
        fetch_last_post_array($parentid);
    }
    if (empty($vbulletin->iforumcache["{$parentid}"])) {
        return;
    }
    if (!defined('MAXFORUMDEPTH')) {
        define('MAXFORUMDEPTH', 2);
    }
    $forumbits = '';
    $depth++;
    if ($parentid == -1) {
        $parent_is_category = false;
    } else {
        $parentforum = $vbulletin->forumcache[$parentid];
        $parent_is_category = !(bool) ($parentforum['options'] & $vbulletin->bf_misc_forumoptions['cancontainthreads']);
    }
    foreach ($vbulletin->iforumcache["{$parentid}"] as $forumid) {
        if (in_array($forumid, $exclude_ids)) {
            continue;
        }
        // grab the appropriate forum from the $vbulletin->forumcache
        $forum = $vbulletin->forumcache["{$forumid}"];
        //$lastpostforum = $vbulletin->forumcache["$lastpostarray[$forumid]"];
        $lastpostforum = empty($lastpostarray[$forumid]) ? array() : $vbulletin->forumcache["{$lastpostarray[$forumid]}"];
        if (!$forum['displayorder'] or !($forum['options'] & $vbulletin->bf_misc_forumoptions['active'])) {
            continue;
        }
        $forumperms = $vbulletin->userinfo['forumpermissions']["{$forumid}"];
        $lastpostforumperms = empty($lastpostarray[$forumid]) ? 0 : $vbulletin->userinfo['forumpermissions']["{$lastpostarray[$forumid]}"];
        if (!($forumperms & $vbulletin->bf_ugp_forumpermissions['canview']) and ($vbulletin->forumcache["{$forumid}"]['showprivate'] == 1 or !$vbulletin->forumcache["{$forumid}"]['showprivate'] and !$vbulletin->options['showprivateforums'])) {
            // no permission to view current forum
            continue;
        }
        if ($subsonly) {
            $childforumbits = fr_construct_forum_bit($forum['forumid'], 1, $subsonly);
        } else {
            if ($depth < MAXFORUMDEPTH) {
                $childforumbits = fr_construct_forum_bit($forum['forumid'], $depth, $subsonly);
            } else {
                $childforumbits = '';
            }
        }
        // do stuff if we are not doing subscriptions only, or if we ARE doing subscriptions,
        // and the forum has a subscribedforumid
        if (!$subsonly or $subsonly and !empty($forum['subscribeforumid'])) {
            $GLOBALS['forumshown'] = true;
            // say that we have shown at least one forum
            if ($forum['options'] & $vbulletin->bf_misc_forumoptions['cancontainthreads']) {
                // get appropriate suffix for template name
                $tempext = '_post';
            } else {
                $tempext = '_nopost';
            }
            if (!$vbulletin->options['showforumdescription']) {
                // blank forum description if set to not show
                $forum['description'] = '';
            }
            // dates & thread title
            $lastpostinfo = empty($lastpostarray["{$forumid}"]) ? array() : $vbulletin->forumcache["{$lastpostarray[$forumid]}"];
            // compare last post time for this forum with the last post time specified by
            // the $lastpostarray, and if it's less, use the last post info from the forum
            // specified by $lastpostarray
            if (!empty($lastpostinfo) and $vbulletin->forumcache["{$lastpostarray[$forumid]}"]['lastpost'] > 0) {
                if (!($lastpostforumperms & $vbulletin->bf_ugp_forumpermissions['canview']) or !($lastpostforumperms & $vbulletin->bf_ugp_forumpermissions['canviewothers']) and $lastpostinfo['lastposter'] != $vbulletin->userinfo['username']) {
                    $forum['lastpostinfo'] = $vbphrase['private'];
                } else {
                    $lastpostinfo['lastpostdate'] = vbdate($vbulletin->options['dateformat'], $lastpostinfo['lastpost'], 1);
                    $lastpostinfo['lastposttime'] = vbdate($vbulletin->options['timeformat'], $lastpostinfo['lastpost']);
                    $lastpostinfo['trimthread'] = fetch_trimmed_title(fetch_censored_text($lastpostinfo['lastthread']));
                    if ($lastpostinfo['lastprefixid'] and $vbulletin->options['showprefixlastpost']) {
                        $lastpostinfo['prefix'] = $vbulletin->options['showprefixlastpost'] == 2 ? $vbphrase["prefix_{$lastpostinfo['lastprefixid']}_title_rich"] : htmlspecialchars_uni($vbphrase["prefix_{$lastpostinfo['lastprefixid']}_title_plain"]);
                    } else {
                        $lastpostinfo['prefix'] = '';
                    }
                    if ($vbulletin->forumcache["{$lastpostforum['forumid']}"]['options'] & $vbulletin->bf_misc_forumoptions['allowicons'] and $icon = fetch_iconinfo($lastpostinfo['lasticonid'])) {
                        $show['icon'] = true;
                    } else {
                        $show['icon'] = false;
                    }
                    $show['lastpostinfo'] = (!$lastpostforum['password'] or verify_forum_password($lastpostforum['forumid'], $lastpostforum['password'], false));
                    $pageinfo_lastpost = array('p' => $lastpostinfo['lastpostid']);
                    $pageinfo_newpost = array('goto' => 'newpost');
                    $threadinfo = array('title' => $lastpostinfo['lastthread'], 'threadid' => $lastpostinfo['lastthreadid']);
//.........这里部分代码省略.........
开发者ID:0hyeah,项目名称:yurivn,代码行数:101,代码来源:forumbits.php

示例3: fetch_quotable_posts

/**
* Fetches and prepares posts for quoting. Returned text is BB code.
*
* @param	array	Array of post IDs to pull from
* @param	integer	The ID of the thread that is being quoted into
* @param	integer	Returns the number of posts that were unquoted because of the value of the next argument
* @param	array	Returns the IDs of the posts that were actually quoted
* @param	string	Controls what posts are successfully quoted: all, only (only the thread ID), other (only other thread IDs)
* @param	boolean	Whether to undo the htmlspecialchars calls; useful when returning HTML to be entered via JS
*/
function fetch_quotable_posts($quote_postids, $threadid, &$unquoted_posts, &$quoted_post_ids, $limit_thread = 'only', $unhtmlspecialchars = false)
{
    global $vbulletin;
    $unquoted_posts = 0;
    $quoted_post_ids = array();
    $quote_postids = array_diff_assoc(array_unique(array_map('intval', $quote_postids)), array(0));
    // limit to X number of posts
    if ($vbulletin->options['mqlimit'] > 0) {
        $quote_postids = array_slice($quote_postids, 0, $vbulletin->options['mqlimit']);
    }
    if (empty($quote_postids)) {
        // nothing to quote
        return '';
    }
    $hook_query_fields = $hook_query_joins = '';
    ($hook = vBulletinHook::fetch_hook('quotable_posts_query')) ? eval($hook) : false;
    $quote_post_data = $vbulletin->db->query_read_slave("\n\t\tSELECT post.postid, post.title, post.pagetext, post.dateline, post.userid, post.visible AS postvisible,\n\t\t\tIF(user.username <> '', user.username, post.username) AS username,\n\t\t\tthread.threadid, thread.title AS threadtitle, thread.postuserid, thread.visible AS threadvisible,\n\t\t\tforum.forumid, forum.password\n\t\t\t{$hook_query_fields}\n\t\tFROM " . TABLE_PREFIX . "post AS post\n\t\tLEFT JOIN " . TABLE_PREFIX . "user AS user ON (post.userid = user.userid)\n\t\tINNER JOIN " . TABLE_PREFIX . "thread AS thread ON (post.threadid = thread.threadid)\n\t\tINNER JOIN " . TABLE_PREFIX . "forum AS forum ON (thread.forumid = forum.forumid)\n\t\t{$hook_query_joins}\n\t\tWHERE post.postid IN (" . implode(',', $quote_postids) . ")\n\t");
    $quote_posts = array();
    while ($quote_post = $vbulletin->db->fetch_array($quote_post_data)) {
        if ((!$quote_post['postvisible'] or $quote_post['postvisible'] == 2) and !can_moderate($quote_post['forumid']) or (!$quote_post['threadvisible'] or $quote_post['threadvisible'] == 2) and !can_moderate($quote_post['forumid'])) {
            // no permission to view this post
            continue;
        }
        $forumperms = fetch_permissions($quote_post['forumid']);
        if (!($forumperms & $vbulletin->bf_ugp_forumpermissions['canview']) or !($forumperms & $vbulletin->bf_ugp_forumpermissions['canviewthreads']) or !($forumperms & $vbulletin->bf_ugp_forumpermissions['canviewothers']) and ($quote_post['postuserid'] != $vbulletin->userinfo['userid'] or $vbulletin->userinfo['userid'] == 0) or !verify_forum_password($quote_post['forumid'], $quote_post['password'], false) or in_coventry($quote_post['postuserid']) and !can_moderate($quote_post['forumid']) or in_coventry($quote_post['userid']) and !can_moderate($quote_post['forumid'])) {
            // no permission to view this post
            continue;
        }
        if ($limit_thread == 'only' and $quote_post['threadid'] != $threadid or $limit_thread == 'other' and $quote_post['threadid'] == $threadid or $limit_thread == 'all') {
            $unquoted_posts++;
            continue;
        }
        $skip_post = false;
        ($hook = vBulletinHook::fetch_hook('quotable_posts_logic')) ? eval($hook) : false;
        if ($skip_post) {
            continue;
        }
        $quote_posts["{$quote_post['postid']}"] = $quote_post;
    }
    $message = '';
    foreach ($quote_postids as $quote_postid) {
        if (!isset($quote_posts["{$quote_postid}"])) {
            continue;
        }
        $quote_post =& $quote_posts["{$quote_postid}"];
        $originalposter = fetch_quote_username($quote_post['username'] . ";{$quote_post['postid']}");
        $postdate = vbdate($vbulletin->options['dateformat'], $quote_post['dateline']);
        $posttime = vbdate($vbulletin->options['timeformat'], $quote_post['dateline']);
        $pagetext = htmlspecialchars_uni($quote_post['pagetext']);
        $pagetext = trim(strip_quotes($pagetext));
        ($hook = vBulletinHook::fetch_hook('newreply_quote')) ? eval($hook) : false;
        eval('$message .= "' . fetch_template('newpost_quote', 0, false) . '\\n";');
        $quoted_post_ids[] = $quote_postid;
    }
    if ($unhtmlspecialchars) {
        $message = unhtmlspecialchars($message);
    }
    return $message;
}
开发者ID:holandacz,项目名称:nb4,代码行数:69,代码来源:functions_newpost.php

示例4: verify_permissions

 /**
  * Verifies permissions to attach content to posts
  *
  * @param	array	Contenttype information - bypass reading environment settings
  *
  * @return	boolean
  */
 public function verify_permissions($info = array())
 {
     global $show;
     if ($info) {
         $this->values['postid'] = $info['postid'];
         $this->values['threadid'] = $info['threadid'];
         $this->values['forumid'] = $info['forumid'];
     } else {
         $this->values['postid'] = intval($this->values['p']) ? intval($this->values['p']) : intval($this->values['postid']);
         $this->values['threadid'] = intval($this->values['t']) ? intval($this->values['t']) : intval($this->values['threadid']);
         $this->values['forumid'] = intval($this->values['f']) ? intval($this->values['f']) : intval($this->values['forumid']);
     }
     if ($this->values['postid']) {
         if (!($this->postinfo = fetch_postinfo($this->values['postid']))) {
             return false;
         }
         $this->values['threadid'] = $this->postinfo['threadid'];
     }
     if ($this->values['threadid']) {
         if (!($this->threadinfo = fetch_threadinfo($this->values['threadid']))) {
             return false;
         }
         $this->values['forumid'] = $this->threadinfo['forumid'];
     }
     if ($this->values['forumid'] and !($this->foruminfo = fetch_foruminfo($this->values['forumid']))) {
         return false;
     }
     if (!$this->foruminfo and !$this->threadinfo and !($this->postinfo and $this->values['editpost'])) {
         return false;
     }
     $forumperms = fetch_permissions($this->foruminfo['forumid']);
     // No permissions to post attachments in this forum or no permission to view threads in this forum.
     if (!($forumperms & $this->registry->bf_ugp_forumpermissions['canpostattachment']) or !($forumperms & $this->registry->bf_ugp_forumpermissions['canview']) or !($forumperms & $this->registry->bf_ugp_forumpermissions['canviewthreads'])) {
         return false;
     }
     if (!$this->postinfo and !$this->foruminfo['allowposting'] or $this->foruminfo['link'] or !$this->foruminfo['cancontainthreads']) {
         return false;
     }
     if ($this->threadinfo) {
         if ($this->threadinfo['isdeleted'] or !$this->threadinfo['visible'] and !can_moderate($this->threadinfo['forumid'], 'canmoderateposts')) {
             return false;
         }
         if (!$this->threadinfo['open']) {
             if (!can_moderate($this->threadinfo['forumid'], 'canopenclose')) {
                 return false;
             }
         }
         if ($this->registry->userinfo['userid'] != $this->threadinfo['postuserid'] and (!($forumperms & $this->registry->bf_ugp_forumpermissions['canviewothers']) or !($forumperms & $this->registry->bf_ugp_forumpermissions['canreplyothers']))) {
             return false;
         }
         // don't call this part on editpost.php (which will have a $postid)
         if (!$this->postinfo and !($forumperms & $this->registry->bf_ugp_forumpermissions['canreplyown']) and $this->registry->userinfo['userid'] == $this->threadinfo['postuserid']) {
             return false;
         }
     } else {
         if (!($forumperms & $this->registry->bf_ugp_forumpermissions['canpostnew'])) {
             return false;
         }
     }
     if ($this->postinfo) {
         if (!can_moderate($this->threadinfo['forumid'], 'caneditposts')) {
             if (!($forumperms & $this->registry->bf_ugp_forumpermissions['caneditpost'])) {
                 return false;
             } else {
                 if ($this->registry->userinfo['userid'] != $this->postinfo['userid']) {
                     // check user owns this post
                     return false;
                 } else {
                     // check for time limits
                     if ($this->postinfo['dateline'] < TIMENOW - $this->registry->options['edittimelimit'] * 60 and $this->registry->options['edittimelimit']) {
                         return false;
                     }
                 }
             }
         }
         $this->contentid = $this->postinfo['postid'];
         $this->userinfo = fetch_userinfo($this->postinfo['userid']);
         cache_permissions($this->userinfo, true);
     } else {
         $this->userinfo = $this->registry->userinfo;
     }
     // check if there is a forum password and if so, ensure the user has it set
     verify_forum_password($this->foruminfo['forumid'], $this->foruminfo['password'], false);
     if (!$this->foruminfo['allowposting']) {
         $show['attachoption'] = false;
         $show['forumclosed'] = true;
     }
     return true;
 }
开发者ID:0hyeah,项目名称:yurivn,代码行数:96,代码来源:post.php

示例5: fetch_foruminfo

// *********************************************************************************
// get forum info
$forum = fetch_foruminfo($thread['forumid']);
$foruminfo =& $forum;
// *********************************************************************************
// check forum permissions
$forumperms = fetch_permissions($thread['forumid']);
if (!($forumperms & $vbulletin->bf_ugp_forumpermissions['canview']) or !($forumperms & $vbulletin->bf_ugp_forumpermissions['canviewthreads'])) {
    print_no_permission();
}
if (!($forumperms & $vbulletin->bf_ugp_forumpermissions['canviewothers']) and ($thread['postuserid'] != $vbulletin->userinfo['userid'] or $vbulletin->userinfo['userid'] == 0)) {
    print_no_permission();
}
// *********************************************************************************
// check if there is a forum password and if so, ensure the user has it set
verify_forum_password($foruminfo['forumid'], $foruminfo['password']);
// *********************************************************************************
// jump page if thread is actually a redirect
if ($thread['open'] == 10) {
    $destthreadinfo = fetch_threadinfo($threadinfo['pollid']);
    exec_header_redirect(fetch_seo_url('thread|js', $destthreadinfo, $pageinfo));
}
// *********************************************************************************
// get ignored users
$ignore = array();
if (trim($vbulletin->userinfo['ignorelist'])) {
    $ignorelist = preg_split('/( )+/', trim($vbulletin->userinfo['ignorelist']), -1, PREG_SPLIT_NO_EMPTY);
    foreach ($ignorelist as $ignoreuserid) {
        $ignore["{$ignoreuserid}"] = 1;
    }
}
开发者ID:0hyeah,项目名称:yurivn,代码行数:31,代码来源:showthread.php

示例6: array

 // set display terms
 $display = array('words' => array(), 'highlight' => array(), 'common' => array(), 'users' => array(), 'forums' => $display['forums'], 'options' => array('starteronly' => false, 'childforums' => true, 'action' => $_REQUEST['do']));
 ($hook = vBulletinHook::fetch_hook('search_getnew_display')) ? eval($hook) : false;
 // get moderator cache for forum password purposes
 if ($vbulletin->userinfo['userid']) {
     cache_moderators();
 }
 // get forum ids for all forums user is allowed to view
 foreach ($forumids as $key => $forumid) {
     if (is_array($includearray) and empty($includearray["{$forumid}"])) {
         unset($forumids["{$key}"]);
         continue;
     }
     $fperms =& $vbulletin->userinfo['forumpermissions']["{$forumid}"];
     $forum =& $vbulletin->forumcache["{$forumid}"];
     if (!($fperms & $vbulletin->bf_ugp_forumpermissions['canview']) or !($fperms & $vbulletin->bf_ugp_forumpermissions['cansearch']) or !verify_forum_password($forumid, $forum['password'], false)) {
         unset($forumids["{$key}"]);
     }
 }
 if (empty($forumids)) {
     eval(standard_error(fetch_error('invalidid', $vbphrase['forum'], $vbulletin->options['contactuslink'])));
 }
 if ($_REQUEST['do'] == 'getnew' and $vbulletin->userinfo['userid'] and $vbulletin->options['threadmarking'] and !$vbulletin->GPC['oldmethod']) {
     $marking_join = "\n\t\t\tLEFT JOIN " . TABLE_PREFIX . "threadread AS threadread ON (threadread.threadid = thread.threadid AND threadread.userid = " . $vbulletin->userinfo['userid'] . ")\n\t\t\tINNER JOIN " . TABLE_PREFIX . "forum AS forum ON (forum.forumid = thread.forumid)\n\t\t\tLEFT JOIN " . TABLE_PREFIX . "forumread AS forumread ON (forumread.forumid = forum.forumid AND forumread.userid = " . $vbulletin->userinfo['userid'] . ")\n\t\t";
     $cutoff = TIMENOW - $vbulletin->options['markinglimit'] * 86400;
     $lastpost_where = "\n\t\t\tAND thread.lastpost > IF(threadread.readtime IS NULL, {$cutoff}, threadread.readtime)\n\t\t\tAND thread.lastpost > IF(forumread.readtime IS NULL, {$cutoff}, forumread.readtime)\n\t\t\tAND thread.lastpost > {$cutoff}\n\t\t";
     $post_lastpost_where = "\n\t\t\tAND post.dateline > IF(threadread.readtime IS NULL, {$cutoff}, threadread.readtime)\n\t\t\tAND post.dateline > IF(forumread.readtime IS NULL, {$cutoff}, forumread.readtime)\n\t\t\tAND post.dateline > {$cutoff}\n\t\t";
 } else {
     $marking_join = '';
     $lastpost_where = "AND thread.lastpost >= {$datecut}";
     $post_lastpost_where = "AND post.dateline >= {$datecut}";
开发者ID:holandacz,项目名称:nb4,代码行数:31,代码来源:search.php

示例7: construct_forum_bit

function construct_forum_bit($parentid, $depth = 0, $subsonly = 0)
{
    global $vbulletin, $vbphrase, $show;
    global $imodcache, $lastpostarray, $counters, $inforum;
    // this function takes the constant MAXFORUMDEPTH as its guide for how
    // deep to recurse down forum lists. if MAXFORUMDEPTH is not defined,
    // it will assume a depth of 2.
    // call fetch_last_post_array() first to get last post info for forums
    if (!is_array($lastpostarray)) {
        fetch_last_post_array($parentid);
    }
    if (empty($vbulletin->iforumcache["{$parentid}"])) {
        return;
    }
    if (!defined('MAXFORUMDEPTH')) {
        define('MAXFORUMDEPTH', 2);
    }
    $forumbits = '';
    $depth++;
    if ($parentid == -1) {
        $parent_is_category = false;
    } else {
        $parentforum = $vbulletin->forumcache[$parentid];
        $parent_is_category = !(bool) ($parentforum['options'] & $vbulletin->bf_misc_forumoptions['cancontainthreads']);
    }
    foreach ($vbulletin->iforumcache["{$parentid}"] as $forumid) {
        // grab the appropriate forum from the $vbulletin->forumcache
        $forum = $vbulletin->forumcache["{$forumid}"];
        //$lastpostforum = $vbulletin->forumcache["$lastpostarray[$forumid]"];
        $lastpostforum = empty($lastpostarray[$forumid]) ? array() : $vbulletin->forumcache["{$lastpostarray[$forumid]}"];
        if (!$forum['displayorder'] or !($forum['options'] & $vbulletin->bf_misc_forumoptions['active'])) {
            continue;
        }
        $forumperms = $vbulletin->userinfo['forumpermissions']["{$forumid}"];
        $lastpostforumperms = empty($lastpostarray[$forumid]) ? 0 : $vbulletin->userinfo['forumpermissions']["{$lastpostarray[$forumid]}"];
        if (!($forumperms & $vbulletin->bf_ugp_forumpermissions['canview']) and ($vbulletin->forumcache["{$forumid}"]['showprivate'] == 1 or !$vbulletin->forumcache["{$forumid}"]['showprivate'] and !$vbulletin->options['showprivateforums'])) {
            // no permission to view current forum
            continue;
        }
        if ($subsonly) {
            $childforumbits = construct_forum_bit($forum['forumid'], 1, $subsonly);
        } else {
            if ($depth < MAXFORUMDEPTH) {
                $childforumbits = construct_forum_bit($forum['forumid'], $depth, $subsonly);
            } else {
                $childforumbits = '';
            }
        }
        // do stuff if we are not doing subscriptions only, or if we ARE doing subscriptions,
        // and the forum has a subscribedforumid
        if (!$subsonly or $subsonly and !empty($forum['subscribeforumid'])) {
            $GLOBALS['forumshown'] = true;
            // say that we have shown at least one forum
            if ($forum['options'] & $vbulletin->bf_misc_forumoptions['cancontainthreads']) {
                // get appropriate suffix for template name
                $tempext = '_post';
            } else {
                $tempext = '_nopost';
            }
            if (!$vbulletin->options['showforumdescription']) {
                // blank forum description if set to not show
                $forum['description'] = '';
            }
            // dates & thread title
            $lastpostinfo = empty($lastpostarray["{$forumid}"]) ? array() : $vbulletin->forumcache["{$lastpostarray[$forumid]}"];
            // compare last post time for this forum with the last post time specified by
            // the $lastpostarray, and if it's less, use the last post info from the forum
            // specified by $lastpostarray
            if (!empty($lastpostinfo) and $vbulletin->forumcache["{$lastpostarray[$forumid]}"]['lastpost'] > 0) {
                if (!($lastpostforumperms & $vbulletin->bf_ugp_forumpermissions['canview']) or !($lastpostforumperms & $vbulletin->bf_ugp_forumpermissions['canviewothers']) and $lastpostinfo['lastposter'] != $vbulletin->userinfo['username']) {
                    $forum['lastpostinfo'] = $vbphrase['private'];
                } else {
                    $lastpostinfo['lastpostdate'] = vbdate($vbulletin->options['dateformat'], $lastpostinfo['lastpost'], 1);
                    $lastpostinfo['lastposttime'] = vbdate($vbulletin->options['timeformat'], $lastpostinfo['lastpost']);
                    $lastpostinfo['trimthread'] = fetch_trimmed_title(fetch_censored_text($lastpostinfo['lastthread']));
                    if ($lastpostinfo['lastprefixid'] and $vbulletin->options['showprefixlastpost']) {
                        $lastpostinfo['prefix'] = $vbulletin->options['showprefixlastpost'] == 2 ? $vbphrase["prefix_{$lastpostinfo['lastprefixid']}_title_rich"] : htmlspecialchars_uni($vbphrase["prefix_{$lastpostinfo['lastprefixid']}_title_plain"]);
                    } else {
                        $lastpostinfo['prefix'] = '';
                    }
                    if ($vbulletin->forumcache["{$lastpostforum['forumid']}"]['options'] & $vbulletin->bf_misc_forumoptions['allowicons'] and $icon = fetch_iconinfo($lastpostinfo['lasticonid'])) {
                        $show['icon'] = true;
                    } else {
                        $show['icon'] = false;
                    }
                    $show['lastpostinfo'] = (!$lastpostforum['password'] or verify_forum_password($lastpostforum['forumid'], $lastpostforum['password'], false));
                    $pageinfo_lastpost = array('p' => $lastpostinfo['lastpostid']);
                    $pageinfo_newpost = array('goto' => 'newpost');
                    $threadinfo = array('title' => $lastpostinfo['lastthread'], 'threadid' => $lastpostinfo['lastthreadid']);
                    // prepare the member action drop-down menu
                    $memberaction_dropdown = construct_memberaction_dropdown(fetch_lastposter_userinfo($lastpostinfo));
                    $templater = vB_Template::create('forumhome_lastpostby');
                    $templater->register('icon', $icon);
                    $templater->register('memberaction_dropdown', $memberaction_dropdown);
                    $templater->register('lastpostinfo', $lastpostinfo);
                    $templater->register('pageinfo_lastpost', $pageinfo_lastpost);
                    $templater->register('pageinfo_newpost', $pageinfo_newpost);
                    $templater->register('threadinfo', $threadinfo);
                    $forum['lastpostinfo'] = $templater->render();
                }
//.........这里部分代码省略.........
开发者ID:0hyeah,项目名称:yurivn,代码行数:101,代码来源:functions_forumlist.php

示例8: and

$show['avatarlink'] = $vbulletin->options['avatarenabled'];
$show['profilepiclink'] = ($vbulletin->userinfo['permissions']['genericpermissions'] & $vbulletin->bf_ugp_genericpermissions['canprofilepic'] and $vbulletin->options['profilepicenabled']);
$show['wollink'] = $vbulletin->userinfo['permissions']['wolpermissions'] & $vbulletin->bf_ugp_wolpermissions['canwhosonline'];
$show['spacer'] = true;
// used in postbit template
if (THIS_SCRIPT == 'register') {
    // see 3.6 bug 876 -- causes double redirect and error when activating
    $show['dst_correction'] = false;
} else {
    $show['dst_correction'] = (($vbulletin->session->vars['loggedin'] == 1 or $vbulletin->session->created or THIS_SCRIPT == 'usercp') and $vbulletin->userinfo['dstauto'] == 1 and $vbulletin->userinfo['userid']);
}
$show['contactus'] = ($vbulletin->options['contactuslink'] and (!$vbulletin->userinfo['userid'] and $vbulletin->options['contactustype'] or $vbulletin->userinfo['userid']));
$show['forumdesc'] = ($vbulletin->options['nav_forumdesc'] and trim($foruminfo['description']) != '' and in_array(THIS_SCRIPT, array('newthread', 'newreply', 'forumdisplay', 'showthread', 'announcement', 'editpost', 'poll', 'report', 'sendmessage', 'threadrate')));
$show['foruminfo'] = (THIS_SCRIPT == 'forumdisplay' and $vbulletin->userinfo['forumpermissions']["{$foruminfo['forumid']}"] & $vbulletin->bf_ugp_forumpermissions['canview']) ? true : false;
if (THIS_SCRIPT == 'showthread' and $threadinfo['threadid']) {
    if (!($vbulletin->userinfo['forumpermissions']["{$foruminfo['forumid']}"] & $vbulletin->bf_ugp_forumpermissions['canview']) or (!$threadinfo['visible'] and !can_moderate($foruminfo['forumid'], 'canmoderateposts') or $threadinfo['isdeleted'] and !can_moderate($foruminfo['forumid'])) or in_coventry($threadinfo['postuserid']) and !can_moderate($foruminfo['forumid']) or !($vbulletin->userinfo['forumpermissions']["{$foruminfo['forumid']}"] & $vbulletin->bf_ugp_forumpermissions['canviewthreads']) or !($vbulletin->userinfo['forumpermissions']["{$foruminfo['forumid']}"] & $vbulletin->bf_ugp_forumpermissions['canviewothers']) and ($threadinfo['postuserid'] != $vbulletin->userinfo['userid'] or $vbulletin->userinfo['userid'] == 0) or !verify_forum_password($foruminfo['forumid'], $foruminfo['password'], false)) {
        $show['threadinfo'] = false;
    } else {
        $show['threadinfo'] = true;
    }
} else {
    $show['threadinfo'] = false;
}
// you may define this if you don't want the password in the login box to be zapped onsubmit; good for integration
$show['nopasswordempty'] = defined('DISABLE_PASSWORD_CLEARING') ? 1 : 0;
// this nees to be an int for the templates
$ad_location = array();
// parse some global templates
eval('$gobutton = "' . fetch_template('gobutton') . '";');
eval('$spacer_open = "' . fetch_template('spacer_open') . '";');
eval('$spacer_close = "' . fetch_template('spacer_close') . '";');
开发者ID:holandacz,项目名称:nb4,代码行数:31,代码来源:global.php

示例9: getHiddenForums

	/**
	* Get forums the user is unable to view.
	*
	*	Need to verify that this makes sense in general code stolen from search
	* logic and search specific param removed.
	*
	*	This value is calculated once and the list is returned on subsequent calls
	*
	*	@return array(int) list of hidden forum ids 
	*/
	public function getHiddenForums()
	{
		if (is_null($this->hidden_forums))
		{
			$this->hidden_forums = array();
			foreach ($this->registry->userinfo['forumpermissions'] AS $forumid => $fperms)
			{
				$forum = fetch_foruminfo($forumid);
				if (
					!$this->hasForumPermission($forumid, 'canview') OR 
					!verify_forum_password($forumid, $forum['password'], false)  
				)
				{
					$this->hidden_forums[] = $forumid;
				}
			}
		}
		return $this->hidden_forums;
	}
开发者ID:hungnv0789,项目名称:vhtm,代码行数:29,代码来源:currentuser.php

示例10: populateViewContent


//.........这里部分代码省略.........
				$taggable = vB_Taggable_Content_Item::create(vB::$vbulletin, $this->content->getContentTypeId(),
					$this->content->getContentId(), $this->content);
				$view->tags = $taggable->fetch_rendered_tag_list();
				$view->tag_count = $taggable->fetch_existing_tag_count();
				$view->showtags = vB::$vbulletin->options['threadtagging'];

				// promoted threadid
				if ($promoted_threadid = $this->content->getThreadId())
				{
					if ($promoted_threadid = verify_id('thread', $promoted_threadid, false))
					{
						// get threadinfo
						$threadinfo = fetch_threadinfo($promoted_threadid);
						$forumperms = fetch_permissions($threadinfo['forumid']);
						$view->threadinfo = $threadinfo;
						// check permissions
						if ($threadinfo['visible'] != 1)
						{
							$promoted_threadid = false;
						}
						else if (!($forumperms & vB::$vbulletin->bf_ugp_forumpermissions['canview'])
							OR !($forumperms & vB::$vbulletin->bf_ugp_forumpermissions['canviewthreads'])
							OR (!($forumperms & vB::$vbulletin->bf_ugp_forumpermissions['canviewothers'])
								AND ($threadinfo['postuserid'] != vB::$vbulletin->userinfo['userid'] OR vB::$vbulletin->userinfo['userid'] == 0)
							))
						{
							$promoted_threadid = false;
						}
						else
						{
							// check forum password
							$foruminfo = fetch_foruminfo($threadinfo['forumid']);

							if ($foruminfo['password'] AND !verify_forum_password($foruminfo['forumid'], $foruminfo['password'], false))
							{
								$promoted_threadid = false;
							}
						}

						$view->promoted_threadid = $promoted_threadid;
					}
				}

				// get pagelist for navigation
				$view->postitle = $this->content->getPostTitle();
				$view->poststarter = $this->content->getPostStarter();
				$view->postauthor = $this->content->getPostAuthor();
				$view->postid = ($this->content->getPostId());
				$view->threadid = $this->content->getThreadId();
				$view->blogpostid = ($this->content->getBlogPostId());
				$view->post_started = ($this->content->getPostStarted());
				$view->post_posted = ($this->content->getPostPosted());
				$view->promoted_blogid = $this->content->getBlogId();

				//make links to original post and/or blog if appropriate
				if ($view->promoted_blogid)
				{
					$view->blog_url = fetch_seo_url('blog',
						array('userid' => $this->content->getPostStarter(),
						'blog_title' => $this->content->getPostTitle()));
				}
				else if ($view->threadid)
				{
					$threadinfo = vB::$vbulletin->db->query_first("SELECT threadid, title FROM " .
						TABLE_PREFIX . "thread where threadid = " . $view->threadid);
开发者ID:hungnv0789,项目名称:vhtm,代码行数:66,代码来源:article.php

示例11: handle_attach

function handle_attach($action, $attributes, $content, $params, $node_object)
{
    global $vbulletin, $fr_platform, $db, $contenttype, $images, $nuke_quotes;
    if ($action == 'validate') {
        return true;
    }
    if (!is_numeric($content)) {
        return $content;
    }
    $attachmentid = intval($content);
    if ($fr_platform == 'vb40') {
        $_REQUEST['attachmentid'] = $attachmentid;
        if (!($attach =& vB_Attachment_Display_Single_Library::fetch_library($vbulletin, $contenttype, true, $attachmentid))) {
            return '';
        }
        $result = $attach->verify_attachment();
        if ($result !== true) {
            return '';
        }
        $url = $vbulletin->options['bburl'] . '/attachment.php?attachmentid=' . $attachmentid;
        if (!$nuke_quotes) {
            $images[] = $url;
        }
        return "<img src=\"{$url}\"/>";
    } else {
        if ($fr_platform == 'vb38' || $fr_platform == 'vb37' || $fr_platform == 'vb36') {
            if (!($attachmentinfo = $db->query_first_slave("\n\t    SELECT filename, attachment.postid, attachment.userid, attachmentid, attachment.extension,\n\t    " . (!empty($vbulletin->GPC['thumb']) ? 'thumbnail_dateline AS dateline, thumbnail_filesize AS filesize,' : 'attachment.dateline, filesize,') . "\n\t    attachment.visible, attachmenttype.newwindow, mimetype, thread.forumid, thread.threadid, thread.postuserid,\n\t    post.visible AS post_visible, thread.visible AS thread_visible\n\t    {$hook_query_fields}\n\t    FROM " . TABLE_PREFIX . "attachment AS attachment\n\t    LEFT JOIN " . TABLE_PREFIX . "attachmenttype AS attachmenttype ON (attachmenttype.extension = attachment.extension)\n\t    LEFT JOIN " . TABLE_PREFIX . "post AS post ON (post.postid = attachment.postid)\n\t    LEFT JOIN " . TABLE_PREFIX . "thread AS thread ON (post.threadid = thread.threadid)\n\t    {$hook_query_joins}\n\t    WHERE " . ($vbulletin->GPC['postid'] ? "attachment.postid = " . $vbulletin->GPC['postid'] : "attachmentid = " . $attachmentid) . "\n\t    {$hook_query_where}\n\t    "))) {
                return '';
            }
            if ($attachmentinfo['postid'] == 0) {
                // Attachment that is in progress but hasn't been finalized
                if ($vbulletin->userinfo['userid'] != $attachmentinfo['userid'] and !can_moderate($attachmentinfo['forumid'], 'caneditposts')) {
                    // Person viewing did not upload it
                    return '';
                }
                // else allow user to view the attachment (from the attachment manager for example)
            } else {
                $forumperms = fetch_permissions($attachmentinfo['forumid']);
                $threadinfo = array('threadid' => $attachmentinfo['threadid']);
                // used for session.inthread
                $foruminfo = array('forumid' => $attachmentinfo['forumid']);
                // used for session.inforum
                # Block attachments belonging to soft deleted posts and threads
                if (!can_moderate($attachmentinfo['forumid']) and ($attachmentinfo['post_visible'] == 2 or $attachmentinfo['thread_visible'] == 2)) {
                    return '';
                }
                # Block attachments belonging to moderated posts and threads
                if (!can_moderate($attachmentinfo['forumid'], 'canmoderateposts') and ($attachmentinfo['post_visible'] == 0 or $attachmentinfo['thread_visible'] == 0)) {
                    return '';
                }
                $viewpermission = $forumperms & $vbulletin->bf_ugp_forumpermissions['cangetattachment'];
                $viewthumbpermission = ($forumperms & $vbulletin->bf_ugp_forumpermissions['cangetattachment'] or $forumperms & $vbulletin->bf_ugp_forumpermissions['canseethumbnails']);
                if (!($forumperms & $vbulletin->bf_ugp_forumpermissions['canview']) or !($forumperms & $vbulletin->bf_ugp_forumpermissions['canviewthreads']) or !($forumperms & $vbulletin->bf_ugp_forumpermissions['canviewothers']) and ($attachmentinfo['postuserid'] != $vbulletin->userinfo['userid'] or $vbulletin->userinfo['userid'] == 0)) {
                    return '';
                } else {
                    if ($vbulletin->GPC['thumb'] and !$viewthumbpermission or !$vbulletin->GPC['thumb'] and !$viewpermission) {
                        return '';
                    }
                }
                // check if there is a forum password and if so, ensure the user has it set
                verify_forum_password($attachmentinfo['forumid'], $vbulletin->forumcache["{$attachmentinfo['forumid']}"]['password']);
                if (!$attachmentinfo['visible'] and !can_moderate($attachmentinfo['forumid'], 'canmoderateattachments') and $attachmentinfo['userid'] != $vbulletin->userinfo['userid']) {
                    print_no_permission();
                }
            }
            $url = $vbulletin->options['bburl'] . '/attachment.php?attachmentid=' . $attachmentid;
            if (!$nuke_quotes) {
                $images[] = $url;
                return "<img src=\"{$url}\"/>";
            } else {
                return '';
            }
        } else {
            return '';
        }
    }
}
开发者ID:0hyeah,项目名称:yurivn,代码行数:77,代码来源:utils.php

示例12: getPosts

	/**
	 * Fetches the array of posts
	 *
	 * @return array				- the post information
	 */
	private function getPosts()
	{
		require_once DIR . "/includes/functions_user.php";
		require_once DIR . "/includes/class_bbcode.php";
		$datecut = TIMENOW - ($this->config['days'] * 86400);

		if (empty(vB::$vbulletin->userinfo['forumpermissions']))
		{
			require_once DIR . "/includes/functions.php";
			cache_permissions($userinfo);
		}
		$postarray = array();
		//we have some existing settings with config['forumchoice'] set to 0=> ''; That's no good
		if (empty($this->config['forumchoice']))
		{
			$this->config['forumchoice'] = array();
		}
		else if (is_array($this->config['forumchoice']) AND ($this->config['forumchoice'][0] == '') )
		{
			unset($this->config['forumchoice'][0]);
		}

		if (is_array($this->config['forumchoice']) AND in_array('subscribed', $this->config['forumchoice']))
		{
			$subscribejoin = " LEFT JOIN " . TABLE_PREFIX .	"subscribeforum AS subscribeforum
				ON (subscribeforum.forumid = forum.forumid AND subscribeforum.userid = " . vB::$vbulletin->userinfo['userid'] .
			" ) ";
		}
		else
		{
			$subscribejoin = '';

		}
		$forumids = array_keys(vB::$vbulletin->forumcache);
		foreach ($forumids AS $forumid)
		{
			$forumperms =& vB::$vbulletin->userinfo['forumpermissions']["$forumid"];
			if ($forumperms & vB::$vbulletin->bf_ugp_forumpermissions['canview']
				AND ($forumperms & vB::$vbulletin->bf_ugp_forumpermissions['canviewothers'])
				AND (($forumperms & vB::$vbulletin->bf_ugp_forumpermissions['canviewthreads']))
				AND verify_forum_password($forumid, vB::$vbulletin->forumcache["$forumid"]['password'], false)
				)
			{
					//Don't include the comments forum.
				if (vB::$vbulletin->options['vbcmsforumid'] AND (intval(vB::$vbulletin->options['vbcmsforumid']) == intval($forumid)))
				{
					continue;
				}
				//Or, if the user selected forums, anything not on the list.
				else if (! empty($this->config['forumchoice']) AND !in_array($forumid, $this->config['forumchoice']))
				{
					continue;
				}
				$forumchoice[] = $forumid;
			}
		}

		if (!empty($forumchoice) )
		{
			$forumsql = " AND (" . (empty($subscribejoin) ? '' : "subscribeforum.forumid IS NOT NULL OR ") . " thread.forumid IN(" . implode(',', $forumchoice) . ")";
			$associatedthread = (vB::$vbulletin->options['vbcmsforumid'] ?
					" AND (thread.forumid <> " . vB::$vbulletin->options['vbcmsforumid'] . ") )" : '');
		}
		else if (! empty($subscribejoin))
		{
			$forumsql = " AND subscribeforum.forumid IS NOT NULL ";
		}
		else
		{
			return $postarray;
		}

		$posts = vB::$vbulletin->db->query_read_slave($sql = "
			SELECT post.dateline, post.pagetext, post.allowsmilie, post.postid,
				thread.threadid, thread.title, thread.prefixid, post.attach, thread.replycount,
				forum.forumid, post.title AS posttitle, post.dateline AS postdateline,
				user.userid, user.username
				" . (vB::$vbulletin->options['avatarenabled'] ? ",avatar.avatarpath,
				(customavatar.userid) AS hascustomavatar, customavatar.dateline AS avatardateline,
				customavatar.width AS avwidth,customavatar.height AS avheight" : "") .
		 "	FROM " . TABLE_PREFIX . "post AS post
			JOIN " . TABLE_PREFIX . "thread AS thread ON (thread.threadid = post.threadid)
			JOIN " . TABLE_PREFIX . "forum AS forum ON(forum.forumid = thread.forumid)
			LEFT JOIN " . TABLE_PREFIX . "user AS user ON (post.userid = user.userid)
			" . (vB::$vbulletin->options['avatarenabled'] ? "LEFT JOIN " . TABLE_PREFIX . "avatar AS avatar ON(avatar.avatarid = user.avatarid) LEFT JOIN " . TABLE_PREFIX . "customavatar AS customavatar ON(customavatar.userid = user.userid)" : "") . "
			$subscribejoin
			WHERE 1=1
				$forumsql
				$associatedthread
				AND thread.visible = 1
				AND post.visible = 1
				AND thread.open <> 10
				AND post.dateline > $datecut
				$globalignore
				" . ($this->userinfo['ignorelist'] ? "AND post.userid NOT IN (" . implode(',', explode(' ', $this->userinfo['ignorelist'])) . ")": '') . "
//.........这里部分代码省略.........
开发者ID:hungnv0789,项目名称:vhtm,代码行数:101,代码来源:recentposts.php

示例13: do_get_forum_data

function do_get_forum_data()
{
    global $vbulletin, $db, $show, $vbphrase;
    $vbulletin->input->clean_array_gpc('r', array('forumids' => TYPE_STR));
    if (!$vbulletin->GPC['forumids'] || strlen($vbulletin->GPC['forumids']) == 0) {
        return array('forums' => array());
    }
    cache_ordered_forums(1, 1);
    $forumids = split(',', $vbulletin->GPC['forumids']);
    $forum_data = array();
    foreach ($forumids as $forumid) {
        $foruminfo = fetch_foruminfo($forumid);
        $type = 'old';
        if (is_array($foruminfo) and !empty($foruminfo['link'])) {
            // see if it is a redirect
            $type = 'link';
        } else {
            if ($vbulletin->userinfo['lastvisitdate'] == -1) {
                $type = 'new';
            } else {
                if ($vbulletin->options['threadmarking'] and $vbulletin->userinfo['userid']) {
                    $userlastvisit = !empty($foruminfo['forumread']) ? $foruminfo['forumread'] : TIMENOW - $vbulletin->options['markinglimit'] * 86400;
                } else {
                    $forumview = intval(fetch_bbarray_cookie('forum_view', $foruminfo['forumid']));
                    //use which one produces the highest value, most likely cookie
                    $userlastvisit = $forumview > $vbulletin->userinfo['lastvisit'] ? $forumview : $vbulletin->userinfo['lastvisit'];
                }
                if ($foruminfo['lastpost'] and $userlastvisit < $foruminfo['lastpost']) {
                    $type = 'new';
                } else {
                    $type = 'old';
                }
            }
        }
        // If this forum has a password, check to see if we have
        // the proper cookie.  If so, don't prompt for one
        $password = false;
        if ($foruminfo['password']) {
            $pw_ok = verify_forum_password($foruminfo['forumid'], $foruminfo['password'], false);
            if (!$pw_ok) {
                $password = true;
            }
        }
        $out = array('id' => $foruminfo['forumid'], 'new' => $type == 'new' ? true : false, 'name' => prepare_utf8_string(strip_tags($foruminfo['title'])), 'password' => $password);
        $icon = fr_get_forum_icon($foruminfo['forumid'], $foruminfo == 'new');
        if ($icon) {
            $out['icon'] = $icon;
        }
        if ($foruminfo['link'] != '') {
            $link = fr_fix_url($foruminfo['link']);
            if (is_int($link)) {
                $out['id'] = $link;
            } else {
                $out['link'] = $link;
            }
            $linkicon = fr_get_forum_icon($foruminfo['forumid'], false, true);
            if ($linkicon) {
                $out['icon'] = $linkicon;
            }
        }
        if ($foruminfo['description'] != '') {
            $desc = prepare_utf8_string(strip_tags($foruminfo['description']));
            if (strlen($desc) > 0) {
                $out['desc'] = $desc;
            }
        }
        $forum_data[] = $out;
    }
    return array('forums' => $forum_data);
}
开发者ID:0hyeah,项目名称:yurivn,代码行数:70,代码来源:get_forum.php

示例14: do_get_announcement

function do_get_announcement()
{
    global $vbulletin, $db, $foruminfo;
    if (empty($foruminfo['forumid'])) {
        json_error(ERR_INVALID_FORUM);
    }
    $usesmilies = false;
    // begin vbulletin
    $forumlist = '';
    if ($announcementinfo['forumid'] > -1 or $vbulletin->GPC['forumid']) {
        $foruminfo = verify_id('forum', $vbulletin->GPC['forumid'], 1, 1);
        $curforumid = $foruminfo['forumid'];
        $forumperms = fetch_permissions($foruminfo['forumid']);
        if (!($forumperms & $vbulletin->bf_ugp_forumpermissions['canview']) or !($forumperms & $vbulletin->bf_ugp_forumpermissions['canviewthreads'])) {
            json_error(ERR_NO_PERMISSION);
        }
        // check if there is a forum password and if so, ensure the user has it set
        verify_forum_password($foruminfo['forumid'], $foruminfo['password']);
        $forumlist = fetch_forum_clause_sql($foruminfo['forumid'], 'announcement.forumid');
    } else {
        if (!$announcementinfo['announcementid']) {
            json_error(ERR_INVALID_ANNOUNCEMENT);
        }
    }
    $hook_query_fields = $hook_query_joins = $hook_query_where = '';
    $announcements = $db->query_read_slave("\n\t\tSELECT announcement.announcementid, announcement.announcementid AS postid, startdate, enddate, announcement.title, pagetext, announcementoptions, views, announcement.pagetext,\n\t\t\tuser.*, userfield.*, usertextfield.*,\n\t\t\tsigpic.userid AS sigpic, sigpic.dateline AS sigpicdateline, sigpic.width AS sigpicwidth, sigpic.height AS sigpicheight,\n\t\t\tIF(displaygroupid=0, user.usergroupid, displaygroupid) AS displaygroupid, infractiongroupid\n\t\t\t" . ($vbulletin->options['avatarenabled'] ? ",avatar.avatarpath, NOT ISNULL(customavatar.userid) AS hascustomavatar, customavatar.dateline AS avatardateline,customavatar.width AS avwidth,customavatar.height AS avheight" : "") . "\n\t\t\t" . ($vbulletin->userinfo['userid'] ? ", NOT ISNULL(announcementread.announcementid) AS readannouncement" : "") . "\n\t\t\t{$hook_query_fields}\n\t\tFROM  " . TABLE_PREFIX . "announcement AS announcement\n\t\t" . ($vbulletin->userinfo['userid'] ? "LEFT JOIN " . TABLE_PREFIX . "announcementread AS announcementread ON(announcementread.announcementid = announcement.announcementid AND announcementread.userid = " . $vbulletin->userinfo['userid'] . ")" : "") . "\n\t\tLEFT JOIN " . TABLE_PREFIX . "user AS user ON(user.userid=announcement.userid)\n\t\tLEFT JOIN " . TABLE_PREFIX . "userfield AS userfield ON(userfield.userid=announcement.userid)\n\t\tLEFT JOIN " . TABLE_PREFIX . "usertextfield AS usertextfield ON(usertextfield.userid=announcement.userid)\n\t\tLEFT JOIN " . TABLE_PREFIX . "sigpic AS sigpic ON(sigpic.userid = announcement.userid)\n\t\t" . ($vbulletin->options['avatarenabled'] ? "LEFT JOIN " . TABLE_PREFIX . "avatar AS avatar ON(avatar.avatarid=user.avatarid)\n\t\tLEFT JOIN " . TABLE_PREFIX . "customavatar AS customavatar ON(customavatar.userid=announcement.userid)" : "") . "\n\t\t{$hook_query_joins}\n\t\tWHERE\n\t\t\t" . ($vbulletin->GPC['announcementid'] ? "announcement.announcementid = " . $vbulletin->GPC['announcementid'] : "startdate <= " . TIMENOW . " AND enddate >= " . TIMENOW . " " . (!empty($forumlist) ? "AND {$forumlist}" : "")) . "\n\t\t\t{$hook_query_where}\n\t\tORDER BY startdate DESC, announcementid DESC\n\t");
    if ($db->num_rows($announcements) == 0) {
        // no announcements
        json_error(ERR_INVALID_ANNOUNCEMENT);
    }
    if (!$vbulletin->options['oneannounce'] and $vbulletin->GPC['announcementid'] and !empty($forumlist)) {
        $anncount = $db->query_first_slave("\n\t\t\tSELECT COUNT(*) AS total\n\t\t\tFROM " . TABLE_PREFIX . "announcement AS announcement\n\t\t\tWHERE startdate <= " . TIMENOW . "\n\t\t\t\tAND enddate >= " . TIMENOW . "\n\t\t\t\tAND {$forumlist}\n\t\t");
        $anncount['total'] = intval($anncount['total']);
        $show['viewall'] = $anncount['total'] > 1 ? true : false;
    } else {
        $show['viewall'] = false;
    }
    require_once DIR . '/includes/class_postbit.php';
    $show['announcement'] = true;
    $counter = 0;
    $anncids = array();
    $announcebits = '';
    $announceread = array();
    $postbit_factory = new vB_Postbit_Factory();
    $postbit_factory->registry =& $vbulletin;
    $postbit_factory->forum =& $foruminfo;
    $postbit_factory->cache = array();
    $postbit_factory->bbcode_parser = new vB_BbCodeParser($vbulletin, fetch_tag_list());
    while ($post = $db->fetch_array($announcements)) {
        $postbit_obj =& $postbit_factory->fetch_postbit('announcement');
        $post['counter'] = ++$counter;
        $postbit_obj->construct_postbit($post);
        $anncids[] = $post['announcementid'];
        $announceread[] = "({$post['announcementid']}, " . $vbulletin->userinfo['userid'] . ")";
        // FRNR start
        $fr_images = array();
        $docattach = array();
        // Attachments (images).
        if (is_array($post['attachments']) && count($post['attachments']) > 0) {
            foreach ($post['attachments'] as $attachment) {
                $lfilename = strtolower($attachment['filename']);
                if (strpos($lfilename, '.jpe') !== false || strpos($lfilename, '.png') !== false || strpos($lfilename, '.gif') !== false || strpos($lfilename, '.jpg') !== false || strpos($lfilename, '.jpeg') !== false) {
                    $tmp = array('img' => $vbulletin->options['bburl'] . '/attachment.php?attachmentid=' . $attachment['attachmentid']);
                    if ($vbulletin->options['attachthumbs']) {
                        $tmp['tmb'] = $vbulletin->options['bburl'] . '/attachment.php?attachmentid=' . $attachment['attachmentid'] . '&stc=1&thumb=1';
                    }
                    $fr_images[] = $tmp;
                }
                if (strpos($lfilename, '.pdf') !== false) {
                    $docattach[] = $vbulletin->options['bburl'] . '/attachment.php?attachmentid=' . $attachment['attachmentid'];
                }
            }
        }
        // Parse the post for quotes and inline images
        list($text, $nuked_quotes, $images) = parse_post($post['pagetext'], $usesmilies, $attachments);
        if (count($fr_images) > 0) {
            $text .= "<br/>";
            foreach ($fr_images as $attachment) {
                $text .= "<img src=\"{$attachment['img']}\"/>";
            }
        }
        foreach ($images as $image) {
            $fr_images[] = array('img' => $image);
        }
        // Avatar work
        $avatarurl = '';
        if ($post['avatarurl']) {
            $avatarurl = process_avatarurl($post['avatarurl']);
        }
        $tmp = array('username' => prepare_utf8_string(strip_tags($post['username'])), 'userid' => $post['userid'], 'title' => prepare_utf8_string($post['title']), 'text' => $text, 'post_timestamp' => prepare_utf8_string(date_trunc($post['startdate'])), 'fr_images' => $fr_images);
        if ($avatarurl != '') {
            $tmp['avatarurl'] = $avatarurl;
        }
        $posts_out[] = $tmp;
    }
    if (!empty($anncids)) {
        $db->shutdown_query("\n\t\t\tUPDATE " . TABLE_PREFIX . "announcement\n\t\t\tSET views = views + 1\n\t\t\tWHERE announcementid IN (" . implode(', ', $anncids) . ")\n\t\t");
        if ($vbulletin->userinfo['userid']) {
            $db->shutdown_query("\n\t\t\t\tREPLACE INTO " . TABLE_PREFIX . "announcementread\n\t\t\t\t\t(announcementid, userid)\n\t\t\t\tVALUES\n\t\t\t\t\t" . implode(', ', $announceread) . "\n\t\t\t");
        }
//.........这里部分代码省略.........
开发者ID:0hyeah,项目名称:yurivn,代码行数:101,代码来源:announcement.php

示例15: verify_ui_permissions

 public function verify_ui_permissions()
 {
     global $vbulletin;
     if (!$vbulletin->options['threadtagging']) {
         print_no_permission();
     }
     global $vbphrase;
     $threadinfo = $this->fetch_content_info();
     // *********************************************************************************
     // check for visible / deleted thread
     if (!$threadinfo['visible'] and !can_moderate($threadinfo['forumid'], 'canmoderateposts') or $threadinfo['isdeleted'] and !can_moderate($threadinfo['forumid'])) {
         eval(standard_error(fetch_error('invalidid', $vbphrase['thread'], $this->registry->options['contactuslink'])));
     }
     // *********************************************************************************
     // jump page if thread is actually a redirect
     if ($threadinfo['open'] == 10) {
         $destthreadinfo = fetch_threadinfo($threadinfo['pollid']);
         exec_header_redirect('thread|js', $destthreadinfo);
     }
     // *********************************************************************************
     // Tachy goes to coventry
     if (in_coventry($threadinfo['postuserid']) and !can_moderate($threadinfo['forumid'])) {
         eval(standard_error(fetch_error('invalidid', $vbphrase['thread'], $this->registry->options['contactuslink'])));
     }
     // *********************************************************************************
     // get forum info
     $foruminfo = fetch_foruminfo($threadinfo['forumid']);
     // *********************************************************************************
     // check forum permissions
     $forumperms = fetch_permissions($threadinfo['forumid']);
     if (!($forumperms & $this->registry->bf_ugp_forumpermissions['canview']) or !($forumperms & $this->registry->bf_ugp_forumpermissions['canviewthreads'])) {
         print_no_permission();
     }
     if (!($forumperms & $this->registry->bf_ugp_forumpermissions['canviewothers']) and ($threadinfo['postuserid'] != $this->registry->userinfo['userid'] or $this->registry->userinfo['userid'] == 0)) {
         print_no_permission();
     }
     // *********************************************************************************
     // check if there is a forum password and if so, ensure the user has it set
     verify_forum_password($foruminfo['forumid'], $foruminfo['password']);
     //		return $show;
 }
开发者ID:0hyeah,项目名称:yurivn,代码行数:41,代码来源:thread.php


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