Advertisement
Faguss

UserSpice profile.php

Jul 4th, 2017
316
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 3.68 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. require_once 'init.php';
  22. require_once $abs_us_root.$us_url_root.'users/includes/header.php';
  23. require_once $abs_us_root.$us_url_root.'users/includes/navigation.php';
  24.  
  25. if (!securePage($_SERVER['PHP_SELF']))
  26.     die();
  27.  
  28. //PHP Goes Here!
  29.  
  30. if ($user->isLoggedIn())
  31.     $thisUserID = $user->data()->id;
  32. else
  33.     $thisUserID = 0;
  34.  
  35.  
  36. $userID     = Input::get('id');
  37. $name       = Input::get('name');
  38.  
  39. $ususername = '404';
  40. $usbio      = "User not found";
  41. $useravatar = "";
  42. $editbio    = " <SMALL><A HREF=\"/\">Go to the homepage</A></SMALL>";
  43.  
  44. $sql        = "SELECT * FROM profiles LEFT JOIN users ON user_id = users.id WHERE " . (empty($name) ? "user_id=" : "username LIKE ") . "?";
  45. $arg        = empty($name) ? [$userID] : [$name];
  46. $userQ      = $db->query($sql, $arg);
  47. $thatUser   = $userQ->first();
  48. $found      = !$db->error()  &&  $db->count()>0;
  49.  
  50. if ($found) {
  51.     $userID     = $thatUser->id;
  52.     $ususername = ucfirst($thatUser->username)."'s Profile";
  53.     $grav       = empty($thatUser->picture) ? get_gravatar(strtolower(trim($thatUser->email))) : $thatUser->picture;
  54.     $useravatar = '<IMG SRC="'.$grav.'" CLASS="img-thumbnail" WIDTH=130 HEIGHT=130 ALT="'.$ususername.'">';
  55.     $usbio      = html_entity_decode($thatUser->bio);
  56.     $editbio    = $thisUserID == $userID ? " <SMALL><A HREF=\"edit_profile.php\">Edit Bio</A></SMALL>" : "";
  57. }
  58.  
  59.  
  60.  
  61. echo "
  62.   <DIV ID=\"page-wrapper\">
  63.  
  64.          <DIV CLASS=\"container\">
  65.                 <!-- Main jumbotron for a primary marketing message or call to action -->
  66.                 <DIV CLASS=\"well\">
  67.                     <DIV CLASS=\"row\">
  68.                         <DIV CLASS=\"col-xs-12 col-md-2\">
  69.                             <P>{$useravatar}</P>
  70.                         </DIV>
  71.                         <DIV CLASS=\"col-xs-12 col-md-10\">
  72.  
  73.     <H2>{$ususername}</H2>
  74.     <BR />
  75.     {$usbio} {$editbio}
  76.     <BR /><BR />";
  77.    
  78. if ($found)
  79.     echo
  80.     "<SPAN STYLE=\"font-size:small; float:right\">
  81.         <B>Joined</B>: " . DateTime::createFromFormat("Y-m-d H:i:s", $thatUser->join_date)->format("Y-m-d") . " &nbsp; &nbsp;  &nbsp;
  82.         <B>Active</B>: " . DateTime::createFromFormat("Y-m-d H:i:s", $thatUser->last_login)->format("jS F (l) Y H:i") .
  83.     "</SPAN>";
  84.  
  85. echo "
  86.                     </DIV>
  87.                     </DIV>
  88.                 </DIV>";
  89.  
  90. if ($settings->messaging==1  &&  $found  &&  $thisUserID!=$userID)
  91.     echo "<A CLASS=\"btn btn-primary\" HREF=\"create_message.php?id={$thatUser->id}\" ROLE=\"button\">Message</A> &nbsp; &nbsp;";
  92.    
  93. if (!empty($thatUser->gpluslink))
  94.     echo "<A CLASS=\"btn btn-primary\" HREF=\"{$thatUser->gpluslink}\" ROLE=\"button\">G+ Profile</A> &nbsp; &nbsp; ";
  95. ?>
  96.  
  97.                                         <a class="btn btn-success" href="view_all_users.php" role="button">All Users</a>
  98.  
  99. <BR /><BR />
  100.     </div> <!-- /container -->
  101.  
  102. </div> <!-- /#page-wrapper -->
  103.  
  104. <!-- footers -->
  105. <?php require_once $abs_us_root.$us_url_root.'users/includes/page_footer.php'; // the final html footer copyright row + the external js calls ?>
  106. <!-- Place any per-page javascript here -->
  107. <?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