Page MenuHomeGitPull.it

class-User.php
No OneTemporary

Authored By
Unknown
Size
1 KB
Referenced Files
None
Subscribers
None

class-User.php

<?php
# WikiCAPTCHA Control Room
# Copyright (C) 2019 Valerio Bozzolan and contributors
#
# 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/>.
/**
* Methods for a User class
*/
trait UserTrait {
/**
* Get the User name
*
* @return string
*/
public function getUserName() {
return $this->get( 'user_name' );
}
/**
* Get the User ID
*
* @return int
*/
public function getUserID() {
return $this->getSessionuserID();
}
/**
* Get the User UID
*
* @return string
*/
public function getUserUID() {
return $this->getSessionuserUID();
}
/**
* Get the User role
*
* @return string
*/
public function getUserRole() {
return $this->getSessionuserRole();
}
/**
* Check if the User is active
*
* @return boolean
*/
public function isUserActive() {
return $this->isSessionuserActive();
}
/**
* Check if the user is me
*
* @return boolean
*/
public function isUserMe() {
// if I'm logged, compare the IDs
if( is_logged() ) {
return $this->getUserID() === get_user()->getUserID();
}
return false;
}
/**
* Normalize an User class
*
*/
protected function normalizeUser() {
$this->integers( 'user_ID' );
$this->booleans( 'user_active' );
}
}
/**
* Class that can wrap an User retrieved from the database
*/
class User extends Sessionuser {
use UserTrait;
/**
* Constructor
*/
public function __construct() {
$this->normalizeUser();
}
}

File Metadata

Mime Type
text/x-php
Expires
Thu, Nov 19, 03:50 (1 h, 36 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2264644
Default Alt Text
class-User.php (1 KB)

Event Timeline