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


PHP is_moderator函数代码示例

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


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

示例1: get_thread_by_unread_func

function get_thread_by_unread_func($xmlrpc_params)
{
    global $db, $mybb;
    $input = Tapatalk_Input::filterXmlInput(array('topic_id' => Tapatalk_Input::STRING, 'posts_per_request' => Tapatalk_Input::INT, 'return_html' => Tapatalk_Input::INT), $xmlrpc_params);
    if (preg_match('/^ann_/', $input['topic_id'])) {
        $_GET["aid"] = intval(str_replace('ann_', '', $input['topic_id']));
        return get_announcement_func($xmlrpc_params);
    }
    $thread = get_thread($input['topic_id']);
    if (!empty($thread['closed'])) {
        $moved = explode("|", $thread['closed']);
        if ($moved[0] == "moved") {
            $thread = get_thread($moved[1]);
        }
    }
    if (is_moderator($thread['fid'])) {
        $visible = "AND (p.visible='0' OR p.visible='1')";
    } else {
        $visible = "AND p.visible='1'";
    }
    $cutoff = 0;
    if ($mybb->settings['threadreadcut'] > 0) {
        $cutoff = TIME_NOW - $mybb->settings['threadreadcut'] * 60 * 60 * 24;
    }
    $query = $db->query("select min(p.pid) as pid from " . TABLE_PREFIX . "posts p\n        LEFT JOIN " . TABLE_PREFIX . "threadsread tr on p.tid = tr.tid and tr.uid = '{$mybb->user['uid']}'\n        where p.tid='{$thread['tid']}' and p.uid != '{$mybb->user['uid']}' and (p.dateline > tr.dateline or tr.dateline is null) and p.dateline > {$cutoff} {$visible}\n        ");
    $pid = $db->fetch_field($query, 'pid');
    if (!$pid) {
        $query = $db->query("select p.pid from " . TABLE_PREFIX . "posts p\n                             where p.tid='{$thread['tid']}' {$visible}\n                             order by p.dateline desc\n                             limit 1");
        $pid = $db->fetch_field($query, 'pid');
    }
    return get_thread_by_post_func(new xmlrpcval(array(new xmlrpcval($pid, "string"), new xmlrpcval($input['posts_per_request'], 'int'), new xmlrpcval(!!$input['return_html'], 'boolean')), 'array'));
}
开发者ID:dthiago,项目名称:tapatalk-mybb,代码行数:32,代码来源:get_thread_by_unread.php

示例2: is_moderator_or_die

function is_moderator_or_die()
{
    if (!is_moderator($_SESSION['username'])) {
        die("Must be a moderator to access this part of the website");
    }
    return true;
}
开发者ID:ekevans8,项目名称:DB_Project,代码行数:7,代码来源:utils.php

示例3: action

 /**
 This is where you perform the action when the API is called, the parameter given is an instance of stdClass, this method should return an instance of stdClass.
 */
 public function action()
 {
     global $mybb, $db;
     if ($this->is_authenticated()) {
         return $this->get_user();
     } elseif (isset($mybb->input["sessionid"]) && is_string($mybb->input["sessionid"])) {
         $sid = $db->escape_string($mybb->input["sessionid"]);
         $query = $db->query("SELECT s.uid FROM " . TABLE_PREFIX . "sessions s WHERE s.sid = '{$sid}'");
         $result = $db->fetch_array($query);
         if (empty($result)) {
             throw new UnauthorizedException("Not connected.");
         } else {
             $uid = $result['uid'];
             // no need to escape this, it's just been retrieved from db
             $query = $db->query("\n\t\t\t\t\tSELECT u.*, f.*\n\t\t\t\t\tFROM " . TABLE_PREFIX . "users u\n\t\t\t\t\tLEFT JOIN " . TABLE_PREFIX . "userfields f ON (f.ufid=u.uid)\n\t\t\t\t\tWHERE u.uid='{$uid}'\n\t\t\t\t\tLIMIT 1\n\t\t\t\t");
             $user = (object) $db->fetch_array($query);
             if (empty($user)) {
                 throw new UnauthorizedException("Not connected");
             }
             $user->ismoderator = is_moderator("", "", $uid);
             return $user;
         }
     } else {
         throw new UnauthorizedException("Not connected.");
     }
 }
开发者ID:Shade-,项目名称:MyBB-RESTful-API-System,代码行数:29,代码来源:authenticateapi.class.php

