Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /*
- UserSpice 4
- An Open Source PHP User Management System
- by the UserSpice Team at http://UserSpice.com
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
- require_once 'init.php';
- require_once $abs_us_root.$us_url_root.'users/includes/header.php';
- require_once $abs_us_root.$us_url_root.'users/includes/navigation.php';
- if (!securePage($_SERVER['PHP_SELF']))
- die();
- //PHP Goes Here!
- if ($user->isLoggedIn())
- $thisUserID = $user->data()->id;
- else
- $thisUserID = 0;
- $userID = Input::get('id');
- $name = Input::get('name');
- $ususername = '404';
- $usbio = "User not found";
- $useravatar = "";
- $editbio = " <SMALL><A HREF=\"/\">Go to the homepage</A></SMALL>";
- $sql = "SELECT * FROM profiles LEFT JOIN users ON user_id = users.id WHERE " . (empty($name) ? "user_id=" : "username LIKE ") . "?";
- $arg = empty($name) ? [$userID] : [$name];
- $userQ = $db->query($sql, $arg);
- $thatUser = $userQ->first();
- $found = !$db->error() && $db->count()>0;
- if ($found) {
- $userID = $thatUser->id;
- $ususername = ucfirst($thatUser->username)."'s Profile";
- $grav = empty($thatUser->picture) ? get_gravatar(strtolower(trim($thatUser->email))) : $thatUser->picture;
- $useravatar = '<IMG SRC="'.$grav.'" CLASS="img-thumbnail" WIDTH=130 HEIGHT=130 ALT="'.$ususername.'">';
- $usbio = html_entity_decode($thatUser->bio);
- $editbio = $thisUserID == $userID ? " <SMALL><A HREF=\"edit_profile.php\">Edit Bio</A></SMALL>" : "";
- }
- echo "
- <DIV ID=\"page-wrapper\">
- <DIV CLASS=\"container\">
- <!-- Main jumbotron for a primary marketing message or call to action -->
- <DIV CLASS=\"well\">
- <DIV CLASS=\"row\">
- <DIV CLASS=\"col-xs-12 col-md-2\">
- <P>{$useravatar}</P>
- </DIV>
- <DIV CLASS=\"col-xs-12 col-md-10\">
- <H2>{$ususername}</H2>
- <BR />
- {$usbio} {$editbio}
- <BR /><BR />";
- if ($found)
- echo
- "<SPAN STYLE=\"font-size:small; float:right\">
- <B>Joined</B>: " . DateTime::createFromFormat("Y-m-d H:i:s", $thatUser->join_date)->format("Y-m-d") . "
- <B>Active</B>: " . DateTime::createFromFormat("Y-m-d H:i:s", $thatUser->last_login)->format("jS F (l) Y H:i") .
- "</SPAN>";
- echo "
- </DIV>
- </DIV>
- </DIV>";
- if ($settings->messaging==1 && $found && $thisUserID!=$userID)
- echo "<BUTTON TYPE=\"button\" CLASS=\"btn btn-info\" DATA-TOGGLE=\"modal\" DATA-TARGET=\"#compose\" DATA-ID=\"{$thatUser->id};{$thatUser->username}\"><I CLASS=\"glyphicon glyphicon-plus\"></I> New Message</BUTTON> ";
- if (!empty($thatUser->gpluslink))
- echo "<A CLASS=\"btn btn-primary\" TARGET=\"_blank\" HREF=\"{$thatUser->gpluslink}\" ROLE=\"button\">G+ Profile</A> ";
- ?>
- <a class="btn btn-success" href="view_all_users.php" role="button">All Users</a>
- <BR /><BR />
- <div id="compose" class="modal fade" role="dialog">
- <div class="modal-dialog">
- <!-- Modal content-->
- <div class="modal-content">
- <div class="modal-header">
- <button type="button" class="close" data-dismiss="modal">×</button>
- <h4 class="modal-title">New Message</h4>
- </div>
- <div class="modal-body">
- <form name="create_message" action="messages.php" method="post">
- <select name="user_id" id="combobox" class="form-control combobox" required disabled>
- <option readonly></option>
- </select><br />
- <label>Subject:</label>
- <input required size='100' class='form-control' type='text' name='msg_subject' value='' required/>
- <br /><label>Body:</label>
- <textarea rows="20" cols="80" id="mytextarea" name="msg_body"></textarea>
- <input required type="hidden" name="csrf" value="<?=Token::generate();?>" >
- </p>
- <p>
- <br />
- </div>
- <div class="modal-footer">
- <div class="btn-group"> <input type="hidden" name="csrf" value="<?=Token::generate();?>" />
- <input class='btn btn-primary' type='submit' name="send_message" value='Send Message' class='submit' /></div>
- </form>
- <div class="btn-group"><button type="button" class="btn btn-default" data-dismiss="modal">Close</button></div>
- </div>
- </div>
- </div>
- </div>
- </div> <!-- /container -->
- </div> <!-- /#page-wrapper -->
- <!-- footers -->
- <?php require_once $abs_us_root.$us_url_root.'users/includes/page_footer.php'; // the final html footer copyright row + the external js calls ?>
- <!-- Place any per-page javascript here -->
- <script src='https://cdn.tinymce.com/4/tinymce.min.js'></script>
- <script src="../usersc/js/bootstrap-combobox.js"></script>
- <script src="../usersc/js/messages.php.js"></script>
- <script type="text/javascript">
- $(document).ready(function(){
- $(".btn-info").click(function(){
- var userdata = $(this).data('id');
- var userID = userdata.substr(0, userdata.indexOf(';'));
- var inputs = document.getElementsByName("user_id");
- for (i=0, max=inputs.length; i<max; i++)
- inputs[i].value = userID;
- document.getElementById("comboboxundefined").value = userdata.substr(userdata.indexOf(';')+1);
- });
- });
- </script>
- <?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