Sponsorenverwaltung - Team StarCraft e.V.
 All Data Structures Files Functions Variables
functions_usercake.php File Reference

This file provides almost all functions used for the usermanagement. More...

Go to the source code of this file.

Functions

 getLanguageFiles ()
 
 getTemplateFiles ()
 
 getPageFiles ()
 
 destroySession ($name)
 
 getUniqueCode ($length="")
 
 generateActivationToken ()
 
 generateImprovedHash ($password, $hash=NULL, $rounds=WORKING_FACTOR)
 
 lang ($key, $markers=NULL)
 
 minMaxRange ($min, $max, $what)
 
 replaceDefaultHook ($str)
 
 sanitize ($str)
 
 prepareNamesForUsername ($str)
 
 prepareNameForDatabase ($name)
 
 isValidName ($name)
 
 generateSessionId ()
 
 sessionIdExists ($sessionId)
 
 deleteUsers ($userId)
 
 deleteUsersPermanently ($users)
 
 setUserIDIncrement ()
 
 emailExists ($email)
 
 mobileExists ($mobile)
 
 emailUsernameLinked ($email, $username)
 
 fetchAllUsers ()
 
 fetchUserDetails ($username=NULL, $token=NULL, $userId=NULL)
 
 fetchUsername ($userId)
 
 getStoredSession ($user_id)
 
 flagPassword ($userId, $value)
 
 isUserLoggedIn ()
 
 isUserAdministrator ()
 
 isUserRoot ()
 
 isAdministrator ($id)
 
 isRoot ($userId)
 
 hasSessionTimedOut ($user_id)
 
 getLastActivity ($userId)
 
 setUserActive ($token)
 
 setMailValid ($token)
 
 setUserLocked ($userId)
 
 updateFirstname ($userId, $newFirstname)
 
 updateUsername ($userId, $newUsername)
 
 updateLastname ($userId, $newLastname)
 
 updateEmail ($userId, $newEmail)
 
 updateMobile ($userId, $mobile)
 
 updateLastActivationRequest ($newActivationToken, $username, $email)
 
 updateMailConfirmationToken ($new_confirm_token, $username)
 
 updatePasswordFromToken ($newPasswordHash, $oldToken)
 
 updateTitle ($userId, $title)
 
 userIdExists ($userId)
 
 usernameExists ($username)
 
 validateActivationToken ($token, $lostpass=FALSE)
 
 createPermission ($permissionName)
 
 deletePermission ($permissionId)
 
 fetchAllPermissions ()
 
 fetchPermissionDetails ($permissionId)
 
 permissionIdExists ($permissionId)
 
 permissionNameExists ($permission)
 
 updatePermissionName ($permissionId, $newName)
 
 addPermission ($permissionId, $userId)
 
 fetchAllMatches ()
 
 fetchUserPermissions ($userId)
 
 fetchPermissionUsers ($permission_id)
 
 removePermission ($permissionId, $userId)
 
 hasSecurityHeader ($filename)
 
 createPages ($pages)
 
 deletePages ($pages)
 
 fetchAllPages ()
 
 fetchPageDetails ($pageId)
 
 pageIdExists ($pageId)
 
 updatePageState ($pageId, $state)
 
 resetStoredSession ($userId)
 
 accessGranted ($uri)
 
 hasValidMail ($userId)
 
 resetValidMail ($token)
 
 setValidMail ($token)
 
 fetchPageIdForName ($page)
 
 hasOnetimePassword ($userId)
 
 hasOnetimePasswordExpired ($userId)
 
 countUserReferences ($userId)
 
 acceptPasswordRequest ($token)
 
 denyPasswordRequest ($token)
 

Detailed Description

This file provides almost all functions used for the usermanagement.

This file provides the vast majority of functions used for usermanagement and its interaction with the sponsormanagement part.

For more details please consider reading the documentation of the certain function you're interestend in.

This file is based on funcs.php from UserCake Version: 2.0.2 with modifications by Alexander Vorndran and Daniel Seichter

This file depends on inc/common.php and inc/libs/usercake/config_usercake.php.