示例4: fetch_forum_announcements

function fetch_forum_announcements($pid = 0, $depth = 1)
{
    global $mybb, $db, $lang, $announcements, $templates, $announcements_forum, $moderated_forums;
    static $forums_by_parent, $forum_cache, $parent_forums;
    if (!is_array($forum_cache)) {
        $forum_cache = cache_forums();
    }
    if (!is_array($parent_forums) && $mybb->user['issupermod'] != 1) {
        // Get a list of parentforums to show for normal moderators
        $parent_forums = array();
        foreach ($moderated_forums as $mfid) {
            $parent_forums = array_merge($parent_forums, explode(',', $forum_cache[$mfid]['parentlist']));
        }
    }
    if (!is_array($forums_by_parent)) {
        foreach ($forum_cache as $forum) {
            $forums_by_parent[$forum['pid']][$forum['disporder']][$forum['fid']] = $forum;
        }
    }
    if (!is_array($forums_by_parent[$pid])) {
        return;
    }
    foreach ($forums_by_parent[$pid] as $children) {
        foreach ($children as $forum) {
            if ($forum['active'] == 0 || !is_moderator($forum['fid'])) {
                // Check if this forum is a parent of a moderated forum
                if (in_array($forum['fid'], $parent_forums)) {
                    // A child is moderated, so print out this forum's title.  RECURSE!
                    $trow = alt_trow();
                    eval("\$announcements_forum .= \"" . $templates->get("modcp_announcements_forum_nomod") . "\";");
                } else {
                    // No subforum is moderated by this mod, so safely continue
                    continue;
                }
            } else {
                // This forum is moderated by the user, so print out the forum's title, and its announcements
                $trow = alt_trow();
                $padding = 40 * ($depth - 1);
                eval("\$announcements_forum .= \"" . $templates->get("modcp_announcements_forum") . "\";");
                if ($announcements[$forum['fid']]) {
                    foreach ($announcements[$forum['fid']] as $aid => $announcement) {
                        $trow = alt_trow();
                        if ($announcement['enddate'] < TIME_NOW && $announcement['enddate'] != 0) {
                            $icon = "<img src=\"images/minioff.gif\" alt=\"({$lang->expired})\" title=\"{$lang->expired_announcement}\"  style=\"vertical-align: middle;\" /> ";
                        } else {
                            $icon = "<img src=\"images/minion.gif\" alt=\"({$lang->active})\" title=\"{$lang->active_announcement}\"  style=\"vertical-align: middle;\" /> ";
                        }
                        $subject = htmlspecialchars_uni($announcement['subject']);
                        eval("\$announcements_forum .= \"" . $templates->get("modcp_announcements_announcement") . "\";");
                    }
                }
            }
            // Build the list for any sub forums of this forum
            if ($forums_by_parent[$forum['fid']]) {
                fetch_forum_announcements($forum['fid'], $depth + 1);
            }
        }
    }
}
开发者ID:benn0034,项目名称:SHIELDsite2.old,代码行数:59,代码来源:functions_modcp.php

示例5: remove_attachment_func

