Advertisement
Faguss

UserSpice view_all_users.php with Brandin's patch

Jul 4th, 2017
372
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 6.21 KB | None | 0 0
  1. <?php
  2. /*
  3. UserSpice 4
  4. An Open Source PHP User Management System
  5. by the UserSpice Team at http://UserSpice.com
  6.  
  7. This program is free software: you can redistribute it and/or modify
  8. it under the terms of the GNU General Public License as published by
  9. the Free Software Foundation, either version 3 of the License, or
  10. (at your option) any later version.
  11.  
  12. This program is distributed in the hope that it will be useful,
  13. but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  15. GNU General Public License for more details.
  16.  
  17. You should have received a copy of the GNU General Public License
  18. along with this program.  If not, see <http://www.gnu.org/licenses/>.
  19. */
  20. ?>
  21. <?php require_once 'init.php'; ?>
  22. <?php require_once $abs_us_root.$us_url_root.'users/includes/header.php'; ?>
  23. <?php require_once $abs_us_root.$us_url_root.'users/includes/navigation.php'; ?>
  24.  
  25. <?php if (!securePage($_SERVER['PHP_SELF'])){die();} ?>
  26. <?php
  27. //PHP Goes Here!
  28.  
  29. if($user->isLoggedIn()) { $thisUserID = $user->data()->id;} else { $thisUserID = 0; }
  30.  
  31. $userQ = $db->query("SELECT * FROM users LEFT JOIN profiles ON users.id = user_id ");
  32. // group active, inactive, on naughty step
  33. $users = $userQ->results();
  34. ?>
  35. <div id="page-wrapper">
  36.  
  37.   <div class="container">
  38.  
  39.     <!-- Page Heading -->
  40.     <div class="row">
  41.  
  42.       <div class="col-xs-12 col-md-6">
  43.         <h1 >View All Users</h1>
  44.       </div>
  45.  
  46.       <div class="col-xs-12 col-md-6">
  47.             <form class="">
  48.                 <label for="system-search">Search:</label>
  49.                 <div class="input-group">
  50.                     <input class="form-control" id="system-search" name="q" placeholder="Search Users..." type="text">
  51.                     <span class="input-group-btn">
  52.                         <button type="submit" class="btn btn-default"><i class="fa fa-times"></i></button>
  53.                     </span>
  54.                 </div>
  55.             </form>
  56.           </div>
  57.  
  58.      </div>
  59.  
  60.          <div class="row">
  61.              <div class="col-md-12">
  62.  
  63.  
  64. <hr />
  65.  <div class="allutable table-responsive">
  66. <table class='table table-hover table-list-search'>
  67. <thead>
  68. <tr>
  69.   <th><div class="alluinfo">&nbsp;</div></th>
  70.   <th>Username</th>
  71.  </tr>
  72. </thead>
  73.  <tbody>
  74. <?php
  75. //Cycle through users
  76. foreach ($users as $v1) {
  77.  
  78.     $ususername = ucfirst($v1->username);
  79.     $ususerbio = ucfirst($v1->bio);
  80.     $grav = empty($v1->picture) ? get_gravatar(strtolower(trim($v1->email))) : $v1->picture;
  81.     $useravatar = '<img src="'.$grav.'" class="img-responsive img-thumbnail" width=130 height=130 alt="'.$ususername.'">';
  82.  
  83. ?>
  84.  
  85.     <tr>
  86.         <td>
  87.             <a href="profile.php?name=<?=htmlentities($v1->username)?>"><?php echo $useravatar;?></a>
  88.         </td>
  89.  
  90.           <td>
  91.             <h4><a href="profile.php?name=<?=htmlentities($v1->username)?>"><?=$ususername?>  </a></h4>
  92.             <p><?=$ususerbio?></p>
  93. <?php
  94. echo "<BR /><SPAN STYLE=\"font-size:x-small; float:right\">" .
  95.      "<B>Joined</B>: " . DateTime::createFromFormat("Y-m-d H:i:s", $v1->join_date)->format("Y-m-d") . " &nbsp; &nbsp;  &nbsp; " .
  96.      "<B>Active</B>: " . DateTime::createFromFormat("Y-m-d H:i:s", $v1->last_login)->format("jS F (l) Y H:i") . "</SPAN>";
  97. ?>
  98.         </td>
  99.        
  100. <?php
  101. echo "<TD>";
  102.  
  103.     if ($settings->messaging == 1   &&   $v1->id != $thisUserID)
  104.         echo "<BUTTON TYPE=\"button\" CLASS=\"btn btn-info btn-xs\" DATA-TOGGLE=\"modal\" DATA-TARGET=\"#compose\" DATA-ID=\"{$v1->id};{$v1->username}\"><I CLASS=\"glyphicon glyphicon-plus\" STYLE=\"font-size:0.8em;\"></I> New Message</BUTTON> &nbsp; &nbsp; ";
  105.    
  106.     if (!empty($v1->gpluslink))
  107.         echo "<A CLASS=\"btn btn-primary btn-xs\" TARGET=\"_blank\" HREF=\"{$v1->gpluslink}\" ROLE=\"button\">G+</A>";
  108.    
  109. echo "</TD>";
  110. ?>
  111.        
  112.     </tr>
  113. <?php } ?>
  114.   </tbody>
  115. </table>
  116.       </div>
  117.  
  118.       </div>
  119.     </div>
  120.  
  121.    
  122.    
  123.    
  124.    
  125.    
  126.    
  127.    
  128.    
  129. <div id="compose" class="modal fade" role="dialog">
  130.   <div class="modal-dialog">
  131.  
  132.     <!-- Modal content-->
  133.     <div class="modal-content">
  134.       <div class="modal-header">
  135.         <button type="button" class="close" data-dismiss="modal">&times;</button>
  136.         <h4 class="modal-title">New Message</h4>
  137.       </div>
  138.       <div class="modal-body">
  139. <form name="create_message" action="messages.php" method="post">
  140.  
  141.                 <select name="user_id" id="combobox" class="form-control combobox" required disabled>
  142.                 <option readonly></option>
  143.                 </select><br />
  144.               <label>Subject:</label>
  145.                 <input required size='100' class='form-control' type='text' name='msg_subject' value='' required/>
  146.                 <br /><label>Body:</label>
  147.                 <textarea rows="20" cols="80"  id="mytextarea" name="msg_body"></textarea>
  148.                 <input required type="hidden" name="csrf" value="<?=Token::generate();?>" >
  149.               </p>
  150.               <p>
  151.                   <br />
  152.       </div>
  153.       <div class="modal-footer">
  154.       <div class="btn-group">   <input type="hidden" name="csrf" value="<?=Token::generate();?>" />
  155.     <input class='btn btn-primary' type='submit' name="send_message" value='Send Message' class='submit' /></div>
  156.     </form>
  157.          <div class="btn-group"><button type="button" class="btn btn-default" data-dismiss="modal">Close</button></div>
  158.       </div>
  159.     </div>
  160.     </div>
  161.   </div>
  162.  
  163.     <!-- /.row -->
  164.       </div>
  165.     </div>
  166.     <!-- footers -->
  167. <?php require_once $abs_us_root.$us_url_root.'users/includes/page_footer.php'; // the final html footer copyright row + the external js calls ?>
  168.  
  169.     <!-- Place any per-page javascript here -->
  170.     <script src='https://cdn.tinymce.com/4/tinymce.min.js'></script>
  171.     <script src="../usersc/js/bootstrap-combobox.js"></script>
  172.     <script src="../usersc/js/messages.php.js"></script>
  173.     <script type="text/javascript">
  174.       $(document).ready(function(){
  175.         $(".btn-info").click(function(){
  176.             var userdata = $(this).data('id');         
  177.             var userID   = userdata.substr(0, userdata.indexOf(';'));
  178.             var inputs   = document.getElementsByName("user_id");
  179.            
  180.             for (i=0, max=inputs.length; i<max; i++)
  181.                 inputs[i].value = userID;
  182.            
  183.             document.getElementById("comboboxundefined").value = userdata.substr(userdata.indexOf(';')+1);
  184.         });
  185.       });
  186.     </script>
  187.  
  188. <script src="js/search.js" charset="utf-8"></script>
  189.  
  190. <?php require_once $abs_us_root.$us_url_root.'users/includes/html_footer.php'; // currently just the closing /body and /html ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement