Admidio API
  • Package
  • Class
  • Tree
  • Deprecated
  • Todo

Packages

  • com
    • tecnick
      • tcpdf
  • None
  • PHPMailer
    • easypeasyics
  • PHPWavUtils
  • Securimage
    • classes

Classes

  • AutoLogin
  • Component
  • ComponentUpdate
  • ConditionParser
  • Database
  • DateTimeExtended
  • Email
  • Folder
  • FormValidation
  • FunctionClass
  • Htaccess
  • HtmlDiv
  • HtmlElement
  • HtmlForm
  • HtmlFormBasic
  • HtmlFormInstallation
  • HtmlList
  • HtmlNavbar
  • HtmlPage
  • HtmlTable
  • HtmlTableBasic
  • Image
  • Inventory
  • InventoryFields
  • Language
  • LanguageData
  • ListConfiguration
  • Menu
  • Message
  • ModuleAnnouncements
  • ModuleDates
  • ModuleLists
  • ModuleMenu
  • ModuleMessages
  • Modules
  • ModuleWeblinks
  • MyFiles
  • Navigation
  • ntlm_sasl_client_class
  • Organization
  • Participants
  • PasswordHash
  • PasswordHashing
  • ProfileFields
  • RoleDependency
  • RolesRights
  • RSSfeed
  • Session
  • SystemMail
  • TableAccess
  • TableAnnouncement
  • TableCategory
  • TableDate
  • TableFile
  • TableFolder
  • TableGuestbook
  • TableGuestbookComment
  • TableInventory
  • TableInventoryField
  • TableLists
  • TableMembers
  • TableMessage
  • TablePhotos
  • TableRoles
  • TableRooms
  • TableText
  • TableUserField
  • TableUsers
  • TableWeblink
  • UploadHandlerDownload
  • UploadHandlerPhoto
  • User
  • UserRegistration

Exceptions

  • AdmException
  • WavFileException
  • WavFormatException

Functions

  • admFuncAutoload
  • admFuncGeneratePagination
  • admFuncGetBytesFromSize
  • admFuncGetDirectoryEntries
  • admFuncMaxUploadSize
  • admFuncProcessableImageSize
  • admFuncShowCreateChangeInfoById
  • admFuncShowCreateChangeInfoByName
  • admFuncVariableIsValid
  • admReadTemplateFile
  • admStrIsValidFileName
  • admStrStripTagsSpecial
  • admStrToLower
  • admStrToUpper
  • bzip2Version
  • checkDatabaseVersion
  • checkPhpVersion
  • EmailAttachment
  • FileSizeNiceDisplay
  • FormattedTimeRemaining
  • FunctionIsDisabled
  • getFormerRolesFromDatabase
  • getFutureRolesFromDatabase
  • getmicrotime
  • getRoleMemberships
  • getRolesFromDatabase
  • gzipVersion
  • hasRole
  • hl_attrval
  • hl_bal
  • hl_cmtcd
  • hl_ent
  • hl_prot
  • hl_regex
  • hl_spec
  • hl_tag
  • hl_tag2
  • hl_tidy
  • hl_version
  • htmLawed
  • HTMLFilter
  • isGroupLeader
  • isMember
  • kses
  • kses_hook
  • MySQLdumpVersion
  • OutputInformation
  • SafeExec
  • showNotice
  • strAddSlashesDeep
  • strNextLetter
  • strStripSlashesDeep
  • strStripTags
  • strValidCharacters
  • tln_body2div
  • tln_casenormalize
  • tln_deent
  • tln_defang
  • tln_findnxreg
  • tln_findnxstr
  • tln_fixatts
  • tln_fixstyle
  • tln_fixurl
  • tln_getnxtag
  • tln_sanitize
  • tln_skipspace
  • tln_tagprint
  • tln_unspace
  • version_compare_replacement
  • version_compare_replacement_sub

Class Session

TableAccess
Extended by Session
Copyright: 2004-2016 The Admidio Team
License: GNU General Public License v2.0 only **********************************************************************************************
Brief:

Handle session data of Admidio and is connected to database table adm_sessions

This class should be used together with the PHP session handling. If you create a PHP session than you should also create this session object. The class will create a recordset in adm_sessions which stores the PHP session id. With this class it should be easy to add other objects to the session and read them out if you need them elsewhere.


Class: Session
Code:

script_a.php // add a new object to the session $organization = new Organization($gDb, $organizationId); $session = new Session($gDb, $sessionId); $session->addObject('organization', $organization, true);

script_b.php // read object out of session if($session->hasObject('organization')) { $organization =& $session->getObject('organization'); } @endcode


Par: Examples
Located at session.php

Methods summary

public
# __construct( Database & $database, integer|string $session = 0, string $cookiePrefix = '' )

Constructor that will create an object of a recordset of the table adm_sessions. If the id is set than the specific session will be loaded.

Constructor that will create an object of a recordset of the table adm_sessions. If the id is set than the specific session will be loaded.

Parameters

$database
Object of the class Database. This should be the default global object @b $gDb.
$session

The recordset of the session with this id will be loaded. The session can be the table id or the alphanumeric session id. If id isn't set than an empty object of the table is created.

$cookiePrefix
The prefix that is used for cookies

Overrides

TableAccess::__construct
public boolean
# addObject( string $objectName, object & $object )

Adds an object to the object array of this class. Objects in this array will be stored in the session and could be read with the method @b getObject.

Adds an object to the object array of this class. Objects in this array will be stored in the session and could be read with the method @b getObject.

Parameters

$objectName
Internal unique name of the object.
$object
The object that should be stored in this class.

Returns

boolean
Return false if object isn't type object or objectName already exists
public object|false &
# getObject( string $objectName )

Returns a reference of an object that is stored in the session. If the stored object has a database object than this could be renewed if the object has a method @b setDatabase. This is necessary because the old database connection is not longer valid.

Returns a reference of an object that is stored in the session. If the stored object has a database object than this could be renewed if the object has a method @b setDatabase. This is necessary because the old database connection is not longer valid.

Parameters

$objectName
Internal unique name of the object. The name was set with the method @b addObject

Returns

object|false
Returns the reference to the object or false if the object was not found.
public integer
# getOrganizationId( )

Return the organization id of this session. If AutoLogin is enabled then the organization may not be the organization of the config.php because the user had set the AutoLogin to a different organization.

Return the organization id of this session. If AutoLogin is enabled then the organization may not be the organization of the config.php because the user had set the AutoLogin to a different organization.

Returns

integer
Returns the organization id of this session
public boolean
# hasObject( string $objectName )

Checks if the object with this name exists in the object array of this class.

Checks if the object with this name exists in the object array of this class.

Parameters

$objectName
Internal unique name of the object. The name was set with the method @b addObject

Returns

boolean
Returns @b true if the object exits otherwise @b false
protected
# clearUserData( )
public boolean
# isValidLogin( integer $userId )

Check if the current session has a valid user login. Therefore the user id must be stored within the session and the timestamps must be valid

Check if the current session has a valid user login. Therefore the user id must be stored within the session and the timestamps must be valid

Parameters

$userId
The user id must be stored in this session and will be checked if valid.

Returns

boolean
Returns @b true if the user has a valid session login otherwise @b false;
public
# logout( )

The current user should be removed from the session and auto login. Also the auto login cookie should be removed.

The current user should be removed from the session and auto login. Also the auto login cookie should be removed.

public
# refreshSession( )

Reload session data from database table adm_sessions. Refresh AutoLogin with new auto_login_id. Check renew flag and reload organization object if necessary.

Reload session data from database table adm_sessions. Refresh AutoLogin with new auto_login_id. Check renew flag and reload organization object if necessary.

public
# renewOrganizationObject( )

If you call this function than a flag is set so that all other active sessions know that they should renew the organization object. They will renew it when the user perform the next action.

If you call this function than a flag is set so that all other active sessions know that they should renew the organization object. They will renew it when the user perform the next action.

public
# renewUserObject( integer $userId = 0 )

If you call this function than a flag is set so that all other active sessions know that they should renew their user object. They will renew it when the user perform the next action.

If you call this function than a flag is set so that all other active sessions know that they should renew their user object. They will renew it when the user perform the next action.

Parameters

$userId
(optional) if a user id is set then only user objects of this user id will be renewed
public boolean
# save( boolean $updateFingerPrint = true )

Save all changed columns of the recordset in table of database. Therefore the class remembers if it's a new record or if only an update is necessary. The update statement will only update the changed columns. If the table has columns for creator or editor than these column with their timestamp will be updated. For new records the organization, timestamp, begin date and ip address will be set per default.

Save all changed columns of the recordset in table of database. Therefore the class remembers if it's a new record or if only an update is necessary. The update statement will only update the changed columns. If the table has columns for creator or editor than these column with their timestamp will be updated. For new records the organization, timestamp, begin date and ip address will be set per default.

Parameters

$updateFingerPrint
Default @b true. Will update the creator or editor of the recordset if table has columns like @b usr_id_create or @b usr_id_changed

Returns

boolean
If an update or insert into the database was done then return true, otherwise false.

Overrides

TableAccess::save
public
# setAutoLogin( )

Save all data that is necessary for an auto login. Therefore an AutoLogin object will be created with an auto_login_id and this id will be stored in a cookie in the browser of the current user.

Save all data that is necessary for an auto login. Therefore an AutoLogin object will be created with an auto_login_id and this id will be stored in a cookie in the browser of the current user.

public
# setDatabase( Database & $database )

Set the database object for communication with the database of this class.

Set the database object for communication with the database of this class.

Parameters

$database
An object of the class Database. This should be the global $gDb object.

Overrides

TableAccess::setDatabase
public
# tableCleanup( integer $maxInactiveMinutes )

Deletes all sessions in table admSessions that are inactive since @b $maxInactiveTime minutes..

Deletes all sessions in table admSessions that are inactive since @b $maxInactiveTime minutes..

Parameters

$maxInactiveMinutes
Time in Minutes after that a session will be deleted. Minimum 30 minutes.

Methods inherited from TableAccess

__sleep(), clear(), connectAdditionalTable(), countAllRecords(), delete(), getValue(), hasColumnsValueChanged(), isNewRecord(), readData(), readDataByColumns(), readDataById(), setArray(), setValue()

Properties summary

protected array $mObjectArray
# array()
protected $mAutoLogin
#
protected $mCookiePrefix
#
protected $mDomain
#

Properties inherited from TableAccess

$additionalTables, $columnPrefix, $columnsInfos, $columnsValueChanged, $db, $dbColumns, $keyColumnName, $new_record, $tableName

Admidio API API documentation generated by ApiGen