function remove_attachment_func($xmlrpc_params)
{
    global $db, $lang, $theme, $plugins, $mybb, $session, $settings, $cache, $time, $mybbgroups;
    chdir("../");
    $lang->load("member");
    $parser = new postParser();
    $input = Tapatalk_Input::filterXmlInput(array('attachment_id' => Tapatalk_Input::INT, 'forum_id' => Tapatalk_Input::INT, 'group_id' => Tapatalk_Input::STRING, 'post_id' => Tapatalk_Input::INT), $xmlrpc_params);
    $fid = $input['forum_id'];
    $forum = get_forum($fid);
    if (!$forum) {
        return xmlrespfalse($lang->error_invalidforum);
    }
    $forumpermissions = forum_permissions($fid);
    if ($forum['open'] == 0 || $forum['type'] != "f") {
        return xmlrespfalse($lang->error_closedinvalidforum);
    }
    if ($mybb->user['uid'] < 1 || $forumpermissions['canview'] == 0 || $forumpermissions['canpostthreads'] == 0 || $mybb->user['suspendposting'] == 1) {
        return tt_no_permission();
    }
    tt_check_forum_password($forum['fid']);
    $posthash = $input['group_id'];
    $mybb->input['posthash'] = $posthash;
    // If we're removing an attachment that belongs to an existing post, some security checks...
    $query = $db->simple_select("attachments", "pid", "aid='{$input['attachment_id']}'");
    $attachment = $db->fetch_array($query);
    $pid = $attachment['pid'];
    if ($pid > 0) {
        if ($pid != $input['post_id']) {
            return xmlrespfalse("The attachment you are trying to remove does not belong to this post");
        }
        $query = $db->simple_select("posts", "*", "pid='{$pid}'");
        $post = $db->fetch_array($query);
        if (!$post['pid']) {
            return xmlrespfalse($lang->error_invalidpost);
        }
        // Get thread info
        $tid = $post['tid'];
        $thread = get_thread($tid);
        if (!$thread['tid']) {
            return xmlrespfalse($lang->error_invalidthread);
        }
        if (!is_moderator($fid, "caneditposts")) {
            if ($thread['closed'] == 1) {
                return xmlrespfalse($lang->redirect_threadclosed);
            }
            if ($forumpermissions['caneditposts'] == 0) {
                return tt_no_permission();
            }
            if ($mybb->user['uid'] != $post['uid']) {
                return tt_no_permission();
            }
        }
    } else {
        $pid = 0;
    }
    require_once MYBB_ROOT . "inc/functions_upload.php";
    remove_attachment($pid, $mybb->input['posthash'], $input['attachment_id']);
    return xmlresptrue();
}
开发者ID:dthiago,项目名称:tapatalk-mybb,代码行数:59,代码来源:remove_attachment.php

示例6: get_inbox_stat_func

function get_inbox_stat_func($xmlrpc_params)
{
    global $db, $lang, $theme, $plugins, $mybb, $session, $settings, $cache, $time, $mybbgroups;
    $input = Tapatalk_Input::filterXmlInput(array('pm_last_checked_time' => Tapatalk_Input::STRING, 'subscribed_topic_last_checked_time' => Tapatalk_Input::STRING), $xmlrpc_params);
    // PMs
    $query = $db->simple_select("privatemessages", "COUNT(*) AS pms_unread", "uid='" . $mybb->user['uid'] . "' AND status = '0' AND folder = '1'");
    $pmcount = $db->fetch_field($query, "pms_unread");
    // Subscribed threads
    $visible = "AND t.visible != 0";
    if (is_moderator() == true) {
        $visible = '';
    }
    if ($mybb->settings['threadreadcut'] > 0) {
        $cutoff = TIME_NOW - $mybb->settings['threadreadcut'] * 60 * 60 * 24;
    }
    $query = $db->query("\n\t\tSELECT COUNT(ts.tid) as threads\n\t\tFROM " . TABLE_PREFIX . "threadsubscriptions ts\n\t\tLEFT JOIN " . TABLE_PREFIX . "threads t ON (t.tid = ts.tid)\n\t\tleft join " . TABLE_PREFIX . "threadsread tr on t.tid = tr.tid and tr.uid = '{$mybb->user['uid']}'\n\t\tWHERE ts.uid = '" . $mybb->user['uid'] . "' and (tr.dateline < t.lastpost or tr.dateline is null) and t.lastpost > {$cutoff} {$visible}\n\t");
    $threadcount = $db->fetch_field($query, "threads");
    $result = new xmlrpcval(array('inbox_unread_count' => new xmlrpcval($pmcount, 'int'), 'subscribed_topic_unread_count' => new xmlrpcval($threadcount, 'int')), 'struct');
    return new xmlrpcresp($result);
}
开发者ID:dthiago,项目名称:tapatalk-mybb,代码行数:20,代码来源:get_inbox_stat.php

示例7: get_thread_by_post_func

function get_thread_by_post_func($xmlrpc_params)
{
    global $db, $mybb, $position;
    $input = Tapatalk_Input::filterXmlInput(array('post_id' => Tapatalk_Input::INT, 'posts_per_request' => Tapatalk_Input::INT, 'return_html' => Tapatalk_Input::INT), $xmlrpc_params);
    $post = get_post($input['post_id']);
    if (!$input['posts_per_request']) {
        $input['posts_per_request'] = 20;
    }
    if (is_moderator($post['fid'])) {
        $visible = "AND (visible='0' OR visible='1')";
    } else {
        $visible = "AND visible='1'";
    }
    $query = $db->simple_select("posts", "COUNT(*) AS position", "pid < '{$input['post_id']}' and tid='{$post['tid']}' {$visible}");
    $position = $db->fetch_field($query, 'position');
    $page = floor($position / $input['posts_per_request']) + 1;
    $position = $position + 1;
    $response = get_thread_func(new xmlrpcval(array(new xmlrpcval($post['tid'], "string"), new xmlrpcval(($page - 1) * $input['posts_per_request'], 'int'), new xmlrpcval(($page - 1) * $input['posts_per_request'] + $input['posts_per_request'], 'int'), new xmlrpcval(!!$input['return_html'], 'boolean')), 'array'));
    return $response;
}
开发者ID:dthiago,项目名称:tapatalk-mybb,代码行数:20,代码来源:get_thread_by_post.php