Version
1.0.0
Author
Usercake (http://usercake.com)
Alexander Vorndran
Daniel Seichter
Date
02.07.2013

Definition in file functions_usercake.php.

Function Documentation

acceptPasswordRequest (   $token)

Does token validation and sends a new password to the user via email

Parameters
string$tokenalphanumerical token to identify the user
Author
Usercake (http://usercake.com)
Alexander Vorndran

Definition at line 2144 of file functions_usercake.php.

References $errors, $successes, fetchUserDetails(), flagPassword(), generateImprovedHash(), getUniqueCode(), lang(), updatePasswordFromToken(), and validateActivationToken().

+ Here is the call graph for this function:

accessGranted (   $uri)

Checks if the current user has access to the given resource

Parameters
string$uriuniform resource identifier of the website
Returns
boolean
  • TRUE if the user has access
  • FALSE if not
Author
Daniel Seichter
Alexander Vorndran

Definition at line 1837 of file functions_usercake.php.

References $db, $errors, $mysqli, createPages(), fetchPageIdForName(), isUserAdministrator(), isUserLoggedIn(), isUserRoot(), PAGE_LOCK, PAGE_PRIVATE, PAGE_PUBLIC, and updatePageState().

+ Here is the call graph for this function:

addPermission (   $permissionId,
  $userId 
)

Match permission level(s) with user(s)

Parameters
array$permissionIdthe id of the permission
array$userIdthe id of the user
Returns
integer number of changes
Author
Usercake (http://www.usercake.com)

Definition at line 1479 of file functions_usercake.php.

References $db, and $mysqli.

Referenced by User\userCakeAddUser().

+ Here is the caller graph for this function:

countUserReferences (   $userId)

Returns the number of changes the user is responsible for

Parameters
integer$userIdthe id of the user
Returns
mixed
  • the number of changes
  • FALSE if an error occurred
Author
Florian Wirthmüller
Alexander Vorndran

Definition at line 2053 of file functions_usercake.php.

References $dbBackup, and $mysqli.

Referenced by deleteUsersPermanently().

+ Here is the caller graph for this function:

createPages (   $pages)

Add a page to the DB

Parameters
array$pagesthe names of the pages that should be added to the database
Returns
integer number of pages that were added successfully
Author
Usercake (http://www.usercake.com)

Definition at line 1669 of file functions_usercake.php.

References $db, $mysqli, and STANDARD_PAGE_ACCESS.

Referenced by accessGranted().

+ Here is the caller graph for this function:

createPermission (   $permissionName)

Create a permission level in DB

Parameters
string$permissionNamethe name of the new permission
Returns
integer number of changes

Definition at line 1312 of file functions_usercake.php.

References $db, and $mysqli.

deletePages (   $pages)

Delete a page from the DB

Parameters
array$pagesthe page-ids of the pages that should be deleted from the database
Author
Usercake (http://www.usercake.com)

Definition at line 1695 of file functions_usercake.php.

References $db, and $mysqli.

deletePermission (   $permissionId)

Delete a permission level from the DB

Parameters
integer$permissionIdthe id of the permission that should be deleted
Returns
integer number of changes

Definition at line 1331 of file functions_usercake.php.

References $db, $errors, $mysqli, and lang().

+ Here is the call graph for this function:

deleteUsers (   $userId)

Marks a defined array of users as deleted

Parameters
array$userIdthe ids of the users
Returns
mixed
  • On success: number of successfull deletions
  • On failure: FALSE
Author
Usercake (http://usercake.com)
Alexander Vorndran

Definition at line 343 of file functions_usercake.php.

References $db, $mysqli, DEFAULT_ADMIN_ACCOUNT, and isUserAdministrator().

+ Here is the call graph for this function:

deleteUsersPermanently (   $users)

Delete a defined array of users permanentaly Permits deletion if the user is responsible for changes

Parameters
array$usersthe array of users that should be deleted from the database
Returns
mixed
  • On success: number of successful deletions
  • On failure: FALSE
Author
Alexander Vorndran

Definition at line 392 of file functions_usercake.php.

References $db, $errors, $mysqli, countUserReferences(), DEFAULT_ADMIN_ACCOUNT, fetchUsername(), isUserAdministrator(), and isUserRoot().

+ Here is the call graph for this function:

denyPasswordRequest (   $token)

Resets the state of the password request

Parameters
string$tokenalphanumerical token to identify the user
Author
Usercake (http://usercake.com)
Alexander Vorndran

Definition at line 2186 of file functions_usercake.php.

References $errors, $successes, fetchUserDetails(), flagPassword(), lang(), and validateActivationToken().

+ Here is the call graph for this function:

destroySession (   $name)

Destroy a session as part of logout

Parameters
string$namethe name of the session variable that should be unset
Author
Usercake (http://usercake.com)

Definition at line 74 of file functions_usercake.php.

Referenced by isUserLoggedIn(), and LoggedInUser\userLogOut().

+ Here is the caller graph for this function:

emailExists (   $email)

Check if an email exists in the DB

Parameters
string$emailThe email-address to check
Author
Usercake (http://usercake.com)

Definition at line 459 of file functions_usercake.php.

References $db, and $mysqli.

Referenced by User\__construct().

+ Here is the caller graph for this function:

emailUsernameLinked (   $email,
  $username 
)

Check if a user name and email belong to the same user

Parameters
string$emailthe email-address of the user
string$usernamethe username of the user
Returns
boolean
  • TRUE if username and email-address belong to the same user
  • FALSE else

Definition at line 513 of file functions_usercake.php.

References $db, and $mysqli.

fetchAllMatches ( )

Retrieve information for all user/permission level matches

Returns
array array containing id, user id and matching permission id
Author
Usercake (http://www.usercake.com)

Definition at line 1516 of file functions_usercake.php.

References $db, and $mysqli.

fetchAllPages ( )

Fetch information on all pages

Returns
array an array containing the details of all pages
Author
Usercake (http://www.usercake.com)

Definition at line 1711 of file functions_usercake.php.

References $db, and $mysqli.

fetchAllPermissions ( )

Retrieve information for all permission levels

Returns
array an array containg the ids and names of all permission levels

Definition at line 1360 of file functions_usercake.php.

References $db, and $mysqli.

fetchAllUsers ( )

Retrieve information for all users

Returns
mixed
  • an array containig all the users and their details
  • FALSE on failure

Definition at line 541 of file functions_usercake.php.

References $db, and $mysqli.

fetchPageDetails (   $pageId)

Fetch information for a specific page

Parameters
integer$pageId
Returns
array the page information
Author
Usercake (http://www.usercake.com)

Definition at line 1736 of file functions_usercake.php.

References $db, and $mysqli.

fetchPageIdForName (   $page)

Fetch the id for given page

Parameters
string$pagethe name of the page
Returns
mixed
  • FALSE if the querie has failed
  • returns the id
Author
Usercake (http://www.usercake.com)

Definition at line 1976 of file functions_usercake.php.

References $db, and $mysqli.

Referenced by accessGranted().

+ Here is the caller graph for this function:

fetchPermissionDetails (   $permissionId)

Retrieve information for a single permission level

Parameters
integer$permissionId
Returns
array an array containing the information for the given permission-id

Definition at line 1381 of file functions_usercake.php.

References $db, and $mysqli.

fetchPermissionUsers (   $permission_id)

Retrieve list of users who have a permission level

Parameters
integer$permission_id
Returns
array contains all users with the given permission level
Author
Usercake (http://www.usercake.com)

Definition at line 1564 of file functions_usercake.php.

References $db, and $mysqli.

fetchUserDetails (   $username = NULL,
  $token = NULL,
  $userId = NULL 
)

Retrieve complete user information by username, token or ID

Parameters
string$username
string$token
integer$userId
Returns
mixed
  • an array containing the userdetails
  • FALSE if an error occurred

Definition at line 583 of file functions_usercake.php.

References $db, and $mysqli.

Referenced by acceptPasswordRequest(), denyPasswordRequest(), and LoggedInUser\getFullName().

+ Here is the caller graph for this function:

fetchUsername (   $userId)

Fetches the username for a given userid

Parameters
integer$userIdthe userid of the user
Returns
string
  • the username if the user exists
  • ' - ' if not
  • FALSE on failure

Definition at line 648 of file functions_usercake.php.

References $db, and $mysqli.

Referenced by deleteUsersPermanently(), fetchAllDeletedSponsorCarsForSponsor(), fetchAllDeletedSponsors(), fetchDeletedSponsorCars(), fetchSponsorEditDataForEditSections(), and fetchSponsorLatestEditData().

+ Here is the caller graph for this function:

fetchUserPermissions (   $userId)

Retrieve list of permission levels a user has

Parameters
integer$userIdthe id of the user
Returns
array all permission levels for the given user-id
Author
Usercake (http://www.usercake.com)

Definition at line 1538 of file functions_usercake.php.

References $db, and $mysqli.

flagPassword (   $userId,
  $value 
)

Toggle lost password request flag on or off

Parameters
integer$userIdthe id of the user
integer$valuethe value of the password flag
  • 0 nothing
  • 1 open password request
  • -1 user has received a temporary password
  • -2 user has used his temporary password
  • -3 the user has not changed his password but logged out
Returns
mixed
  • 1 on success
  • FALSE on failure
Author
Usercake (http://www.usercake.com)
Alexander Vorndran

Definition at line 709 of file functions_usercake.php.

References $db, and $mysqli.

Referenced by acceptPasswordRequest(), and denyPasswordRequest().

+ Here is the caller graph for this function:

generateActivationToken ( )

Generate an activation key

Returns
string the generated alphanumeric activation token
Author
Usercake (http://usercake.com)

Definition at line 103 of file functions_usercake.php.

References validateActivationToken().

Referenced by updatePasswordFromToken(), and User\userCakeAddUser().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

generateImprovedHash (   $password,
  $hash = NULL,
  $rounds = WORKING_FACTOR 
)

Generates a hash from the given password using bcrypt with a random salt. If salt is NULL the salt from the given hash is used.

Parameters
mixed$passwordthe password to hash
mixed$hash[optional]
  • the hash to compare against
  • Default: NULL in this case a random salt is generated
integer$rounds[optional]
  • how often the hashing algorithm should be repeated
  • Default: WORKING_FACTOR
See Also
config_usercake.php
Returns
mixed the hash for the given password if it's less then 13 characters an error occurred
Author
Alexander Vorndran

Definition at line 126 of file functions_usercake.php.

Referenced by acceptPasswordRequest(), LoggedInUser\updatePassword(), and User\userCakeAddUser().

+ Here is the caller graph for this function:

generateSessionId ( )

Generate a unique session id

Returns
string an unique session-id to identify a session
Author
Alexander Vorndran

Definition at line 295 of file functions_usercake.php.

References sessionIdExists().

+ Here is the call graph for this function:

getLanguageFiles ( )

Retrieve a list of all .php files in languages

Returns
array an array that contains the name of all language files in languages
Author
Usercake (http://usercake.com)

Definition at line 35 of file functions_usercake.php.

References ABS_PATH.

getLastActivity (   $userId)

returns the timestamp for the last sign in

Returns
mixed
  • the time of the last sign in
  • FALSE on failure
Author
Usercake (http://www.usercake.com)

Definition at line 915 of file functions_usercake.php.

References $db, and $mysqli.

Referenced by hasSessionTimedOut().

+ Here is the caller graph for this function:

getPageFiles ( )

Retrieve a list of all .php files in root files folder

Returns
array an array that contains the names
Author
Usercake (http://usercake.com)

Definition at line 59 of file functions_usercake.php.

getStoredSession (   $user_id)

Returns the session that is saved in the database

Parameters
integer$user_ididentifies the user from whom we want to get the stored session
Returns
mixed
  • returns the alphanumerical session id of the user
  • FALSE on failure

Definition at line 670 of file functions_usercake.php.

References $db, and $mysqli.

Referenced by hasSessionTimedOut(), and isUserLoggedIn().

+ Here is the caller graph for this function:

getTemplateFiles ( )

Retrieve a list of all .css files in site-templates

Returns
array an array that contains the names of all css-files in site-templates
Author
Usercake (http://usercake.com)

Definition at line 47 of file functions_usercake.php.

References ABS_PATH.

getUniqueCode (   $length = "")

Generate a unique code

Parameters
string$lengththe length of the generated unique code
Returns
string the generated unique code
Author
Usercake (http://usercake.com)

Definition at line 89 of file functions_usercake.php.

Referenced by acceptPasswordRequest().

+ Here is the caller graph for this function:

hasOnetimePassword (   $userId)

Checks wheter the user has a onetime password

Parameters
integer$userIdthe id of the user that should be checked
Returns
boolean
  • TRUE if the user has a passwordFlag less than 0
  • FALSE else
Author
Alexander Vorndran

Definition at line 2000 of file functions_usercake.php.

References $db, and $mysqli.

hasOnetimePasswordExpired (   $userId)

Checks if the user has an expired onetime password

Parameters
integer$userIdthe id of the user that should be checked
Returns
boolean
  • TRUE if the user has a passwordFlag less than -1
  • FALSE else
Author
Alexander Vorndran

Definition at line 2026 of file functions_usercake.php.

References $db, and $mysqli.

hasSecurityHeader (   $filename)

Checks if a given file has the UserCake-typical security header

Parameters
string$filenamethe name of the file to check
Returns
mixed
  • TRUE if the header was found
  • FALSE if the header was not found, -1 if something went wrong
Author
Alexander Vorndran

Definition at line 1638 of file functions_usercake.php.

References $filename.

hasSessionTimedOut (   $user_id)

Check if the current session has timed out

Returns
boolean
  • TRUE if the session has timed out
  • FALSE if not
Author
Alexander Vorndran

Definition at line 895 of file functions_usercake.php.

References AUTO_TIMEOUT, getLastActivity(), getStoredSession(), and RESET_SESSION_ID.

+ Here is the call graph for this function:

hasValidMail (   $userId)

Checks if the user has a validated email-address

Parameters
integer$userIdthe id of the user
Returns
boolean
  • TRUE if it's valid
  • FALSE if not
Author
Alexander Vorndran

Definition at line 1908 of file functions_usercake.php.

References $db, and $mysqli.

isAdministrator (   $id)

Check if a certain user is an administrator

Parameters
integer$idthe user id of the user whose rights should be checked
Returns
boolean
  • true if the user is an administrator
  • false if not

Definition at line 843 of file functions_usercake.php.

References $db, $mysqli, ADMIN_PERMISSION, DEFAULT_ADMIN_ACCOUNT, and MASTER_ACCOUNT.

isRoot (   $userId)

Checks wheter or not a user has root priviliges

Parameters
integer$userId
Returns
boolean TRUE if the user is a root user
Author
Alexander Vorndran

Definition at line 884 of file functions_usercake.php.

References DEFAULT_ADMIN_ACCOUNT, and MASTER_ACCOUNT.

isUserAdministrator ( )

Checks if the current user is an administrator

Returns
boolean
  • TRUE if he is an administrator
  • FALSE if not
Author
Alexander Vorndran

Definition at line 779 of file functions_usercake.php.

References $db, $mysqli, ADMIN_PERMISSION, isUserLoggedIn(), and isUserRoot().

Referenced by accessGranted(), deleteSponsorCarPermanently(), deleteUsers(), and deleteUsersPermanently().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

isUserLoggedIn ( )

Check if the current user is logged in if his session isn't valid any more destroy it

Returns
boolean
  • TRUE if the user is logged in
  • FALSE if not
Author
Alexander Vorndran

Definition at line 730 of file functions_usercake.php.

References $db, $mysqli, destroySession(), and getStoredSession().

Referenced by accessGranted(), deleteSponsor(), deleteSponsorCar(), isUserAdministrator(), isUserRoot(), and writeCsvFile().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

isUserRoot ( )

Checks if the current user is the root-user

Returns
boolean
  • TRUE if yes
  • FALSE if not
Author
Alexander Vorndran

Definition at line 823 of file functions_usercake.php.

References DEFAULT_ADMIN_ACCOUNT, isUserLoggedIn(), and MASTER_ACCOUNT.

Referenced by accessGranted(), deleteSponsorPermanently(), deleteUsersPermanently(), and isUserAdministrator().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

isValidName (   $name)

Checks whether the name only contains alphabetical values and values that might be allowed by prepare... functions

Parameters
string$namethe name to check
Returns
boolean
  • TRUE if the name is valid
  • FALSE if not
Author
Alexander Vorndran

Definition at line 285 of file functions_usercake.php.

Referenced by usernameExists().

+ Here is the caller graph for this function:

lang (   $key,
  $markers = NULL 
)

Inputs language strings from selected language.

Parameters
string$keyThe key of the language string in the corresponding language file
array$markersReplacements for gaps in the language string
Returns
string the language string for the key with replacements
Author
Usercake (http://usercake.com)

Definition at line 153 of file functions_usercake.php.

References $lang.

Referenced by acceptPasswordRequest(), deletePermission(), denyPasswordRequest(), and User\userCakeAddUser().

+ Here is the caller graph for this function:

minMaxRange (   $min,
  $max,
  $what 
)

Checks if a (trimed) string is within a min and max length

Parameters
integer$minthe minimal length
integer$maxthe maximal length
string$whatthe string to check
Returns
boolean
  • FALSE if the string is within min and max length
  • TRUE if not
Author
Usercake (http://usercake.com)

Definition at line 185 of file functions_usercake.php.

mobileExists (   $mobile)

Check whether a mobile number is already in the database

Parameters
string$mobilethe mobile number to check
Returns
boolean true if the mobile is in the database already false otherwise
Author
Alexander Vorndran

Definition at line 485 of file functions_usercake.php.

References $db, and $mysqli.

Referenced by User\__construct().

+ Here is the caller graph for this function:

pageIdExists (   $pageId)

Check if a page ID exists

Parameters
integer$pageIdthe id to check
Returns
boolean
  • TRUE if the pageId exists
  • FALSE if not
Author
Usercake (http://www.usercake.com)

Definition at line 1764 of file functions_usercake.php.

References $db, and $mysqli.

permissionIdExists (   $permissionId)

Check if a permission level ID exists in the DB

Parameters
integer$permissionIdthe permission-id to check
Returns
boolean TRUE if the id exists FALSE else

Definition at line 1405 of file functions_usercake.php.

References $db, and $mysqli.

permissionNameExists (   $permission)

Check if a permission level name exists in the DB

Parameters
string$permissionthe name of the permission to check
Returns
boolean TRUE if the name exists FALSE if not

Definition at line 1430 of file functions_usercake.php.

References $db, and $mysqli.

prepareNameForDatabase (   $name)

Prepares names for the database e.g. removes trailing and leading whitespace, reduces multiple whitespace to a single one and so on

Parameters
string$namethe name to prepare
Returns
string the prepared version of the input
Author
Alexander Vorndran

Definition at line 259 of file functions_usercake.php.

prepareNamesForUsername (   $str)

Prepares first- and lastname to be used as usernames e.g. replaces whitespace with '-'

Parameters
string$strthe input string
Returns
string the modified input string
Author
Alexander Vorndran

Definition at line 223 of file functions_usercake.php.

removePermission (   $permissionId,
  $userId 
)

Unmatch permission level(s) from user(s)

Parameters
mixed$permissionId
mixed$userId
Returns
integer number of successful removed permissions
Author
Usercake (http://www.usercake.com)

Definition at line 1589 of file functions_usercake.php.

References $db, $mysqli, ADMIN_PERMISSION, and DEFAULT_ADMIN_ACCOUNT.

replaceDefaultHook (   $str)

Replaces hooks with specified text

Parameters
string$strthe string containing the detault hooks
Returns
string the input string with the default replacements
Author
Usercake (http://usercake.com)

Definition at line 200 of file functions_usercake.php.

References $default_hooks, and $default_replace.

Referenced by UserCakeMail\newTemplateMsg().

+ Here is the caller graph for this function:

resetStoredSession (   $userId)

Resets the session-id to default value forces logout of the corresponding user

Parameters
integer$userId
Returns
mixed
  • FALSE or 0 if the action has failed
  • TRUE if it was a success
Author
Alexander Vorndran

Definition at line 1814 of file functions_usercake.php.

References $db, $mysqli, and RESET_SESSION_ID.

Referenced by LoggedInUser\userLogOut().

+ Here is the caller graph for this function:

resetValidMail (   $token)

Resets the valid mail status

Parameters
string$tokenthe alphanumerical token to identify the user
Returns
boolean
  • TRUE on success
  • FALSE on failure
Author
Alexander Vorndran

Definition at line 1934 of file functions_usercake.php.

References $db, and $mysqli.

Referenced by User\userCakeAddUser().

+ Here is the caller graph for this function:

sanitize (   $str)

Makes the string lowercase, removes trailing/leading whitespace and strips tags

Parameters
string$strinput string
Returns
string the sanitized string
Author
Usercake (http://usercake.com)

Definition at line 211 of file functions_usercake.php.

Referenced by User\__construct().

+ Here is the caller graph for this function:

sessionIdExists (   $sessionId)

Checks if a sessionid exists in the database

Parameters
string$sessionId
Returns
boolean
  • TRUE if the sessionid exists
  • FALSE if not
Author
Alexander Vorndran

Definition at line 311 of file functions_usercake.php.

References $db, and $mysqli.

Referenced by generateSessionId().

+ Here is the caller graph for this function:

setMailValid (   $token)

Change the valid_email-flag to valid

Parameters
string$tokenthe alphanumerical token
Returns
boolean
  • TRUE if the validation was a success
  • FALSE if not

Definition at line 964 of file functions_usercake.php.

References $db, and $mysqli.

setUserActive (   $token)

Change a user from inactive to active

Parameters
string$tokenthe alphanumerical activation token
Returns
mixed
  • 1 on success
  • FALSE on failure

Definition at line 944 of file functions_usercake.php.

References $db, and $mysqli.

setUserIDIncrement ( )

Sets the autoincrement value for user ids to 1000

Author
Alexander Vorndran

Definition at line 444 of file functions_usercake.php.

References $db, and $mysqli.

Referenced by User\userCakeAddUser().

+ Here is the caller graph for this function:

setUserLocked (   $userId)

Change a user from active to locked

Parameters
mixed$userIdthe id of the user who should get locked
Author
Alexander Vorndran

Definition at line 983 of file functions_usercake.php.

References $db, $mysqli, and DEFAULT_ADMIN_ACCOUNT.

setValidMail (   $token)

Sets the email valid for a given token

Parameters
string$tokendefines the user
Returns
boolean
  • TRUE on success
  • FALSE on failure
Author
Alexander Vorndran

Definition at line 1955 of file functions_usercake.php.

References $db, and $mysqli.

updateEmail (   $userId,
  $newEmail 
)

Update a user's email

Parameters
mixed$userId
string$newEmailthe new email-address
Returns
mixed
  • TRUE on success
  • FALSE on failure
Author
Usercake (http://www.usercake.com)

Definition at line 1075 of file functions_usercake.php.

References $db, and $mysqli.

updateFirstname (   $userId,
  $newFirstname 
)

Change a user's firstname

Parameters
mixed$userId
string$newFirstnamethe new firstname of the user
Returns
mixed
  • 1 on success
  • FALSE on failure
Author
Alexander Vorndran

Definition at line 1009 of file functions_usercake.php.

References $db, and $mysqli.

updateLastActivationRequest (   $newActivationToken,
  $username,
  $email 
)

Input new activation token, and update the time of the most recent activation request

Parameters
string$newActivationTokenthe new alphanumerical activation token
string$usernamethe username of the user
string$emailthe email-address of the user
Returns
boolean
  • TRUE on success
  • FALSE on failure
Author
Usercake (http://www.usercake.com)

Definition at line 1120 of file functions_usercake.php.

References $db, and $mysqli.

updateLastname (   $userId,
  $newLastname 
)

Change a user's lastname

Parameters
mixed$userId
string$newLastname
Returns
mixed
  • TRUE on success
  • FALSE on failure
Author
Alexander Vorndran

Definition at line 1053 of file functions_usercake.php.

References $db, and $mysqli.

updateMailConfirmationToken (   $new_confirm_token,
  $username 
)

Sets a new token for the confirmation of the email-adress

Parameters
string$new_confirm_tokenthe new token
string$usernamethe username of the user where the token should be set
Returns
boolean
  • TRUE on success
  • FALSE on failure
Author
Usercake (http://www.usercake.com)

Definition at line 1143 of file functions_usercake.php.

References $db, and $mysqli.

updateMobile (   $userId,
  $mobile 
)

Update a user's mobilephone number

Parameters
mixed$userId
string$mobilethe new email-address
Returns
mixed
  • TRUE on success
  • FALSE on failure
Author
Alexander Vorndran

Definition at line 1097 of file functions_usercake.php.

References $db, and $mysqli.

updatePageState (   $pageId,
  $state 
)

Toggle private/public/locked setting of a page

Parameters
integer$pageId
integer$statePAGE_PUBLIC, PAGE_PRIVATE, PAGE_LOCK
Returns
integer number of affected rows in the database
Author
Usercake (http://www.usercake.com)
Alexander Vorndran

Definition at line 1792 of file functions_usercake.php.

References $db, and $mysqli.

Referenced by accessGranted().

+ Here is the caller graph for this function:

updatePasswordFromToken (   $newPasswordHash,
  $oldToken 
)

Generate a random password and new token

Parameters
type$newPasswordHash
type$oldToken
Returns
boolean
  • TRUE on success
  • FALSE on failure
Author
Usercake (http://www.usercake.com)

Definition at line 1165 of file functions_usercake.php.

References $db, $mysqli, and generateActivationToken().

Referenced by acceptPasswordRequest().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

updatePermissionName (   $permissionId,
  $newName 
)

Change a permission level's name

Parameters
integer$permissionId
type$newName
Returns
number of changes

Definition at line 1456 of file functions_usercake.php.

References $db, and $mysqli.

updateTitle (   $userId,
  $title 
)

Update a user's title

Parameters
integer$userIdthe user-id of the user whos title is changed
string$titlethe new title of the user
Returns
boolean
  • TRUE on success
  • FALSE else
Author
Usercake (http://www.usercake.com)

Definition at line 1188 of file functions_usercake.php.

References $db, and $mysqli.

updateUsername (   $userId,
  $newUsername 
)

Change a user's username

Parameters
mixed$userId
string$newUsername
Returns
boolean
  • TRUE on success
  • FALSE on failure
Author
Alexander Vorndran

Definition at line 1031 of file functions_usercake.php.

References $db, and $mysqli.

userIdExists (   $userId)

Check if a user ID exists in the DB

Parameters
integer$userIdthe user-id to check
Returns
boolean
  • TRUE if the id exists in the database
  • FALSE if not
Author
Usercake (http://www.usercake.com)

Definition at line 1209 of file functions_usercake.php.

References $db, and $mysqli.

usernameExists (   $username)

Checks if a username exists in the DB

Parameters
string$usernamethe username to check
Returns
boolean
  • TRUE if the username exists in the database and is valid
  • FALSE if not
Author
Usercake (http://www.usercake.com)

Definition at line 1237 of file functions_usercake.php.

References $db, $mysqli, and isValidName().

Referenced by User\__construct().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

validateActivationToken (   $token,
  $lostpass = FALSE 
)

Check if activation token exists in DB

Parameters
string$tokenthe token that should be validated
mixed$lostpass[optional]
  • FALSE if the token was generated for activation purposes
  • TRUE if the token was generated for password purposes
Returns
boolean
  • TRUE if the token is present in the database
  • FALSE if not
Author
Usercake (http://www.usercake.com)

Definition at line 1272 of file functions_usercake.php.

References $db, and $mysqli.

Referenced by acceptPasswordRequest(), denyPasswordRequest(), and generateActivationToken().

+ Here is the caller graph for this function: