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

PHP is_moderator函数代码示例

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

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



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


示例16: show_forum

function show_forum($forum, $start, $sort_style, $user)
{
    $gotoStr = "";
    $nav = show_page_nav($forum, $start);
    if ($nav) {
        $gotoStr = "<div align=\"right\">{$nav}</div><br />";
    }
    echo $gotoStr;
    // Display the navbar
    start_forum_table(array("", tra("Threads"), tra("Posts"), tra("Author"), tra("Views"), "<nobr>" . tra("Last post") . "</nobr>"));
    $sticky_first = !$user || !$user->prefs->ignore_sticky_posts;
    // Show hidden threads if logged in user is a moderator
    //
    $show_hidden = is_moderator($user, $forum);
    $threads = get_forum_threads($forum->id, $start, THREADS_PER_PAGE, $sort_style, $show_hidden, $sticky_first);
    if ($user) {
        $subs = BoincSubscription::enum("userid={$user->id}");
    }
    // Run through the list of threads, displaying each of them
    $n = 0;
    $i = 0;
    foreach ($threads as $thread) {
        $owner = BoincUser::lookup_id($thread->owner);
        $unread = thread_is_unread($user, $thread);
        //if ($thread->status==1){
        // This is an answered helpdesk thread
        if ($user && is_subscribed($thread, $subs)) {
            echo '<tr class="row_hd' . $n . '">';
        } else {
            echo '<tr class="row' . $n . '">';
        }
        echo '<td width="1%"><nobr>';
        if ($user && $thread->rating() > $user->prefs->high_rating_threshold) {
            show_image(EMPHASIZE_IMAGE, "This message has a high average rating", "Highly rated");
        }
        if ($user && $thread->rating() < $user->prefs->low_rating_threshold) {
            show_image(FILTER_IMAGE, "This message has a low average rating", "Low rated");
        }
        if ($thread->hidden) {
            echo "[hidden]";
        }
        if ($unread) {
            if ($thread->sticky) {
                if ($thread->locked) {
                    show_image(NEW_IMAGE_STICKY_LOCKED, "This thread is sticky and locked, and you haven't read it yet", "sticky/locked/unread");
                } else {
                    show_image(NEW_IMAGE_STICKY, "This thread is sticky and you haven't read it yet", "sticky/unread");
                }
            } else {
                if ($thread->locked) {
                    show_image(NEW_IMAGE_LOCKED, "You haven't read this thread yet, and it's locked", "unread/locked");
                } else {
                    show_image(NEW_IMAGE, "You haven't read this thread yet", "unread");
                }
            }
        } else {
            if ($thread->sticky) {
                if ($thread->locked) {
                    show_image(IMAGE_STICKY_LOCKED, "This thread is sticky and locked", "sticky/locked");
                } else {
                    show_image(IMAGE_STICKY, "This thread is sticky", "sticky");
                }
            } else {
                if ($thread->locked) {
                    show_image(IMAGE_LOCKED, "This thread is locked", "locked");
                }
            }
        }
        echo "</nobr></td>";
        $titlelength = 48;
        $title = $thread->title;
        if (strlen($title) > $titlelength) {
            $title = substr($title, 0, $titlelength) . "...";
        }
        $title = cleanup_title($title);
        echo '<td class="threadline">
			<a href="forum_thread.php?id=' . $thread->id . '"><strong>' . $title . '</strong></a>
			<br /></td>';
        $n = ($n + 1) % 2;
        echo '<td class="numbers leftborder">' . ($thread->replies + 1) . '</td>
			<td class="author leftborder">' . user_links($owner) . '</td>
			<td class="numbers leftborder">' . $thread->views . '</td>
			<td class="lastpost leftborder">' . time_diff_str($thread->timestamp, time()) . '</td>
			</tr>';
        flush();
    }
    end_table();
    echo "<br />{$gotoStr}";
    // show page links
}
开发者ID:Turante,项目名称:boincweb,代码行数:90,代码来源:forum_forum.php


示例17: get_post