示例8: global_auth_check_user

 function global_auth_check_user($type, $key, $global_u_access, $is_admin)
 {
     $auth_user = 0;
     if (!empty($global_u_access)) {
         $result = 0;
         switch ($type) {
             case AUTH_ACL:
                 $result = $global_u_access[$key];
             case AUTH_MOD:
                 $result = $result || is_moderator($global_u_access['group_id']);
             case AUTH_ADMIN:
                 $result = $result || $is_admin;
                 break;
         }
         $auth_user = $auth_user || $result;
     } else {
         $auth_user = $is_admin;
     }
     return $auth_user;
 }
开发者ID:ALTUN69,项目名称:icy_phoenix,代码行数:20,代码来源:functions_pafiledb_admin.php

示例9: lasteditlock

function lasteditlock()
{
    global $db, $mybb, $forum;
    if ($mybb->input['action'] == "edit_post" || $mybb->input['action'] == "editpost") {
        $post = get_post(intval($mybb->input['pid']));
        $msg = "Sorry you can't edit a post once a moderator has edited it.";
        if (!is_moderator($forum['fid'], "canviewips") && ($post['edituid'] != $mybb->user['uid'] && $post['edituid'] != 0)) {
            switch ($mybb->input['action']) {
                case edit_post:
                    xmlhttp_error($msg);
                    break;
                case editpost:
                    error($msg);
                    break;
            }
            if ($mybb->input['do'] == "update_post") {
                error($msg);
            }
        }
    }
}
开发者ID:oduslabs,项目名称:Last-Edit-Lock,代码行数:21,代码来源:lasteditlock.php

示例10: theme_notes_end

function theme_notes_end($p_page, $p_url)
{
    global $g_primary_dark_color, $g_note_add_page, $g_admin_manage_notes, $g_admin_page, $s_add_note_link, $s_manage, $s_admin;
    $c_url = urlencode($p_page);
    $t_page_id = page_get_id($p_page);
    echo <<<EOT
\t\t\t\t<tr bgcolor="{$g_primary_dark_color}">
\t\t\t\t\t<td align="right">
\t\t\t\t\t\t<a href="{$g_note_add_page}?f_page_id={$t_page_id}&amp;f_url={$c_url}">{$s_add_note_link}</a>
EOT;
    if (is_moderator()) {
        echo <<<EOT
\t\t\t\t| <a href="{$g_admin_manage_notes}?f_page_id={$t_page_id}&amp;f_url={$c_url}">{$s_manage}</a>
\t\t\t\t| <a href="{$g_admin_page}">{$s_admin}</a>
EOT;
    }
    echo <<<EOT
\t\t\t\t\t</td>
\t\t\t\t</tr>
\t\t\t</table>
\t\t</div>
EOT;
}
开发者ID:BackupTheBerlios,项目名称:webnotes-svn,代码行数:23,代码来源:theme_api.php

示例11: get_post_attachments

/**
 * Fetch the attachments for a specific post and parse inline [attachment=id] code.
 * Note: assumes you have $attachcache, an array of attachments set up.
 *
 * @param int The ID of the item.
 * @param array The post or item passed by reference.
 */
