-
Notifications
You must be signed in to change notification settings - Fork 0
class usersystem
www/includes/usersystem.inc.php
Verschlüsselungs Möglichkeiten:
CRYPT_STD_DES - Standard DES-Schlüssel mit 2-Zeichen Salt
CRYPT_EXT_DES - Erweiterter DES-Schlüssel mit einem 9-Zeichen Salt
CRYPT_MD5 - MD5-Schlüssel mit 12-Zeichen Salt, beginnend mit
User Typen: 1 = Normaler User ##################### 0 isch nöd so cool wil wenns nöd gsetzt isch chunt jo au 0 2 = [z]member und schöne 0 = nicht eingeloggt ##################### Aber Weber: wenn typ = 2, gits $user jo gar nöd?! -> doch s'usersystem isch jo immer verfügbar verfügbar über $user->typ
zorg\Usersystem
- [z]biko
- IneX
5.0
-
1.0
class added -
2.0
additional methods added -
3.0
code optimizations and new methods -
4.0
10.12.2018
major refactorings & migrated methods from profil.php as part of the usersystem()-class -
5.0
26.12.2018
Bug #769: 'usertyp'-Spalte entspricht neu einer Usergruppe aus dem Table 'usergroups' (quasi als Foreign-Key)
default_activities_allow() | default_addle() | default_chess() | default_clan_tag() | default_firstname() | default_forum_boards() | default_forum_boards_unread() | default_forummaxthread() | default_irc_username() | default_lastname() | default_menulayout() | default_mymenu() | default_notifications() | default_show_comments() | default_sql_tracker() | default_telegram_chat_id() | default_usertype() | default_vereinsmitglied() | default_z_gremium() | default_zorger() | error_message() | field_activities_allow() | field_activity() | field_addle() | field_ausgesperrt_bis() | field_bild() | field_chess() | field_clantag() | field_currentlogin() | field_email() | field_firstname() | field_from_mobile() | field_irc() | field_last_ip() | field_lastlogin() | field_lastname() | field_maxdepth() | field_menulayout() | field_mymenu() | field_notifications() | field_regcode() | field_regdate() | field_sessionid() | field_show_comments() | field_sql_tracker() | field_telegram() | field_user_active() | field_username() | field_userpw() | field_usertyp() | field_vereinsmitglied() | field_z_gremium() | field_zorger() | table_name() | use_cookie() | use_current_login() | use_online_list() | use_registration_code() | use_user_picture() |
No constants found
__construct() | activate_user() | cacheGravatarImages() | checkimage() | create_newuser() | exec_aussperren() | exec_changeprofile() | exec_newpassword() | exec_uploadimage() | exportGravatarImages() | get_and_create_user_files_dir() | get_gravatar() | getFormFieldUserlist() deprecated
| id2mailuser() deprecated
| id2user() | id2useremail() | invalidate_session() | is_lockedout() | is_loggedin() | ismobile() | link_userpage() deprecated
| logerror() | login() | logout() | new_pass() | online_users() | password_gen() | quote() | regcode_gen() | set_page_style() | user2id() | userHasTelegram() | userImage() | userpagelink() deprecated
| userpic() deprecated
| userprofile_link() |
public
$default_activities_allow
public
$default_addle
public
$default_chess
Default Userprofile Settings
public
$default_clan_tag
- used-by: usersystem::exec_changeprofile()
public
$default_firstname
public
$default_forum_boards
public
$default_forum_boards_unread
public
$default_forummaxthread
public
$default_irc_username
public
$default_lastname
public
$default_menulayout
public
$default_mymenu
public
$default_notifications
public
$default_show_comments
public
$default_sql_tracker
public
$default_telegram_chat_id
public
$default_usertype
public
$default_vereinsmitglied
public
$default_z_gremium
public
$default_zorger
Object Vars
public
$error_message : string
Array: (Optional) Error-Message, see: self::activate_user()
Var to map User Fields
public
$field_activities_allow
public
$field_activity
public
$field_addle
public
$field_ausgesperrt_bis
public
$field_bild
public
$field_chess
public
$field_clantag
public
$field_currentlogin
public
$field_email
public
$field_firstname
public
$field_from_mobile
public
$field_irc
public
$field_last_ip
public
$field_lastlogin
public
$field_lastname
public
$field_maxdepth
public
$field_menulayout
public
$field_mymenu
public
$field_notifications
public
$field_regcode
public
$field_regdate
public
$field_sessionid
public
$field_show_comments
public
$field_sql_tracker
public
$field_telegram
public
$field_user_active
public
$field_username
public
$field_userpw
public
$field_usertyp
public
$field_vereinsmitglied
public
$field_z_gremium
public
$field_zorger
public
$table_name
Usersystem Configs
public
$use_cookie : bool
Array: Auto-einloggen mit Cookie aktivieren
public
$use_current_login
public
$use_online_list
public
$use_registration_code
public
$use_user_picture
Klassen Konstruktor
- Inherited from \usersystem
public
__construct() : object
See also
- usersystem::login(), usersystem::invalidate_session(), timestamp() Uses \ZORG_SESSION_ID \ZORG_COOKIE_SESSION \ZORG_COOKIE_USERID \ZORG_COOKIE_USERPW
- TODO: Will be deprecated in PHP7! -> http://php.net/manual/de/migration70.deprecated.php
- author: [z]biko
- author: IneX
-
version:
4.1
-
since:
1.0
method added -
since:
2.0
20.11.2018
IneX
code & query optimizations, updated Cookie & Session info taken from config.inc.php -
since:
3.0
27.11.2018
IneX
refactored User-Object instantiation if $_SESSION[user_id] is missing but Session-Cookie is there -
since:
4.0
10.12.2018
IneX
adjusted reading the Autologin-Cookies (cannot be dependent on the Session-Cookie, doh!) -
since:
4.1
02.11.2019
IneX
fixed ENUM("0")-Values from User DB-Record wrongfully set=true instead of =false
User aktivieren Aktiviert einen Useraccount mittels Regcode
- Inherited from \usersystem
public
activate_user(string $regcode) : bool
-
version:
2.0
-
since:
1.0
Method added -
since:
2.0
07.12.2019
IneX
Fixed $regcode check and response for profil.php -
var:
Array
String to store any Error message for later output - global: object $db Globales Class-Object mit allen MySQL-Methoden
Fetch Gravatar images for Userlist
- Inherited from \usersystem
public
cacheGravatarImages(int|string $userScope) : bool
- author: IneX
-
version:
1.0
-
since:
1.0
12.07.2018
IneX
function added - global: object $db Globales Class-Object mit allen MySQL-Methoden
Userpic prüfen
Überprüft ob ein Bild zum User existiert
- Inherited from \usersystem
public
checkimage( $userid) : string|bool
Uses \USER_IMGPATH \USER_IMGEXTENSION
- author: [z]biko
- author: IneX
-
version:
3.1
-
since:
1.0
Method added -
since:
2.0
11.07.2018
IneX
added check for locally cached Gravatar, replaced 'file_exists' with 'stream_resolve_include_path' -
since:
3.0
16.07.2018
IneX
Method now returns path to userpic (or queried Gravatar result) as string, instead of true. -
since:
3.1
18.04.2020
IneX
replaced 'stream_resolve_include_path' with more performant 'is_file' (https://stackoverflow.com/a/19589043/5750030)
Benutzer erstellen
Erstellt einen Neuen Benutzer
- Inherited from \usersystem
public
create_newuser(string $username, string $pw, string $pw2, string $email) : string
Uses \crypt_pw() \t()
-
version:
3.0
-
since:
1.0
method added -
since:
2.0
replaced messages with Translation-String solution t() -
since:
3.0
04.12.2018
removed IMAP-code, code & query optimizations - global: object $db Globales Class-Object mit allen MySQL-Methoden
User aussperren bis zu einem gewissen Zeitpunkt
- Inherited from \usersystem
public
exec_aussperren(int $user_id, array $date_array) : bool
See also
- Logout-action is triggered through /actions/profil.php Uses \self::logout()
- author: IneX
-
version:
1.0
-
since:
1.0
11.11.2018
method added, code adapted from /actions/profil.php - var:
- global: object $db Globales Class-Object mit allen MySQL-Methoden
- global: array $_geaechtet Globales Array mit allen geächteten Usern
Userprofil aktualisieren
Execute a Profile info & settings update for a User
- Inherited from \usersystem
public
exec_changeprofile(int $user_id, array $data_array) : array
Uses \check_email()
- author: [z]biko
- author: IneX
-
version:
3.0
-
since:
1.0
function added -
since:
2.0
02.10.2018
function improved to handle $_POST data dynamically -
since:
3.0
11.11.2018
function moved to usersystem()-Class - var:
- global: object $db Globales Class-Object mit allen MySQL-Methoden
- global: object $user Globales Class-Object mit den User-Methoden & Variablen
- global: array $_geaechtet Globales Array mit allen User-IDs welche einen Force-Logout haben
Password change
Execute a password change for a User
- Inherited from \usersystem
public
exec_newpassword(int $user_id, string $old_pass, string $new_pass, string $new_pass2) : array
Uses \crypt_pw()
- author: [z]biko
- author: IneX
-
version:
3.0
-
since:
1.0
function added -
since:
2.0
03.10.2018
function improved -
since:
3.0
11.11.2018
function moved to usersystem()-Class - global: object $db Globales Class-Object mit allen MySQL-Methoden
- global: object $user Globales Class-Object mit den User-Methoden & Variablen
Userpic hochladen
- Inherited from \usersystem
public
exec_uploadimage(int $user_id, array|resource $new_pic_files_array) : array
Uses \createPic()
- TODO: move this function to the usersystem()-Class
- author: [z]biko
- author: IneX
-
version:
4.0
-
since:
1.0
function added -
since:
2.0
Userpic Archivierung eingebaut / IneX -
since:
3.0
03.10.2018
function fixed and modernized -
since:
4.0
11.11.2018
function moved to usersystem()-Class - global: object $db Globales Class-Object mit allen MySQL-Methoden
Fetch & save Gravatar Userpics to local Filecache
Downloads & stores Gravatar images locally using cURL, so we don't query gravatar.com all the time
- Inherited from \usersystem
public
exportGravatarImages(array $userids) : bool
See also
- Uses \SITE_PROTOCOL \USER_IMGPATH \USER_IMGSIZE_LARGE \USER_IMGSIZE_SMALL \USER_IMGEXTENSION \cURLfetchUrl() \fileHash()
- author: IneX
-
version:
2.0
-
since:
1.0
11.07.2018
IneX
function added -
since:
2.0
13.08.2018
IneX
added md5 file hash check to compare files before downloading - TODO: wenn die self::id2useremail() Funktion gefixt ist (nicht nur eine response wenn E-Mail Notifications = true), dann Query ersetzen mit Methode
- global: object $db Globales Class-Object mit allen MySQL-Methoden
User specific /data/files/ Check if User's /files/{$user_id}/ Directory exists, if not, create it
- Inherited from \usersystem
public
get_and_create_user_files_dir(mixed $user_id) : mixed
- author: IneX
-
version:
1.0
-
since:
1.0
27.01.2016
IneX
method added
Gravatar Userpic
Get either a Gravatar URL or complete image tag for a specified email address.
- Inherited from \usersystem
public
get_gravatar(string $email, string $s = 150, string $d = '404', string $r = 'x') : string
Uses \SITE_PROTOCOL
- source:
- author: IneX
-
version:
3.0
-
since:
1.0
IneX
24.07.2014 -
since:
2.0
11.01.2017
IneX
Fixed Gravatar-URL to https using SITE_PROTOCOL -
since:
3.0
16.07.2018
IneX
Removed possibility to returnimg
-Tag
Retrieve list of Users for Notification-Messages in Comments or Personal Messages
- Inherited from \usersystem
public
getFormFieldUserlist(mixed $name, mixed $size, mixed $users_selected, mixed $tabindex = 10) : mixed
deprecated
- author: IneX
- date: 26.12.2017
- TODO: remove this function 'getFormFieldUserlist()' & make sure to remove all references in corresponding files pointing to it
ID zu Mail_Username
Wandelt eine User ID in IMAP-Mail_Username um
- Inherited from \usersystem
public
id2mailuser(int $id) : string
deprecated
Convert ID to Username/Userpic
Konvertiert eine ID zum entsprechenden Username (wahlweise inkl. Clantag oder ohne), oder dem HTML-Code zur Anzeige des Userpics
- Inherited from \usersystem
public
id2user(int $id, bool $clantag = FALSE, bool $pic = FALSE) : string|bool
Uses \self::userprofile_link()
- author: IneX
-
version:
5.0
-
since:
1.0
-
since:
2.0
-
since:
3.0
Method now really only resolves an ID to a Username, redirects other features -
since:
4.0
changed output to new function usersystem::userprofile_link() -
since:
5.0
added better validation for $id & changed return to 'false' if $id doesn't exist - TODO: 20.07.2018 Find out & fix issue with Query failing on id=$id instead of id="$id"...
- global: object $db Globales Class-Object mit allen MySQL-Methoden
ID zu User E-Mail
Gibt aufgrund einer User ID dessen E-Mailadresse zurück.
- Inherited from \usersystem
public
id2useremail(int $id) : string|bool
Uses \check_email()
- author: IneX
-
version:
4.1
-
since:
1.0
17.03.2018
IneX
method added -
since:
2.0
added additional check for "email_notification=TRUE" -
since:
3.0
updated method return values, added query try-catch -
since:
4.0
removed check for "email_notification=TRUE" due to new Notifications() Class -
since:
4.1
05.12.2019
IneX
removed unneccessary try-catch
Session & Cookies invalidieren
- Inherited from \usersystem
public
invalidate_session() : void
static
- author: IneX
-
version:
1.0
-
since:
1.0
28.11.2018
IneX
method added
Überprüfen ob User ausgesperrt ist
- Inherited from \usersystem
public
is_lockedout(int $ausgesperrt_bis_timestamp) : bool
- author: IneX
-
version:
1.0
-
since:
1.0
14.11.2018
method added - var:
- global: array $_geaechtet Globales Array mit allen geächteten Usern
Überprüft ob der User eingeloggt ist
- Inherited from \usersystem
public
is_loggedin() : bool
- author: IneX
-
version:
2.0
-
since:
1.0
method added -
since:
2.0
14.11.2018
method renamed from "islogged_in" => "is_loggedin"
User Mobile Agent
Prüft eine User-ID, ob der User von einem Mobilen Browser zugreift
- Inherited from \usersystem
public
ismobile( $id) : string
Link zum Userprofil
Gibt eine User ID als link zur userpage aus
- Inherited from \usersystem
public
link_userpage(int $user_id, bool $pic = FALSE) : string
deprecated
>2.0
Ersetzt mit usersystem::userprofile_link()
Uses \self::userprofile_link()
- author: [z]milamber
- author: IneX
-
version:
2.0
-
since:
1.0
initial version -
since:
2.0
changed output to new function usersystem::userprofile_link()
Error loggen
Speichert ein Fehler des Users in der DB ab.
- Inherited from \usersystem
public
logerror( $do, $user_id) : void
- TODO: Refactor this functionality & solve this differently. Needs updateing of usersystem::login()
User Login
Erstellt eine Session (login)
- Inherited from \usersystem
public
login(string $username, string $password = null, bool $use_cookie = false) : void|string
See also
- crypt_pw(), timestamp(), usersystem::invalidate_session() Uses \ZORG_SESSION_ID \ZORG_COOKIE_SESSION \ZORG_COOKIE_USERID \ZORG_COOKIE_USERPW
- author: [z]biko
- author: IneX
-
version:
4.1
-
since:
1.0
method added -
since:
2.0
12.11.2018
code & query optimizations -
since:
3.0
21.11.2018
Fixed redirect bei Login auf jeweils aktuelle Seite, nicht immer Home -
since:
4.0
10.12.2018
Improved Cookie-Settings (secure and stuff) -
since:
4.1
21.12.2018
Fixed redirect auf ursprüngliche Seite bei Cookie-Login ohne Session - var:
User Logout
Logt einen User aus!
- Inherited from \usersystem
public
logout() : void
static
See also
- author: [z]biko
- author: IneX
-
version:
3.0
-
since:
1.0
method added -
since:
2.0
fixed "If you put a date too far in the past, IE will bark and igores it, i.e. the value will not be removed" -
since:
3.0
21.11.2018
Fixed redirect bei Logout auf jeweils aktuelle Seite, nicht immer Home
Neues Passwort Generiert ein Passwort für einen bestehenden User
- Inherited from \usersystem
public
new_pass(string $email) : string
Uses \usersystem::password_gen() \crypt_pw() \ZORG_EMAIL
-
version:
4.1
-
since:
1.0
method added -
since:
2.0
global strings added -
since:
3.0
17.10.2018
Fixed Bug #763: Passwort vergessen funktioniert nicht -
since:
4.0
21.10.2018
Code & DB-Query improvements -
since:
4.1
04.01.2019
Fixed handling $db->update() result, changed Error messages, added debugging-output on DEV - global: object $db Globales Class-Object mit allen MySQL-Methoden
Online Users Gibt Online Users als HTML aus
- Inherited from \usersystem
public
online_users(bool $pic = FALSE) : string
Uses \USER_TIMEOUT
-
version:
2.1
-
since:
1.0
Method added -
since:
2.0
IneX
Code optimizations -
since:
2.1
17.04.2020
IneX
SQL Slow-Query optimization - TODO: HTML can be returned using new function usersystem::userpage_link()
- global: object $db Globales Class-Object mit allen MySQL-Methoden
Passwort-Generator
Erstellt ein zufälliges Passwort
- Inherited from \usersystem
public
password_gen( $length = 12) : string
- author: [z]biko
- author: IneX
-
version:
2.0
-
since:
1.0
method added -
since:
2.0
04.01.2019
updated mechanism and form of generated passwords, not using $username string anymore
User Quote (?)
Gibt ein random Quote zurück. Falls mit user_id wird es ein quote dieses users sein
- Inherited from \usersystem
public
quote( $user_id) : string
- TODO: @[z]milamber: Warum ist dies nicht im quotes.inc.php? Und wir brauchen das nicht mal?!
Registrationscode generieren
Erstellt einen Registrationscode für einen Benutzer
- Inherited from \usersystem
public
regcode_gen( $username) : string
Speichert ob User zorg oder zooomclan Layout haben will
- Inherited from \usersystem
public
set_page_style(int $user_id, bool $zorg = TRUE, bool $zooomclan = FALSE) : mixed
Get User ID based on Username
Konvertiert einen Username zur dazugehörigen User ID
- Inherited from \usersystem
public
user2id( $username) : int
-
version:
2.0
-
since:
1.0
initial function -
since:
2.0
optimized sql-query - author: IneX
- global: object $db Globales Class-Object mit allen MySQL-Methoden
Get User Telegram Chat-ID
Prüft ob der User-ID einen Telegram Messenger Chat-ID eingetragen hat -> wenn ja, wird die Telegram Chat-ID zurückgegeben
- Inherited from \usersystem
public
userHasTelegram(int $user_id) : int
- author: IneX
-
version:
1.0
-
since:
1.0
22.01.2017
IneX
method added
Userpic Pfad
Gibt den Pfad zum Bild des Users. Falls kein Bild: none.jpg
- Inherited from \usersystem
public
userImage(int $userid, bool $large = false) : string
Uses \USER_IMGPATH \USER_IMGPATH_PUBLIC \USER_IMGSIZE_SMALL \USER_IMGSIZE_LARGE \self::checkimage() \self::get_gravatar()
-
version:
2.0
-
since:
1.0
Method added -
since:
2.0
IneX
Check & load cached Gravatar, optimized if-else
Link zu einem Userprofil
- Inherited from \usersystem
public
userpagelink(mixed $userid, mixed $clantag, mixed $username) : mixed
deprecated
Ersetzt mit usersystem::userprofile_link()
Uses \self::userpage_link()
- TODO: wird diese Methode usersystem::userpagelink() noch benötigt irgendwo? Sonst: raus!
Userpic (klein) ausgeben
- Inherited from \usersystem
public
userpic(int $id, bool $displayName = FALSE) : string
deprecated
Uses \self::userprofile_link()
- author: IneX
- date: 02.10.2009
-
version:
2.0
-
since:
1.0
initial function -
since:
2.0
changed output to new function usersystem::userprofile_link() - TODO: there is no $clantag passed to this function?!
- global: object $db Globales Class-Object mit allen MySQL-Methoden
- global: object $user Globales Class-Object mit den User-Methoden & Variablen
- global: object $smarty Globales Class-Object mit allen Smarty-Methoden
- static: array $_users
Show Userprofile for a User ID
Gibt eine User ID als Username aus - mit diversen Darstellungsmöglichkeiten:
- Username: ja/nein?
- Clantag im Username: ja/nein?
- Userpic: ja/nein?
- Verlinkung auf Userprofil: ja/nein?
- Inherited from \usersystem
public
userprofile_link(int $userid, array $params) : string
See also
- Template for output used is userprofile_link.tpl Uses \usersystem::userImage() \usersystem::id2user()
- author: IneX
-
version:
1.0
-
since:
1.0
05.07.2018
IneX
initial version (output from Smarty-Template) - global: object $smarty Globales Class-Object mit allen Smarty-Methoden
\ » Classes » usersystem
Documentation generated on April 26th, 2020 at 15:54.
Powered by phpDocumentor with template GitHub-wiki.