2013-10-14 10:22:53 +02:00
< div id = "sidebar" >
< div class = "avatar-wrapper" >
< a href = " <?php echo \Chibi\UrlHelper :: route ( 'user' , 'view' , [ 'name' => $this -> context -> transport -> user -> name ]) ?> " >
2013-10-15 00:41:04 +02:00
< img src = " <?php echo htmlspecialchars ( $this -> context -> transport -> user -> getAvatarUrl ( 140 )) ?> " alt = " <?php echo $this -> context -> transport -> user -> name ?> " >
2013-10-14 10:22:53 +02:00
< / a >
< h1 > <?php echo $this -> context -> transport -> user -> name ?> </ h1 >
< / div >
< div class = "sidebar-unit details" >
2013-10-15 00:41:04 +02:00
< h1 > details< / h1 >
2013-10-15 13:14:48 +02:00
< div class = "key-value join-date" >
2013-10-14 10:22:53 +02:00
< span class = "key" > Joined:< / span >
2013-10-15 13:14:48 +02:00
< span class = "value" title = " <?php echo $val = date ( 'Y-m-d' , $this -> context -> transport -> user -> join_date ) ?> " > <?php echo $val ?> </ span >
2013-10-14 10:22:53 +02:00
< / div >
2013-10-15 13:14:48 +02:00
< div class = "key-value access-rank" >
2013-10-14 10:22:53 +02:00
< span class = "key" > Access rank:< / span >
2013-10-16 08:33:45 +02:00
< span class = "value" title = " <?php echo $val = TextHelper :: camelCaseToHumanCase ( AccessRank :: toString ( $this -> context -> transport -> user -> access_rank )) ?> " > <?php echo $val ?> </ span >
2013-10-14 10:22:53 +02:00
< / div >
2013-10-15 13:14:48 +02:00
2013-10-18 00:09:50 +02:00
<?php if ( PrivilegesHelper :: confirm ( Privilege :: ViewUserEmail )) : ?>
2013-10-15 13:14:48 +02:00
< div class = "key-value email" >
< span class = "key" > E-mail:< / span >
2013-10-16 18:07:23 +02:00
< span class = "value" title = " <?php echo $val = ( $this -> context -> transport -> user -> email_unconfirmed ? '(unconfirmed) ' . $this -> context -> transport -> user -> email_unconfirmed : $this -> context -> transport -> user -> email_confirmed ?: 'none specified' ) ?> " > <?php echo $val ?> </ span >
2013-10-16 20:26:48 +02:00
< br > (only you and staff can see this)
2013-10-15 13:14:48 +02:00
< / div >
<?php endif ?>
2013-10-14 10:22:53 +02:00
< / div >
2013-10-15 00:41:04 +02:00
< div class = "sidebar-unit options" >
< h1 > options< / h1 >
< ul >
<?php
$userModificationPrivileges = [
Privilege::ChangeUserName,
Privilege::ChangeUserEmail,
Privilege::ChangeUserPassword,
Privilege::ChangeUserAccessRank,
];
$userModificationPrivileges = array_fill_keys($userModificationPrivileges, false);
foreach (array_keys($userModificationPrivileges) as $privilege)
{
2013-10-18 00:09:50 +02:00
if (PrivilegesHelper::confirm($privilege, PrivilegesHelper::getIdentitySubPrivilege($this->context->transport->user)))
2013-10-15 00:41:04 +02:00
$userModificationPrivileges[$privilege] = true;
}
$canModifyAnything = count(array_filter($userModificationPrivileges)) > 0;
?>
<?php if ( $canModifyAnything ) : ?>
< li class = "edit" >
< a href = " <?php echo \Chibi\UrlHelper :: route ( 'user' , 'edit' , [ 'name' => $this -> context -> transport -> user -> name , 'tab' => 'edit' ]) ?> " >
Edit account settings
< / a >
< / li >
<?php endif ?>
2013-10-19 19:34:15 +02:00
<?php if ( PrivilegesHelper :: confirm ( Privilege :: DeleteUser , PrivilegesHelper :: getIdentitySubPrivilege ( $this -> context -> transport -> user ))) : ?>
< li class = "edit" >
< a href = " <?php echo \Chibi\UrlHelper :: route ( 'user' , 'delete' , [ 'name' => $this -> context -> transport -> user -> name , 'tab' => 'delete' ]) ?> " >
Delete account
< / a >
< / li >
<?php endif ?>
2013-10-18 00:09:50 +02:00
<?php if ( PrivilegesHelper :: confirm ( Privilege :: BanUser , PrivilegesHelper :: getIdentitySubPrivilege ( $this -> context -> transport -> user ))) : ?>
2013-10-15 13:14:48 +02:00
<?php if ( ! $this -> context -> transport -> user -> banned ) : ?>
< li class = "ban" >
< a class = "simple-action" href = " <?php echo \Chibi\UrlHelper :: route ( 'user' , 'ban' , [ 'name' => $this -> context -> transport -> user -> name ]) ?> " data-confirm-text = "Are you sure?" >
Ban user
< / a >
< / li >
<?php else : ?>
< li class = "unban" >
< a class = "simple-action" href = " <?php echo \Chibi\UrlHelper :: route ( 'user' , 'unban' , [ 'name' => $this -> context -> transport -> user -> name ]) ?> " data-confirm-text = "Are you sure?" >
Unban user
< / a >
< / li >
<?php endif ?>
<?php endif ?>
2013-10-18 00:09:50 +02:00
<?php if ( PrivilegesHelper :: confirm ( Privilege :: AcceptUserRegistration ) and ! $this -> context -> transport -> user -> staff_confirmed and $this -> config -> registration -> staffActivation ) : ?>
2013-10-15 13:14:48 +02:00
< li class = "accept-registration" >
< a class = "simple-action" href = " <?php echo \Chibi\UrlHelper :: route ( 'user' , 'accept-registration' , [ 'name' => $this -> context -> transport -> user -> name ]) ?> " >
Accept registration
< / a >
< / li >
<?php endif ?>
2013-10-15 00:41:04 +02:00
< / ul >
< script type = "text/javascript" >
if (!$('.options ul li').length)
$('.options').hide();
< / script >
< / div >
2013-10-14 10:22:53 +02:00
< / div >
< div id = "inner-content" >
< div class = "tabs" >
< nav >
< ul >
<?php if ( $this -> context -> transport -> tab == 'favs' ) : ?>
2013-10-15 00:41:04 +02:00
< li class = "selected favs" >
2013-10-14 10:22:53 +02:00
<?php else : ?>
2013-10-15 00:41:04 +02:00
< li class = "favs" >
2013-10-14 10:22:53 +02:00
<?php endif ?>
< a href = " <?php echo \Chibi\UrlHelper :: route ( 'user' , 'view' , [ 'name' => $this -> context -> transport -> user -> name , 'tab' => 'favs' , 'page' => 1 ]) ?> " >
Favs
< / a >
< / li >
<?php if ( $this -> context -> transport -> tab == 'uploads' ) : ?>
2013-10-15 00:41:04 +02:00
< li class = "selected uploads" >
2013-10-14 10:22:53 +02:00
<?php else : ?>
2013-10-15 00:41:04 +02:00
< li class = "uploads" >
2013-10-14 10:22:53 +02:00
<?php endif ?>
< a href = " <?php echo \Chibi\UrlHelper :: route ( 'user' , 'view' , [ 'name' => $this -> context -> transport -> user -> name , 'tab' => 'uploads' , 'page' => 1 ]) ?> " >
Uploads
< / a >
< / li >
2013-10-15 00:41:04 +02:00
<?php if ( $canModifyAnything ) : ?>
<?php if ( $this -> context -> transport -> tab == 'edit' ) : ?>
< li class = "selected edit" >
<?php else : ?>
< li class = "edit" >
<?php endif ?>
2013-10-15 13:14:48 +02:00
< a href = " <?php echo \Chibi\UrlHelper :: route ( 'user' , 'edit' , [ 'name' => $this -> context -> transport -> user -> name ]) ?> " >
2013-10-15 00:41:04 +02:00
Account settings
< / a >
< / li >
<?php endif ?>
2013-10-15 13:14:48 +02:00
2013-10-18 00:09:50 +02:00
<?php if ( PrivilegesHelper :: confirm ( Privilege :: DeleteUser , PrivilegesHelper :: getIdentitySubPrivilege ( $this -> context -> transport -> user ))) : ?>
2013-10-15 13:14:48 +02:00
<?php if ( $this -> context -> transport -> tab == 'delete' ) : ?>
< li class = "selected delete" >
<?php else : ?>
< li class = "delete" >
<?php endif ?>
< a href = " <?php echo \Chibi\UrlHelper :: route ( 'user' , 'delete' , [ 'name' => $this -> context -> transport -> user -> name ]) ?> " >
Delete account
< / a >
< / li >
<?php endif ?>
2013-10-14 10:22:53 +02:00
< / ul >
< / nav >
< / div >
2013-10-15 00:41:04 +02:00
<?php if ( isset ( $this -> context -> transport -> posts )) : ?>
2013-10-16 13:07:01 +02:00
<?php $this -> renderFile ( 'post-list' ) ?>
2013-10-15 00:41:04 +02:00
<?php endif ?>
<?php if ( $this -> context -> transport -> tab == 'edit' ) : ?>
2013-10-15 13:14:48 +02:00
< form action = " <?php echo \Chibi\UrlHelper :: route ( 'user' , 'edit' , [ 'name' => $this -> context -> transport -> user -> name ]) ?> " method = "post" class = "edit aligned" autocomplete = "off" >
2013-10-15 00:41:04 +02:00
<?php if ( $this -> context -> user -> id == $this -> context -> transport -> user -> id ) : ?>
2013-10-15 20:31:38 +02:00
< div class = "current-password" >
< label class = "left" for = "current-password" > Current password:< / label >
2013-10-19 20:58:51 +02:00
< div class = "input-wrapper" > < input type = "password" name = "current-password" id = "current-password" placeholder = "Current password" / > < / div >
2013-10-15 00:41:04 +02:00
< / div >
< hr >
<?php endif ?>
2013-10-18 00:09:50 +02:00
<?php if ( PrivilegesHelper :: confirm ( Privilege :: ChangeUserName , PrivilegesHelper :: getIdentitySubPrivilege ( $this -> context -> transport -> user ))) : ?>
2013-10-15 00:41:04 +02:00
< div class = "nickname" >
< label class = "left" for = "name" > Name:< / label >
2013-10-19 20:58:51 +02:00
< div class = "input-wrapper" >< input type = "text" name = "name" id = "name" placeholder = "New name…" value = " <?php echo $this -> context -> suppliedName ?> " /></ div >
2013-10-15 00:41:04 +02:00
< / div >
<?php endif ?>
2013-10-18 00:09:50 +02:00
<?php if ( PrivilegesHelper :: confirm ( Privilege :: ChangeUserEmail , PrivilegesHelper :: getIdentitySubPrivilege ( $this -> context -> transport -> user ))) : ?>
2013-10-15 00:41:04 +02:00
< div class = "email" >
< label class = "left" for = "name" > E-mail:< / label >
2013-10-19 20:58:51 +02:00
< div class = "input-wrapper" >< input type = "text" name = "email" id = "email" placeholder = "New e-mail…" value = " <?php echo $this -> context -> suppliedEmail ?> " /></ div >
2013-10-15 00:41:04 +02:00
< / div >
<?php endif ?>
2013-10-18 00:09:50 +02:00
<?php if ( PrivilegesHelper :: confirm ( Privilege :: ChangeUserPassword , PrivilegesHelper :: getIdentitySubPrivilege ( $this -> context -> transport -> user ))) : ?>
2013-10-15 00:41:04 +02:00
< div class = "password1" >
< label class = "left" for = "password1" > New password:< / label >
2013-10-19 20:58:51 +02:00
< div class = "input-wrapper" >< input type = "password" name = "password1" id = "password1" placeholder = "New password…" value = " <?php echo $this -> context -> suppliedPassword1 ?> " /></ div >
2013-10-15 00:41:04 +02:00
< / div >
< div class = "password2" >
< label class = "left" for = "password2" > < / label >
2013-10-19 20:58:51 +02:00
< div class = "input-wrapper" >< input type = "password" name = "password2" id = "password2" placeholder = "New password… (repeat)" value = " <?php echo $this -> context -> suppliedPassword2 ?> " /></ div >
2013-10-15 00:41:04 +02:00
< / div >
<?php endif ?>
2013-10-18 00:09:50 +02:00
<?php if ( PrivilegesHelper :: confirm ( Privilege :: ChangeUserAccessRank , PrivilegesHelper :: getIdentitySubPrivilege ( $this -> context -> transport -> user ))) : ?>
2013-10-15 00:41:04 +02:00
< div class = "access-rank" >
< label class = "left" for = "access-rank" > Access rank:< / label >
2013-10-19 20:58:51 +02:00
< div class = "input-wrapper" > < select name = "access-rank" id = "access-rank" >
2013-10-15 00:41:04 +02:00
<?php foreach ( AccessRank :: getAll () as $rank ) : ?>
2013-10-16 13:12:17 +02:00
<?php if ( $rank == AccessRank :: Nobody ) continue ?>
2013-10-15 13:14:48 +02:00
<?php if (( $this -> context -> suppliedAccessRank != '' and $rank == $this -> context -> suppliedAccessRank ) or ( $this -> context -> suppliedAccessRank == '' and $rank == $this -> context -> transport -> user -> access_rank )) : ?>
2013-10-15 00:41:04 +02:00
< option value = " <?php echo $rank ?> " selected = "selected" >
<?php else : ?>
< option value = " <?php echo $rank ?> " >
<?php endif ?>
2013-10-16 08:33:45 +02:00
<?php echo TextHelper :: camelCaseToHumanCase ( AccessRank :: toString ( $rank )) ?>
2013-10-15 00:41:04 +02:00
< / option >
<?php endforeach ?>
2013-10-19 20:58:51 +02:00
< / select > < / div >
2013-10-15 00:41:04 +02:00
< / div >
<?php endif ?>
2013-10-15 13:14:48 +02:00
<?php if ( $this -> context -> transport -> success === true ) : ?>
2013-10-16 18:07:23 +02:00
< p class = "alert alert-success" > Account settings updated! <?php if ( ! empty ( $this -> context -> mailSent )) echo 'You will be sent new e-mail address confirmation message soon.' ?> </ p >
2013-10-15 13:14:48 +02:00
<?php elseif ( isset ( $this -> context -> transport -> errorMessage )) : ?>
< p class = "alert alert-error" > Error: <?php echo $this -> context -> transport -> errorMessage ?> </ p >
<?php endif ?>
2013-10-15 00:41:04 +02:00
< div >
< label class = "left" > < / label >
< button type = "submit" > Submit< / button >
< / div >
< / form >
2013-10-15 13:14:48 +02:00
<?php elseif ( $this -> context -> transport -> tab == 'delete' ) : ?>
< form action = " <?php echo \Chibi\UrlHelper :: route ( 'user' , 'delete' , [ 'name' => $this -> context -> transport -> user -> name ]) ?> " method = "post" class = "edit aligned" autocomplete = "off" data-confirm-text = "Are you sure you want to delete your account?" >
<?php if ( $this -> context -> user -> id == $this -> context -> transport -> user -> id ) : ?>
2013-10-15 20:31:38 +02:00
< div class = "current-password" >
< label class = "left" for = "current-password" > Current password:< / label >
2013-10-19 20:58:51 +02:00
< div class = "input-wrapper" > < input type = "password" name = "current-password" id = "current-password" placeholder = "Current password" / > < / div >
2013-10-15 13:14:48 +02:00
< / div >
<?php endif ?>
< input type = "hidden" name = "remove" value = "1" / >
<?php if ( $this -> context -> transport -> success === true ) : ?>
< p class = "alert alert-success" > Account settings updated!< / p >
<?php elseif ( isset ( $this -> context -> transport -> errorMessage )) : ?>
< p class = "alert alert-error" > Error: <?php echo $this -> context -> transport -> errorMessage ?> </ p >
<?php endif ?>
< div >
< label class = "left" > < / label >
< button type = "submit" > Delete account< / button >
< / div >
< / form >
2013-10-15 00:41:04 +02:00
<?php endif ?>
2013-10-14 10:22:53 +02:00
< / div >