function get_post_attachments($id, &$post)
{
    global $attachcache, $mybb, $theme, $templates, $forumpermissions, $lang;
    $validationcount = 0;
    $tcount = 0;
    if (isset($attachcache[$id]) && is_array($attachcache[$id])) {
        // This post has 1 or more attachments
        foreach ($attachcache[$id] as $aid => $attachment) {
            if ($attachment['visible']) {
                // There is an attachment thats visible!
                $attachment['filename'] = htmlspecialchars_uni($attachment['filename']);
                $attachment['filesize'] = get_friendly_size($attachment['filesize']);
                $ext = get_extension($attachment['filename']);
                if ($ext == "jpeg" || $ext == "gif" || $ext == "bmp" || $ext == "png" || $ext == "jpg") {
                    $isimage = true;
                } else {
                    $isimage = false;
                }
                $attachment['icon'] = get_attachment_icon($ext);
                // Support for [attachment=id] code
                if (stripos($post['message'], "[attachment=" . $attachment['aid'] . "]") !== false) {
                    // Show as thumbnail IF image is big && thumbnail exists && setting=='thumb'
                    // Show as full size image IF setting=='fullsize' || (image is small && permissions allow)
                    // Show as download for all other cases
                    if ($attachment['thumbnail'] != "SMALL" && $attachment['thumbnail'] != "" && $mybb->settings['attachthumbnails'] == "yes") {
                        eval("\$attbit = \"" . $templates->get("postbit_attachments_thumbnails_thumbnail") . "\";");
                    } elseif (($attachment['thumbnail'] == "SMALL" && $forumpermissions['candlattachments'] == 1 || $mybb->settings['attachthumbnails'] == "no") && $isimage) {
                        eval("\$attbit = \"" . $templates->get("postbit_attachments_images_image") . "\";");
                    } else {
                        eval("\$attbit = \"" . $templates->get("postbit_attachments_attachment") . "\";");
                    }
                    $post['message'] = preg_replace("#\\[attachment=" . $attachment['aid'] . "]#si", $attbit, $post['message']);
                } else {
                    // Show as thumbnail IF image is big && thumbnail exists && setting=='thumb'
                    // Show as full size image IF setting=='fullsize' || (image is small && permissions allow)
                    // Show as download for all other cases
                    if ($attachment['thumbnail'] != "SMALL" && $attachment['thumbnail'] != "" && $mybb->settings['attachthumbnails'] == "yes") {
                        eval("\$post['thumblist'] .= \"" . $templates->get("postbit_attachments_thumbnails_thumbnail") . "\";");
                        if ($tcount == 5) {
                            $thumblist .= "<br />";
                            $tcount = 0;
                        }
                        ++$tcount;
                    } elseif (($attachment['thumbnail'] == "SMALL" && $forumpermissions['candlattachments'] == 1 || $mybb->settings['attachthumbnails'] == "no") && $isimage) {
                        eval("\$post['imagelist'] .= \"" . $templates->get("postbit_attachments_images_image") . "\";");
                    } else {
                        eval("\$post['attachmentlist'] .= \"" . $templates->get("postbit_attachments_attachment") . "\";");
                    }
                }
            } else {
                $validationcount++;
            }
        }
        if ($validationcount > 0 && is_moderator($post['fid'])) {
            if ($validationcount == 1) {
                $postbit_unapproved_attachments = $lang->postbit_unapproved_attachment;
            } else {
                $postbit_unapproved_attachments = $lang->sprintf($lang->postbit_unapproved_attachments, $validationcount);
            }
            eval("\$post['attachmentlist'] .= \"" . $templates->get("postbit_attachments_attachment_unapproved") . "\";");
        }
        if ($post['thumblist']) {
            eval("\$post['attachedthumbs'] = \"" . $templates->get("postbit_attachments_thumbnails") . "\";");
        }
        if ($post['imagelist']) {
            eval("\$post['attachedimages'] = \"" . $templates->get("postbit_attachments_images") . "\";");
        }
        if ($post['attachmentlist'] || $post['thumblist'] || $post['imagelist']) {
            eval("\$post['attachments'] = \"" . $templates->get("postbit_attachments") . "\";");
        }
    }
}
开发者ID:slothly,项目名称:mybb,代码行数:79,代码来源:functions_post.php

