|
static | ajaxLogin ($db, $user, $password) |
|
static | checkResetToken ($db, $token) |
| Check if password reset token matches and return uid. More...
|
|
static | countUsers ($db) |
| count and return all users More...
|
|
static | drawLoginBox ($username, $password) |
| return the html for a default login box More...
|
|
static | drawMenuLoginBox ($username, $password, $style) |
| return the html for a menu login box More...
|
|
static | drawPasswordResetForm ($db, $lang, $uid) |
| Draw the form where users can reset their password. More...
|
|
static | getCurrentUserName ($lang) |
| return current username More...
|
|
static | getLatestUsers ($db, $count) |
| get latest users and return as array More...
|
|
static | getLoginData ($db, $user) |
| return an array with all login data More...
|
|
static | getToken ($length) |
| Generate a safe token for password reset. More...
|
|
static | getUserEmail ($db, $user) |
| return email address of $user More...
|
|
static | getUserImage ($location, $user, $cssClass, $w, $h) |
| return and output user image More...
|
|
static | getUserList ($db) |
| output a list of all users (who have not activated privacy switch) More...
|
|
static | getUserTemplateID ($db, $uid) |
| template ID for given user ID More...
|
|
static | isAnybodyThere ($db) |
| check, if a session username is set and if user is logged in More...
|
|
static | sendResetEmail ($db, $username, $email, $lang) |
| Send password change request email. More...
|
|
static | setNewPassword ($db, $newPassword, $uid) |
| Set a new user password. More...
|
|
The default user class. Provide all functions to handle the user object.
The default user class. Provide all functions to handle the user object.
All functions that are required to handle a user. Methods are: add, edit, delete, checklogin and many more.
Class covers both, backend & frontend functionality. See Methods Summary for Details!
- Author
- Daniel Retzl danie.nosp@m.lret.nosp@m.zl@gm.nosp@m.ail..nosp@m.com
- Copyright
- 2009-2015 Daniel Retzl @license https://opensource.org/licenses/MIT
Definition at line 16 of file user.php.
static YAWK\user::getUserImage |
( |
|
$location, |
|
|
|
$user, |
|
|
|
$cssClass, |
|
|
|
$w, |
|
|
|
$h |
|
) |
| |
|
static |
return and output user image
- Parameters
-
string | $location | frontend or backend |
string | $user | username |
string | $cssClass | image css class eg. img-circle |
int | $w | width in pixel |
int | $h | height in pixel |
- Returns
- string
Definition at line 1079 of file user.php.
1081 if (isset($w) && isset($h))
1089 $width =
"width=\"$w\" ";
1097 $height =
"height=\"$h\" ";
1105 if (isset($cssClass))
1107 $css =
"class=\"$cssClass\"";
1114 if (isset($location))
1116 if ($location ==
"frontend"){
1117 $imageJpg =
"media/images/users/".$user.
".jpg";
1118 $imagePng =
"media/images/users/".$user.
".png";
1119 $defaultPic =
"<img src=\"media/images/users/avatar.png\" $width $height $css>";
1126 $defaultPic =
"<img src=\"media/images/users/avatar.png\" $width $height $css>";
1128 if ($location ==
"backend"){
1129 $imageJpg =
"../media/images/users/".$user.
".jpg";
1130 $imagePng =
"../media/images/users/".$user.
".png";
1132 if ($cssClass ==
"img-circle")
1134 $defaultPic =
"<img src=\"../media/images/users/avatar.png\" $width $height $css>";
1136 elseif ($cssClass ==
"img-circle sidebar-toggle")
1138 $defaultPic =
"<img src=\"../media/images/users/avatar-light.png\" $width $height $css>";
1140 if ($cssClass ==
"user-image")
1142 $defaultPic =
"<img src=\"../media/images/users/avatar.png\" $width $height $css>";
1144 if ($cssClass ==
"profile-user-img img-responsive img-circle")
1146 $defaultPic =
"<img src=\"../media/images/users/avatar.png\" $width $height $css>";
1153 $defaultPic =
"<img src=\"media/images/users/avatar.png\" $width $height $css>";
1160 $defaultPic =
"<img src=\"media/images/users/avatar.png\" $width $height $css>";
1164 if (file_exists($imageJpg)){
1165 return "<img src=\"".$imageJpg.
"\" $width $height $css>";
1167 elseif (file_exists($imagePng)){
1168 return "<img src=\"".$imagePng.
"\" $width $height $css>";
Referenced by YAWK\BACKEND\AdminLTE\drawHtmlLeftSidebar(), YAWK\BACKEND\AdminLTE\drawHtmlNavbarMessagesMenu(), YAWK\BACKEND\AdminLTE\drawHtmlNavbarUserAccountMenu(), YAWK\BACKEND\dashboard\drawLatestUsers(), YAWK\menu\drawLogoutMenu(), and YAWK\PLUGINS\MESSAGES\messages\MessageView().
static YAWK\user::sendResetEmail |
( |
|
$db, |
|
|
|
$username, |
|
|
|
$email, |
|
|
|
$lang |
|
) |
| |
|
static |
Send password change request email.
- Parameters
-
object | $db | database obj |
string | $username | username from pwd reset form |
string | $email | email from pwd reset from |
object | $lang | language obj |
- Returns
- bool true|false
Definition at line 232 of file user.php.
264 if (empty(
$uid) || (!is_numeric(
$uid)))
274 if (
$res =
$db->query(
"UPDATE {users} SET hashValue = '".$token.
"' WHERE id = '".
$uid.
"'"))
293 if (filter_var($to, FILTER_VALIDATE_EMAIL))
299 $firstCharOfUrl = mb_substr(
$url, 0,-1);
300 if ($firstCharOfUrl ===
"/")
302 $tokenLink =
$url.
"/index.php?resetPassword=true&token=$token";
306 $tokenLink =
$url.
"index.php?resetPassword=true&token=$token";
309 $mailBody =
"$lang[HELLO] $username!\n\r$lang[PASSWORD_RESET_REQUESTED]\n\r$lang[PASSWORD_RESET_MAILBODY]\n\r".$tokenLink.
"\n\r$lang[PASSWORD_RESET_REQUEST_WARNING].";
312 \YAWK\sys::setSyslog(
$db, 9, 0,
"reset password email requested from $username ($to)",
$uid, 0, 0, 0);
313 $_SESSION[
'passwordFail'] = 0;
318 \YAWK\alert::draw(
"warning",
$lang[
'ERROR'],
"$lang[EMAIL_NOT_SENT] <br>(from: $from)<br>(to: $to)",
"", 3800);
319 \YAWK\sys::setSyslog(
$db, 11, 1,
"failed to send reset password email to $username ($to)",
$uid, 0, 0, 0);
326 \YAWK\sys::setSyslog(
$db, 11, 1,
"invalid email address $to",
$uid, 0, 0, 0);
332 \YAWK\sys::setSyslog(
$db, 11, 1,
"failed to update hash value in database",
$uid, 0, 0, 0);
static sendEmail($email_from, $email_to, $email_cc, $email_subject, $email_message)
send an email
static getHost($db)
get hostname (url where yawk is installed) from database
static getToken($length)
Generate a safe token for password reset.
static getUserEmail($db, $user)
return email address of $user
This class serves methods to create backup from files.
References $db, YAWK\user\$email, $lang, $res, $uid, YAWK\user\$url, YAWK\user\$username, YAWK\alert\draw(), YAWK\sys\getHost(), YAWK\settings\getSetting(), YAWK\user\getToken(), YAWK\user\getUserEmail(), and YAWK\email\sendEmail().