} if ($targetUser->id === $currentUser->id) { Response::fail("You cannot {$action} yourself"); } if (Permission::sufficient('staff', $targetUser->role)) { Response::fail("You cannot {$action} people within the assistant or any higher group"); } if ($action == 'banish' && $targetUser->role === 'ban' || $action == 'un-banish' && $targetUser->role !== 'ban') { Response::fail("This user has already been {$action}ed"); } $reason = (new Input('reason', 'string', array(Input::IN_RANGE => [5, 255], Input::CUSTOM_ERROR_MESSAGES => array(Input::ERROR_MISSING => 'Please specify a reason', Input::ERROR_RANGE => 'Reason length must be between @min and @max characters'))))->out(); $changes = array('role' => $action == 'banish' ? 'ban' : 'user'); $Database->where('id', $targetUser->id)->update('users', $changes); Logs::action($action, array('target' => $targetUser->id, 'reason' => $reason)); $changes['role'] = Permission::ROLES_ASSOC[$changes['role']]; $changes['badge'] = Permission::labelInitials($changes['role']); if ($action == 'banish') { Response::done($changes); } Response::success("We welcome {$targetUser->name} back with open hooves!", $changes); } else { CoreUtils::notFound(); } } } if (strtolower($data) === 'immortalsexgod') { $data = 'DJDavid98'; } if (empty($data)) { if ($signedIn) { $un = $currentUser->name;
use App\Time; use App\UserPrefs; use App\Users; /** @var $User User */ if (isset($MSG)){ echo "<h1>$MSG</h1>"; if (isset($SubMSG)) echo "<p>$SubMSG</p>"; } else { $vectorapp = UserPrefs::get('p_vectorapp', $User->id); ?> <div class="briefing"> <?=$User->getAvatarWrap()?> <div class="title"> <h1><span class="role-badge"><?=Permission::labelInitials($User->role)?></span><span class="username"><?=$User->name?></span><a class="da" title="Visit DeviantArt profile" href="<?=$User->getDALink(User::LINKFORMAT_URL)?>"><?=str_replace(' fill="#FFF"','',file_get_contents(APPATH.'img/da-logo.svg'))?></a><?=!empty($vectorapp)?"<img class='vectorapp-logo' src='/img/vapps/$vectorapp.svg' alt='$vectorapp logo' title='".CoreUtils::$VECTOR_APPS[$vectorapp]." user'>":''?></h1> <p><?php echo "<span class='rolelabel'>{$User->rolelabel}</span>"; if ($canEdit){ echo ' <button id="change-role" class="blue typcn typcn-spanner'.($User->role==='ban'?' hidden':'').'" title="Change '.CoreUtils::posess($User->name).' group"></button>'; $BanLabel = ($User->role==='ban'?'Un-ban':'Ban').'ish'; $Icon = $User->role==='ban'?'world':'weather-night'; if (Permission::sufficient('staff', $User->role)) $Icon .= ' hidden'; echo ' <button id="ban-toggle" class="darkblue typcn typcn-'.$Icon.' '.strtolower($BanLabel).'" title="'."$BanLabel user".'"></button>'; } if (Permission::sufficient('developer')) echo " • <span class='userid'>{$User->id}</span>"; ?></p> </div> </div>
if (!empty($Users)) { $Arranged = array(); foreach ($Users as $u) { if (!isset($Arranged[$u->role])) { $Arranged[$u->role] = array(); } $Arranged[$u->role][] = $u; } foreach (array_reverse(Permission::ROLES) as $r => $v) { if (empty($Arranged[$r])) { continue; } /** @var $users \App\Models\User[] */ $users = $Arranged[$r]; $group = CoreUtils::makePlural(Permission::ROLES_ASSOC[$r], count($users), true); $groupInitials = '[' . Permission::labelInitials($r) . ']'; $usersStr = array(); foreach ($users as $u) { $usersStr[] = $u->getProfileLink(); } $usersStr = implode(', ', $usersStr); echo <<<HTML <section> \t<h2>{$group} {$groupInitials}</h2> \t{$usersStr} </section> HTML; } } ?> </div>