$pid = $attachment['pid'];
$post = get_post($pid);
$thread = get_thread($post['tid']);
if (!$thread['tid'] && !$mybb->input['thumbnail']) {
    error($lang->error_invalidthread);
}
$fid = $thread['fid'];
// Get forum info
$forum = get_forum($fid);
// Permissions
$forumpermissions = forum_permissions($fid);
if ($forumpermissions['canview'] == 0 || $forumpermissions['canviewthreads'] == 0 || $forumpermissions['canonlyviewownthreads'] != 0 && $thread['uid'] != $mybb->user['uid'] || $forumpermissions['candlattachments'] == 0 && !$mybb->input['thumbnail']) {
    error_no_permission();
}
// Error if attachment is invalid or not visible
if (!$attachment['aid'] || !$attachment['attachname'] || !is_moderator($fid) && ($attachment['visible'] != 1 || $thread['visible'] != 1 || $post['visible'] != 1)) {
    error($lang->error_invalidattachment);
}
if (!$mybb->input['thumbnail']) {
    $attachupdate = array("downloads" => $attachment['downloads'] + 1);
    $db->update_query("attachments", $attachupdate, "aid='{$attachment['aid']}'");
}
// basename isn't UTF-8 safe. This is a workaround.
$attachment['filename'] = ltrim(basename(' ' . $attachment['filename']));
$plugins->run_hooks("attachment_end");
if ($mybb->input['thumbnail']) {
    $ext = get_extension($attachment['thumbnail']);
    switch ($ext) {
        case "gif":
            $type = "image/gif";
            break;
开发者ID:ThinhNguyenVB,项目名称:Gradient-Studios-Website,代码行数:31,代码来源:attachment.php


示例18: IN

     $f_perm_sql = " AND t.fid NOT IN ({$unviewable_forums})";
 }
 if ($inactiveforums) {
     $f_perm_sql .= " AND t.fid NOT IN ({$inactiveforums})";
 }
 $visible = " AND t.visible != 0";
 if (is_moderator() == true) {
     $visible = '';
 }
 $query = $db->query("\n\t\tSELECT t.*, t.username AS threadusername, u.username\n\t\tFROM " . TABLE_PREFIX . "threads t\n\t\tLEFT JOIN " . TABLE_PREFIX . "users u ON (u.uid = t.uid)\n\t\tWHERE t.uid='" . $mybb->user['uid'] . "' AND t.firstpost != 0 AND t.visible >= 0 {$visible}{$f_perm_sql}\n\t\tORDER BY t.lastpost DESC\n\t\tLIMIT 0, 5\n\t");
 // Figure out whether we can view these threads...
 $threadcache = array();
 $fpermissions = forum_permissions();
 while ($thread = $db->fetch_array($query)) {
     // Moderated, and not moderator?
     if ($thread['visible'] == 0 && is_moderator($thread['fid'], "canviewunapprove") === false) {
         continue;
     }
     $forumpermissions = $fpermissions[$thread['fid']];
     if ($forumpermissions['canview'] != 0 || $forumpermissions['canviewthreads'] != 0) {
         $threadcache[$thread['tid']] = $thread;
     }
 }
 $latest_threads = '';
 if (!empty($threadcache)) {
     $tids = implode(",", array_keys($threadcache));
     // Read Forums
     $query = $db->query("\n\t\t\tSELECT f.fid, fr.dateline AS lastread\n\t\t\tFROM " . TABLE_PREFIX . "forums f\n\t\t\tLEFT JOIN " . TABLE_PREFIX . "forumsread fr ON (fr.fid=f.fid AND fr.uid='{$mybb->user['uid']}')\n\t\t\tWHERE f.active != 0\n\t\t\tORDER BY pid, disporder\n\t\t");
     while ($forum = $db->fetch_array($query)) {
         $readforums[$forum['fid']] = $forum['lastread'];
     }
开发者ID:mainhan1804,项目名称:xomvanphong,代码行数:31,代码来源:usercp.php


示例19:

该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP is_module_active函数代码示例发布时间:2022-05-15
下一篇:
PHP is_mod函数代码示例发布时间: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