13 if (isset(
$_GET[
'user']))
17 $user->loadProperties(
$db,
$_GET[
'user']);
22 if (isset(
$_GET[
'user']))
25 $user->loadProperties(
$db,
$_GET[
'user']);
30 if(isset($_POST[
'save']))
32 $user->username = trim($user->username);
33 $user->username = strip_tags($_POST[
'username']);
34 if (isset($_FILES[
'userpicture']) && (!empty($_FILES[
'userpicture'][
'name'])))
37 $file_ext = substr($_FILES[
'userpicture'][
'name'], 0, -4);
38 if ($file_ext ==
".jpg") {
41 elseif ($file_ext ==
"jpeg") {
44 elseif ($file_ext ==
".gif") {
47 elseif ($file_ext ==
"png") {
52 $target_dir =
"../media/images/users/";
53 $target_file = $target_dir . basename(
"$user->username.jpg");
56 if(isset($_POST[
"submit"]))
58 $check = getimagesize($_FILES[
"userpicture"][
"tmp_name"]);
79 if ($_FILES[
"userpicture"][
"size"] > 2560000) {
80 echo alert::draw(
"warning",
"$lang[ERROR]",
"$lang[FILE_UPLOAD_TOO_LARGE]",
"page=users",
"4800");
85 $imageFileType = pathinfo($target_file,PATHINFO_EXTENSION);
86 if($imageFileType !=
"jpg" && $imageFileType !=
"jpeg" && $imageFileType !=
"png" && $imageFileType !=
"gif") {
87 echo alert::draw(
"warning",
"$lang[ERROR]",
"$lang[UPLOAD_ONLY_IMG_ALLOWED]",
"page=users",
"4800");
94 echo alert::draw(
"danger",
"$lang[ERROR]",
"$lang[FILE_UPLOAD_FAILED]",
"page=users",
"4800");
99 if (!move_uploaded_file($_FILES[
"userpicture"][
"tmp_name"], $target_file))
101 echo alert::draw(
"danger",
"$lang[ERROR]",
"$lang[FILE_UPLOAD_ERROR_CHMOD]",
"page=users",
"4800");
106 $password1 = htmlentities($_POST[
'password1']);
107 $password2 = htmlentities($_POST[
'password2']);
112 if (
$res =
$db->query(
"SELECT password FROM {users} WHERE username='".$_GET[
'user'].
"'"))
114 $row = mysqli_fetch_row(
$res);
116 if ($row[0] == $password_check)
118 $user->password = $row[0];
126 if (empty($_POST[
'templateID'])) { $_POST[
'templateID'] = 1; }
128 if (empty($_POST[
'overrideTemplate'])) { $_POST[
'overrideTemplate'] = 0; }
131 $user->username = htmlentities($_POST[
'username']);
132 $user->email = htmlentities($_POST[
'email']);
133 $user->url = htmlentities($_POST[
'url']);
134 $user->twitter = htmlentities($_POST[
'twitter']);
135 $user->facebook = htmlentities($_POST[
'facebook']);
136 $user->firstname = htmlentities($_POST[
'firstname']);
137 $user->lastname = htmlentities($_POST[
'lastname']);
138 $user->street = htmlentities($_POST[
'street']);
139 $user->zipcode = htmlentities($_POST[
'zipcode']);
140 $user->city = htmlentities($_POST[
'city']);
141 $user->country = htmlentities($_POST[
'country']);
142 $user->job = htmlentities($_POST[
'job']);
143 $user->templateID = htmlentities($_POST[
'templateID']);
144 $user->overrideTemplate = htmlentities($_POST[
'overrideTemplate']);
145 $user->gid = htmlentities($_POST[
'gid']);
147 if (!isset($_POST[
'privacy']) OR (empty($_POST[
'privacy'])))
149 $_POST[
'privacy'] = 0;
151 if (!isset($_POST[
'mystatus']) OR (empty($_POST[
'mystatus'])))
153 $_POST[
'mystatus'] = 0;
155 $user->privacy=
$db->quote($_POST[
'privacy']);
156 $user->blocked=
$db->quote($_POST[
'mystatus']);
165 <!-- Content Wrapper. Contains page content -->
166 <div class=\"content-wrapper\" id=\"content-FX\">
167 <!-- Content Header (Page header) -->
168 <section class=\"content-header\">";
170 echo backend::getTitle(
$lang[
'USER_PROFILE_EDIT'],
$_GET[
'user']);
171 echo
"<ol class=\"breadcrumb\">
172 <li><a href=\"index.php\" title=\"$lang[DASHBOARD]\"><i class=\"fa fa-dashboard\"></i> $lang[DASHBOARD]</a></li>
173 <li><a href=\"index.php?page=users\" title=\"$lang[USERS]\"> $lang[USERS]</a></li>
174 <li class=\"active\"><a href=\"index.php?page=user-edit&user=$_GET[user]\" title=\"$lang[EDIT]: $_GET[user]\"> $_GET[user]</a></li>
177 <!-- Main content -->
178 <section class=\"content\">";
180 echo
"<script type='text/javascript'>
182 function followUser(uid, hunted, user) {
184 $.ajax({ // do ajax request
185 url:'js/follow-user.php',
187 // data:'name='+name+'&comment='+comment+'&id='+id,
188 data:'uid='+uid+'&hunted='+hunted+'&user='+user,
189 success:function(data){
191 alert('Something went wrong!');
196 $(data).hide().appendTo('#followBtn');
197 $('#followBtn').hide()
198 $('#unfollowBtn').fadeIn(800);
204 function unfollowUser(uid, hunted, user) {
206 $.ajax({ // do ajax request
207 url:'js/follow-user.php',
209 // data:'name='+name+'&comment='+comment+'&id='+id,
210 data:'uid='+uid+'&hunted='+hunted+'&user='+user,
211 success:function(data){
213 alert('Something went wrong!');
217 $(data).hide().prependTo('#followBtn');
218 $('#unfollowBtn').hide(800);
219 $('#followBtn').show();
225 function friendUser(uid, hunted, user) {
227 $.ajax({ // do ajax request
228 url:'js/friend-user.php',
230 // data:'name='+name+'&comment='+comment+'&id='+id,
231 data:'uid='+uid+'&hunted='+hunted+'&user='+user,
232 success:function(data){
234 alert('Something went wrong!');
239 $(data).hide().prependTo('#friendBtn');
240 $('#friendBtn').hide()
241 $('#confirmBtn').fadeIn(800);
248 function unfriendUser(uid, hunted, user) {
250 $.ajax({ // do ajax request
251 url:'js/unfriend-user.php',
253 // data:'name='+name+'&comment='+comment+'&id='+id,
254 data:'uid='+uid+'&hunted='+hunted+'&user='+user,
255 success:function(data){
257 alert('Something went wrong!');
261 $(data).hide().prependTo('#friendBtn');
262 $('#unfriendBtn').hide(800);
263 $('#friendBtn').show();
273 <form
name=
"form" enctype=
"multipart/form-data" class=
"form" action=
"index.php?page=user-edit&user=<?php echo $user->username; ?>" method=
"post">
274 <input
name=
"save" id=
"savebutton" type=
"submit" class=
"btn btn-success pull-right" value=
"speichern" />
275 <
a class=
"btn btn-default pull-right" href=
"index.php?page=users">zurück</
a>
277 <div
class=
"col-md-4">
278 <!-- Profile Image -->
279 <div
class=
"box box-default">
280 <div
class=
"box-body box-profile">
281 <?php echo user::getUserImage(
"backend",
"$user->username",
"profile-user-img img-responsive img-circle",
'140',
'140'); ?>
283 <h3
class=
"profile-username text-center"><?php echo backend::getFullUsername($user); ?></h3>
285 <
p class=
"text-muted text-center"><?php echo user::getGroupNameFromID(
$db, $user->gid);
if (!empty($user->job)) echo
" & $user->job"; ?><br>Member since <?php
$date =
\YAWK\sys::splitDateShort($user->date_created);
286 echo
"<small>($date[month], $date[day] $date[year], $date[time])</small>"; ?></
p>
288 <ul
class=
"list-group list-group-unbordered">
289 <li
class=
"list-group-item">
295 $followersLink =
"<a href=\"index.php?page=list-follower&uid=$user->id\">$lang[FOLLOWERS]</a>";
299 $followersLink =
"$lang[FOLLOWER]";
302 <
b><?php echo $followersLink; ?></
b> <
a class=
"pull-right"><?php echo
$i_followers ?></
a>
304 <li
class=
"list-group-item">
305 <
b>Likes</
b> <
a class=
"pull-right"><?php echo $user->likes; ?></
a>
307 <li
class=
"list-group-item">
314 $friendlistLink =
"<a href=\"index.php?page=friendslist&uid=$user->id\">$lang[FRIENDS]</a>";
318 $friendlistLink =
"$lang[FRIENDS]";
321 <
b><?php echo $friendlistLink; ?></
b> <
a class=
"pull-right"><?php echo
$i_friends ?></
a>
329 $follow_status = user::checkFollowStatus(
$db, $_SESSION[
'uid'], $user->id);
331 $friends = user::isFriendRequested(
$db, $_SESSION[
'uid'], $user->id);
333 if ($follow_status ===
true)
335 $followBtn =
"<a href=\"#\" id=\"unfollowBtn\" title=\"click to un-follow\" onclick=\"unfollowUser($_SESSION[uid], $user->id, '$user->username' )\" name=\"unfollowUser\" class=\"btn btn-success btn-block\"><b>$lang[YOU_FOLLOW] $user->username </b></a>";
339 if ($_SESSION[
'uid'] != ($user->id))
341 $followBtn =
"<a href=\"#\" id=\"followBtn\" onclick=\"followUser($_SESSION[uid], $user->id, '$user->username')\" name=\"followUser\" class=\"btn btn-primary btn-block\"><b>$lang[FOLLOW_ME]</b></a>";
345 $followBtn =
$lang[
'FOLLOW_YOURSELF_FAIL'].
'<br>';
352 $friendBtn =
"<button id=\"unfriendBtn\" title=\"$lang[YOU_ARE_FRIENDS]\" class=\"btn btn-success btn-block\"><b>$lang[YOU_ARE_FRIEND_WITH] $user->username </b></button>";
356 if ($_SESSION[
'uid'] != ($user->id))
358 $friendBtn =
"<a href=\"#\" id=\"friendBtn\" onclick=\"friendUser($_SESSION[uid], $user->id, '$user->username')\" name=\"friendUser\" class=\"btn btn-primary btn-block\"><b>$lang[ASK_FOR_MY_FRIENDSHIP]</b></a>";
362 $friendBtn =
$lang[
'FRIENDSHIP_SELF_FAIL'];
368 if ($_SESSION[
'uid'] ==
$friend[
'friendA'])
370 $btnText =
"$lang[FRIEND_REQUEST_SENT_TO] $user->username";
372 elseif ($_SESSION[
'uid'] ==
$friend[
'friendB'])
374 $btnText =
"$lang[FRIEND_REQUEST_SENT_TO] $user->username";
379 $friendBtn =
"<a href=\"#\" id=\"confirmBtn\" title=\"$lang[FRIEND_AWAITING_RESPONSE] $user->username\" name=\"unfriendUser\" class=\"btn btn-warning btn-block\"><b>$btnText</b></a>";
383 $btnText =
"$user->username $lang[DECLINED_FRIEND_REQUEST]";
384 $friendBtn =
"<button id=\"blockedBtn\" title=\"$lang[ABORTED]\" class=\"btn btn-danger btn-block\"><b>$btnText</b></button>";
385 $friendBtn .=
"<a id=\"askBtn\" class=\"btn btn-default btn-block\" title=\"$user->username $lang[FRIENDSHIP_REJECTED]\" style=\"display: none;\" href=\"index.php?plugin=messages&pluginpage=mailbox&active=compose&to=$user->username\"><b>$lang[ASK_WHY_REJECTED]</b></a>";
392 echo
"<a href=\"#\" id=\"followBtn\" onclick=\"followUser($_SESSION[uid], $user->id, '$user->username')\" style=\"display:none;\" name=\"followUser\" class=\"btn btn-primary btn-block\"><b>$lang[FOLLOW_ME]</b></a>";
394 echo
"<a href=\"#\" id=\"unfollowBtn\" onclick=\"unfollowUser($_SESSION[uid], $user->id, '$user->username' )\" style=\"display: none;\" name=\"unfollowUser\" class=\"btn btn-success btn-block\"><b>$lang[YOU_FOLLOW] $user->username </b></a>";
396 if ($_SESSION[
'uid'] != ($user->id))
398 echo
"<a href=\"#\" id=\"friendBtn\" onclick=\"friendUser($_SESSION[uid], $user->id, '$user->username')\" style=\"display:none;\" name=\"friendUser\" class=\"btn btn-primary btn-block\"><b>$lang[ASK_FOR_MY_FRIENDSHIP]</b></a>";
401 echo
"<a href=\"#\" id=\"unfriendBtn\" title=\"You are friends!\" style=\"display:none;\" class=\"btn btn-success btn-block\"><b>$lang[YOU_ARE_FRIEND_WITH] $user->username </b></a>";
403 echo
"<a href=\"#\" id=\"confirmBtn\" title=\"click to un-friend\" style=\"display:none;\" name=\"unfriendUser\" class=\"btn btn-warning btn-block\"><b>$lang[REQUEST_HAS_BEEN_SENT] $user->username </b></a>";
407 <!-- <
a href=
"#" id=
"likeUser" class=
"btn btn-primary btn-block"><
b>Like me</
b></
a>-->
408 <!-- <
a href=
"#" id=
"requestFriendship" class=
"btn btn-primary btn-block"><
b>Ask
for my friendship</
b></
a> -->
416 <div
class=
"box box-default">
417 <div
class=
"box-body">
418 <label><?php echo
$lang[
'ASSIGN_TO_GROUP']; ?>
419 <select
name=
"gid" style=
"width: 240px;" class=
"form-control">
420 <option value=
"<?php echo $user->gid; ?>"><?php echo $user->getGroupNameFromID(
$db, $user->gid); ?></option>
421 <option value=
"1">---</option>
423 foreach(
YAWK\sys::getGroups(
$db,
"users") as $role){
425 echo
"<option value=\"".$role[
'id'].
"\"";
426 echo
">".$role[
'value'].
"</option>";
432 <label
for=
"job"><?php echo
$lang[
'JOB_DESCRIPTION']; ?><input
type=
"text" id=
"job" name=
"job" value=
"<?php echo $user->job; ?>" placeholder=
"<?php echo $lang['JOB_PLACEHOLDER']; ?>" class=
"form-control"></label>
433 <?php
if ($user->blocked ===
'1') {
$code1=
"checked=\"checked\""; }
else $code1=
""; ?>
434 <?php
if ($user->privacy ===
'1') {
$code2=
"checked=\"checked\""; }
else $code2=
""; ?>
436 <label
for=
"mystatus"><input
type=
"checkbox" id=
"mystatus" name=
"mystatus" value=
"1" <?php echo
$code1 ?>> <?php echo
$lang[
'LOGIN_LOCK']; ?></label>&
nbsp;&
nbsp;&
nbsp;&
nbsp;
437 <label
for=
"privacy"><input
type=
"checkbox" id=
"privacy" name=
"privacy" value=
"1" <?php echo
$code2 ?>> <?php echo
$lang[
'HIDE_FROM_WHOIS_ONLINE']; ?></label>&
nbsp;
442 <!-- ##### TEMPLATE OVERRIDE SETTINGS ##### -->
443 <div
class=
"box box-default">
444 <div
class=
"box-header with-border">
445 <h3
class=
"box-title"><
i class=
"fa fa-cube"></
i> <?php echo
"$lang[TPL] <small>$lang[TPL_USER_DEFINED]</small>"; ?></h3>
447 <div
class=
"box-body">
448 <label
for=
"templateID"><?php echo
$lang[
'TPL'].
" ".
$lang[
'ID']; ?>
449 <input
type=
"text" style=
"width:75px;" id=
"templateID" name=
"templateID" value=
"<?php echo $user->templateID; ?>" placeholder=
"<?php echo $lang['ID']; ?>" class=
"form-control">
451 <label
for=
"overrideTemplate"><?php echo
$lang[
'TPL_ALLOW_OVERRIDE']; ?>
452 <select
id=
"overrideTemplate" name=
"overrideTemplate" class=
"form-control">
454 if ($user->overrideTemplate == 1)
456 echo
'<option value="1" selected>'.$lang[
'ALLOWED'].
'</option>';
457 echo
'<option value="0">'.$lang[
'FORBIDDEN'].
'</option>';
460 echo
'<option value="0" selected>'.$lang[
'FORBIDDEN'].
'</option>';
461 echo
'<option value="1">'.$lang[
'ALLOWED'].
'</option>';
471 <!-- ##### USER PIC UPLOAD ##### -->
472 <div
class=
"box box-default">
473 <div
class=
"box-header with-border">
474 <h3
class=
"box-title"><
i class=
"fa fa-photo"></
i> <?php echo
"$lang[YOUR_PHOTO] <small>$lang[UPLOAD_A_NEW_PIC]</small>"; ?></h3>
476 <div
class=
"box-body">
478 <input
type=
"file" class=
"btn btn-warning" name=
"userpicture" id=
"userpicture">
484 <div
class=
"col-md-8">
486 <div
class=
"box box-default">
487 <div
class=
"box-header with-border">
488 <h3
class=
"box-title"><?php echo
"$lang[USER_DATA] <small>$lang[USERNAME_EMAIL_PWD]</small>"; ?></h3>
490 <div
class=
"box-body">
491 <?php
if ($user->username ===
"admin" OR $user->username ===
"root")
493 $disabled=
"title=\"$user->username $lang[NOT_CHANGEABLE]\" readonly=\"readonly\"";
501 <dl
class=
"dl-horizontal">
502 <dt><label
for=
"username"><
b class=
"fa fa-user"></
b> &
nbsp;<?php echo
$lang[
'USERNAME']; ?></label></dt>
503 <dd><input
type=
"text" id=
"username" name=
"username" class=
"form-control" maxlength=
"100" <?php echo $disabled; ?> value=
"<?php echo $user->username; ?>"></dd>
505 <dt><label
for=
"email"><
b class=
"fa fa-envelope-o"></
b> &
nbsp;<?php echo
$lang[
'EMAIL']; ?></label></dt>
506 <dd><input
type=
"text" id=
"email" name=
"email" class=
"form-control" maxlength=
"100" value=
"<?php echo $user->email; ?>"></dd>
508 <dt><label
for=
"password1"><
b class=
"fa fa-key"></
b> &
nbsp;<?php echo
$lang[
'PASSWORD']; ?></label></dt>
509 <dd><input
name=
"password1" id=
"password1" type=
"password" class=
"form-control" maxlength=
"100" value=
"<?php echo $user->password; ?>"></dd>
511 <dt><label
for=
"password2"><
b class=
"fa fa-key"></
b> &
nbsp;<?php echo
$lang[
'PASSWORD']; ?><br><small><?php echo
$lang[
'REPEAT']; ?></small></label></dt>
512 <dd><input
name=
"password2" id=
"password2" type=
"password" class=
"form-control"maxlength=
"100" value=
"<?php echo $user->password; ?>">&
nbsp; </dd>
518 <!-- OPTIONAL USER SETTINGS -->
519 <div
class=
"box box-default">
520 <div
class=
"box-header with-border">
521 <h3
class=
"box-title"><
i class=
"fa fa-home"></
i> <?php echo
"$lang[OPTIONAL_PERSONAL_DATA] <small>$lang[FIRSTNAME_LASTNAME_ADDRESS]"; ?></small></h3>
523 <div
class=
"box-body">
524 <dl
class=
"dl-horizontal">
525 <dt><label
for=
"firstname"><?php echo
$lang[
'FIRSTNAME']; ?></label></dt>
526 <dd><input
type=
"text" class=
"form-control" id=
"firstname" name=
"firstname" maxlength=
"100" value=
"<?php echo $user->firstname; ?>"></dd>
528 <dt><label
for=
"lastname"><?php echo
$lang[
'LASTNAME']; ?></label></dt>
529 <dd><input
type=
"text" class=
"form-control" id=
"lastname" name=
"lastname" maxlength=
"100" value=
"<?php echo $user->lastname; ?>"></dd>
531 <dt><label
for=
"street"><?php echo
$lang[
'STREET']; ?></label></dt>
532 <dd><input
type=
"text" class=
"form-control" id=
"street" name=
"street" maxlength=
"100" value=
"<?php echo $user->street; ?>"></dd>
534 <dt><label
for=
"zipcode"><?php echo
$lang[
'ZIPCODE']; ?></label></dt>
535 <dd><input
type=
"text" class=
"form-control" id=
"zipcode" name=
"zipcode" maxlength=
"12" value=
"<?php echo $user->zipcode; ?>"></dd>
537 <dt><label
for=
"city"><?php echo
$lang[
'CITY']; ?></label></dt>
538 <dd><input
type=
"text" class=
"form-control" id=
"city" name=
"city" maxlength=
"100" value=
"<?php echo $user->city; ?>"></dd>
540 <dt><label
for=
"country"><?php echo
$lang[
'COUNTRY']; ?></label></dt>
541 <dd><input
type=
"text" class=
"form-control" id=
"country" name=
"country" maxlength=
"100" value=
"<?php echo $user->country; ?>"></dd>
546 <!-- SOCIAL MEDIA USER SETTINGS -->
547 <div
class=
"box box-default">
548 <div
class=
"box-header with-border">
549 <h3
class=
"box-title"><
i class=
"fa fa-facebook-official"></
i> <?php echo
"$lang[SOCIAL_MEDIA_LINKS] <small>$lang[WEBSITE], $lang[TWITTER], $lang[FACEBOOK]</small>"; ?></h3>
551 <div
class=
"box-body">
552 <dl
class=
"dl-horizontal">
553 <dt><label
for=
"url"><
i class=
"fa fa-globe"></
i> <?php echo
"$lang[WEBSITE]"; ?></label></dt>
554 <dd><input
type=
"text" class=
"form-control" placeholder=
"http://www.yourdomain.com/" id=
"url" name=
"url" maxlength=
"100" value=
"<?php echo $user->url; ?>"></dd>
556 <dt><label
for=
"twitter"><
i class=
"fa fa-twitter"></
i> <?php echo
"$lang[TWITTER]"; ?></label></dt>
557 <dd><input
type=
"text" class=
"form-control" placeholder=
"http://www.twitter.com/yourprofile" id=
"twitter" name=
"twitter" maxlength=
"100" value=
"<?php echo $user->twitter; ?>"></dd>
559 <dt><label
for=
"facebook"><
i class=
"fa fa-facebook-official"></
i> <?php echo
"$lang[FACEBOOK]"; ?></label></dt>
560 <dd><input
type=
"text" class=
"form-control" placeholder=
"http://www.facebook.com/yourprofile" id=
"facebook" name=
"facebook" maxlength=
"100" value=
"<?php echo $user->facebook; ?>"></dd>
print $lang['FILEMAN_UPLOAD']
Throws a fancy Bootstrap Alert (success, info, warning or danger)
Backend class serves a few useful functions for the admin backend.
Mysqli database class; returns db connection object.
The language class - support multilingual backend.
static splitDateShort($date)
split a date to month, day, year and time this is the same as splitDate() but keep the months short
The default user class. Provide all functions to handle the user object.
static getUserImage($location, $user, $cssClass, $w, $h)
return and output user image
This class serves methods to create backup from files.
<!-- backend language -->< h3 >< i class="fa fa-language"></i > & nbsp
if($user->blocked==='1') else $code1
if($user->privacy==='1') else $code2