[ Index ] |
PHP Cross Reference of MyBB |
[Summary view] [Print] [Text view]
1 <?php 2 /** 3 * MyBB 1.6 4 * Copyright 2010 MyBB Group, All Rights Reserved 5 * 6 * Website: http://mybb.com 7 * License: http://mybb.com/about/license 8 * 9 * $Id: functions_modcp.php 5813 2012-04-20 13:41:04Z Tomm $ 10 */ 11 12 /** 13 * Check if the current user has permission to perform a ModCP action on another user 14 * 15 * @param int The user ID to perform the action on. 16 * @param int the moderators user ID 17 * @return boolean True if the user has necessary permissions 18 */ 19 function modcp_can_manage_user($uid) 20 { 21 global $mybb; 22 23 $user_permissions = user_permissions($uid); 24 25 // Current user is only a local moderator or use with ModCP permissions, cannot manage super mods or admins 26 if($mybb->usergroup['issupermod'] == 0 && ($user_permissions['issupermod'] == 1 || $user_permissions['cancp'] == 1)) 27 { 28 return false; 29 } 30 // Current user is a super mod or is an administrator 31 else if($user_permissions['cancp'] == 1 && ($mybb->usergroup['cancp'] != 1 || (is_super_admin($uid) && !is_super_admin($mybb->user['uid'])))) 32 { 33 return false; 34 } 35 return true; 36 } 37 38 function fetch_forum_announcements($pid=0, $depth=1) 39 { 40 global $mybb, $db, $lang, $theme, $announcements, $templates, $announcements_forum, $moderated_forums, $unviewableforums; 41 static $forums_by_parent, $forum_cache, $parent_forums; 42 43 if(!is_array($forum_cache)) 44 { 45 $forum_cache = cache_forums(); 46 } 47 if(!is_array($parent_forums) && $mybb->user['issupermod'] != 1) 48 { 49 // Get a list of parentforums to show for normal moderators 50 $parent_forums = array(); 51 foreach($moderated_forums as $mfid) 52 { 53 $parent_forums = array_merge($parent_forums, explode(',', $forum_cache[$mfid]['parentlist'])); 54 } 55 } 56 if(!is_array($forums_by_parent)) 57 { 58 foreach($forum_cache as $forum) 59 { 60 $forums_by_parent[$forum['pid']][$forum['disporder']][$forum['fid']] = $forum; 61 } 62 } 63 64 if(!is_array($forums_by_parent[$pid])) 65 { 66 return; 67 } 68 69 foreach($forums_by_parent[$pid] as $children) 70 { 71 foreach($children as $forum) 72 { 73 if($forum['linkto'] || ($unviewableforums && in_array($forum['fid'], $unviewableforums))) 74 { 75 continue; 76 } 77 78 if($forum['active'] == 0 || !is_moderator($forum['fid'])) 79 { 80 // Check if this forum is a parent of a moderated forum 81 if(in_array($forum['fid'], $parent_forums)) 82 { 83 // A child is moderated, so print out this forum's title. RECURSE! 84 $trow = alt_trow(); 85 eval("\$announcements_forum .= \"".$templates->get("modcp_announcements_forum_nomod")."\";"); 86 } 87 else 88 { 89 // No subforum is moderated by this mod, so safely continue 90 continue; 91 } 92 } 93 else 94 { 95 // This forum is moderated by the user, so print out the forum's title, and its announcements 96 $trow = alt_trow(); 97 98 $padding = 40*($depth-1); 99 100 eval("\$announcements_forum .= \"".$templates->get("modcp_announcements_forum")."\";"); 101 102 if($announcements[$forum['fid']]) 103 { 104 foreach($announcements[$forum['fid']] as $aid => $announcement) 105 { 106 $trow = alt_trow(); 107 108 if($announcement['enddate'] < TIME_NOW && $announcement['enddate'] != 0) 109 { 110 $icon = "<img src=\"{$theme['imgdir']}/minioff.gif\" alt=\"({$lang->expired})\" title=\"{$lang->expired_announcement}\" style=\"vertical-align: middle;\" /> "; 111 } 112 else 113 { 114 $icon = "<img src=\"{$theme['imgdir']}/minion.gif\" alt=\"({$lang->active})\" title=\"{$lang->active_announcement}\" style=\"vertical-align: middle;\" /> "; 115 } 116 117 $subject = htmlspecialchars_uni($announcement['subject']); 118 119 eval("\$announcements_forum .= \"".$templates->get("modcp_announcements_announcement")."\";"); 120 } 121 } 122 } 123 124 // Build the list for any sub forums of this forum 125 if($forums_by_parent[$forum['fid']]) 126 { 127 fetch_forum_announcements($forum['fid'], $depth+1); 128 } 129 } 130 } 131 } 132 133 ?>
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Tue Oct 8 19:19:50 2013 | Cross-referenced by PHPXref 0.7.1 |