示例12: update_stats

        }
        $db->delete_query("threadratings", "uid='{$user['uid']}'");
        // Update forum stats
        update_stats(array('numusers' => '-1'));
        // Update forums & threads if user is the lastposter
        $db->update_query("posts", array('uid' => 0), "uid='{$user['uid']}'");
        $db->update_query("threads", array('uid' => 0), "uid='{$user['uid']}'");
        $db->update_query("forums", array("lastposteruid" => 0), "lastposteruid = '{$user['uid']}'");
        $db->update_query("threads", array("lastposteruid" => 0), "lastposteruid = '{$user['uid']}'");
        // Did this user have an uploaded avatar?
        if ($user['avatartype'] == "upload") {
            // Removes the ./ at the beginning the timestamp on the end...
            @unlink("../" . substr($user['avatar'], 2, -20));
        }
        // Was this user a moderator?
        if (is_moderator($user['uid'])) {
            $db->delete_query("moderators", "id='{$user['uid']}' AND isgroup = '0'");
            $cache->update_moderators();
        }
        $plugins->run_hooks("admin_user_users_delete_commit");
        // Log admin action
        log_admin_action($user['uid'], $user['username']);
        flash_message($lang->success_user_deleted, 'success');
        admin_redirect("index.php?module=user-users");
    } else {
        $page->output_confirm_action("index.php?module=user-users&action=delete&uid={$user['uid']}", $lang->user_deletion_confirmation);
    }
}
if ($mybb->input['action'] == "referrers") {
    $plugins->run_hooks("admin_user_users_referrers");
    $page->add_breadcrumb_item($lang->show_referrers);
开发者ID:GeorgeLVP,项目名称:mybb,代码行数:31,代码来源:users.php

示例13: eval

     }
     // Hide signature option if no permission
     $option_signature = '';
     if ($mybb->usergroup['canusesig'] && !$mybb->user['suspendsignature']) {
         eval("\$option_signature = \"" . $templates->get('showthread_quickreply_options_signature') . "\";");
     }
     if (isset($mybb->user['emailnotify']) && $mybb->user['emailnotify'] == 1) {
         $postoptionschecked['emailnotify'] = 'checked="checked"';
     }
     $posthash = md5($mybb->user['uid'] . random_str());
     eval("\$quickreply = \"" . $templates->get("showthread_quickreply") . "\";");
 }
 // If the user is a moderator, show the moderation tools.
 if ($ismod) {
     $customthreadtools = $customposttools = '';
     if (is_moderator($forum['fid'], "canusecustomtools") && (!empty($forum_stats[-1]['modtools']) || !empty($forum_stats[$forum['fid']]['modtools']))) {
         switch ($db->type) {
             case "pgsql":
             case "sqlite":
                 $query = $db->simple_select("modtools", "tid, name, type", "','||forums||',' LIKE '%,{$fid},%' OR ','||forums||',' LIKE '%,-1,%' OR forums=''");
                 break;
             default:
                 $query = $db->simple_select("modtools", "tid, name, type", "CONCAT(',',forums,',') LIKE '%,{$fid},%' OR CONCAT(',',forums,',') LIKE '%,-1,%' OR forums=''");
         }
         while ($tool = $db->fetch_array($query)) {
             if ($tool['type'] == 'p') {
                 eval("\$customposttools .= \"" . $templates->get("showthread_inlinemoderation_custom_tool") . "\";");
             } else {
                 eval("\$customthreadtools .= \"" . $templates->get("showthread_moderationoptions_custom_tool") . "\";");
             }
         }
开发者ID:ThinhNguyenVB,项目名称:Gradient-Studios-Website,代码行数:31,代码来源:showthread.php

示例14: 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'] . '&nbsp;';
                }
                $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

示例15: redirect_header

             }
         }
     } else {
         $accesserror = 1;
     }
     if ($accesserror == 1) {
         redirect_header("viewtopic.php?topic_id={$topic_id}&post_id={$post_id}&order={$order}&viewmode={$viewmode}&pid={$pid}&forum={$forum}", 2, _MD_NORIGHTTOPOST);
         exit;
     }
     // Ok, looks like we're good.
 } else {
     $accesserror = 0;
     if ($forumdata['forum_access'] == 3) {
         if ($xoopsUser) {
             if (!$xoopsUser->isAdmin($xoopsModule->mid())) {
                 if (!is_moderator($forum, $xoopsUser->uid())) {
                     $accesserror = 1;
                 }
             }
         } else {
             $accesserror = 1;
         }
     } elseif ($forumdata['forum_access'] == 1 && !$xoopsUser) {
         $accesserror = 1;
     }
     if ($accesserror == 1) {
         redirect_header("viewtopic.php?topic_id={$topic_id}&post_id={$post_id}&order={$order}&viewmode={$viewmode}&pid={$pid}&forum={$forum}", 2, _MD_NORIGHTTOPOST);
         exit;
     }
 }
 include XOOPS_ROOT_PATH . '/header.php';
开发者ID:amjadtbssm,项目名称:website,代码行数:31,代码来源:reply.php


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