Overview

Namespaces

  • Glpi
    • Cache
    • Console
      • Command
      • Database
      • Ldap
      • Migration
      • Security
      • Task
    • Exception
  • None

Classes

  • AbstractQuery
  • Ajax
  • Alert
  • API
  • APIClient
  • APIRest
  • APIXmlrpc
  • Auth
  • AuthLDAP
  • AuthLdapReplicate
  • AuthMail
  • AutoUpdateSystem
  • Blacklist
  • BlacklistedMailContent
  • Budget
  • BudgetType
  • BusinessCriticity
  • Calendar
  • Calendar_Holiday
  • CalendarSegment
  • Cartridge
  • CartridgeItem
  • CartridgeItem_PrinterModel
  • CartridgeItemType
  • Central
  • Certificate
  • Certificate_Item
  • CertificateType
  • Change
  • Change_Group
  • Change_Item
  • Change_Problem
  • Change_Supplier
  • Change_Ticket
  • Change_User
  • ChangeCost
  • ChangeTask
  • ChangeValidation
  • CliMigration
  • CommonDBChild
  • CommonDBConnexity
  • CommonDBRelation
  • CommonDBTM
  • CommonDBVisible
  • CommonDCModelDropdown
  • CommonDevice
  • CommonDeviceModel
  • CommonDeviceType
  • CommonDropdown
  • CommonGLPI
  • CommonImplicitTreeDropdown
  • CommonITILActor
  • CommonITILCost
  • CommonITILObject
  • CommonITILTask
  • CommonITILValidation
  • CommonTreeDropdown
  • Computer
  • Computer_Item
  • Computer_SoftwareLicense
  • Computer_SoftwareVersion
  • ComputerAntivirus
  • ComputerModel
  • ComputerType
  • ComputerVirtualMachine
  • Config
  • Consumable
  • ConsumableItem
  • ConsumableItemType
  • Contact
  • Contact_Supplier
  • ContactType
  • Contract
  • Contract_Item
  • Contract_Supplier
  • ContractCost
  • ContractType
  • CronTask
  • CronTaskLog
  • Datacenter
  • DBConnection
  • DBmysql
  • DBmysqlIterator
  • DbUtils
  • DCRoom
  • DeviceBattery
  • DeviceBatteryModel
  • DeviceBatteryType
  • DeviceCase
  • DeviceCaseModel
  • DeviceCaseType
  • DeviceControl
  • DeviceControlModel
  • DeviceDrive
  • DeviceDriveModel
  • DeviceFirmware
  • DeviceFirmwareModel
  • DeviceFirmwareType
  • DeviceGeneric
  • DeviceGenericModel
  • DeviceGenericType
  • DeviceGraphicCard
  • DeviceGraphicCardModel
  • DeviceHardDrive
  • DeviceHardDriveModel
  • DeviceMemory
  • DeviceMemoryModel
  • DeviceMemoryType
  • DeviceMotherboard
  • DeviceMotherBoardModel
  • DeviceNetworkCard
  • DeviceNetworkCardModel
  • DevicePci
  • DevicePciModel
  • DevicePowerSupply
  • DevicePowerSupplyModel
  • DeviceProcessor
  • DeviceProcessorModel
  • DeviceSensor
  • DeviceSensorModel
  • DeviceSensorType
  • DeviceSimcard
  • DeviceSimcardType
  • DeviceSoundCard
  • DeviceSoundCardModel
  • DisplayPreference
  • Document
  • Document_Item
  • DocumentCategory
  • DocumentType
  • Domain
  • Dropdown
  • DropdownTranslation
  • Enclosure
  • EnclosureModel
  • Entity
  • Entity_KnowbaseItem
  • Entity_Reminder
  • Entity_RSSFeed
  • Fieldblacklist
  • FieldUnicity
  • Filesystem
  • FQDN
  • FQDNLabel
  • GLPI
  • GLPIKey
  • GLPIMailer
  • GLPINetwork
  • GLPIPDF
  • GLPIUploadHandler
  • Group
  • Group_KnowbaseItem
  • Group_Problem
  • Group_Reminder
  • Group_RSSFeed
  • Group_Ticket
  • Group_User
  • Holiday
  • Html
  • HTMLTableBase
  • HTMLTableCell
  • HTMLTableEntity
  • HTMLTableGroup
  • HTMLTableHeader
  • HTMLTableMain
  • HTMLTableRow
  • HTMLTableSubHeader
  • HTMLTableSuperHeader
  • Infocom
  • InterfaceType
  • IPAddress
  • IPAddress_IPNetwork
  • IPNetmask
  • IPNetwork
  • IPNetwork_Vlan
  • Item_DeviceBattery
  • Item_DeviceCase
  • Item_DeviceControl
  • Item_DeviceDrive
  • Item_DeviceFirmware
  • Item_DeviceGeneric
  • Item_DeviceGraphicCard
  • Item_DeviceHardDrive
  • Item_DeviceMemory
  • Item_DeviceMotherboard
  • Item_DeviceNetworkCard
  • Item_DevicePci
  • Item_DevicePowerSupply
  • Item_DeviceProcessor
  • Item_Devices
  • Item_DeviceSensor
  • Item_DeviceSimcard
  • Item_DeviceSoundCard
  • Item_Disk
  • Item_Enclosure
  • Item_OperatingSystem
  • Item_Problem
  • Item_Project
  • Item_Rack
  • Item_Ticket
  • Itil_Project
  • ITILCategory
  • ITILFollowup
  • ITILSolution
  • Knowbase
  • KnowbaseItem
  • KnowbaseItem_Comment
  • KnowbaseItem_Item
  • KnowbaseItem_Profile
  • KnowbaseItem_Revision
  • KnowbaseItem_User
  • KnowbaseItemCategory
  • KnowbaseItemTranslation
  • LevelAgreement
  • LevelAgreementLevel
  • Line
  • LineOperator
  • LineType
  • Link
  • Link_Itemtype
  • Location
  • Lock
  • Log
  • MailCollector
  • Manufacturer
  • MassiveAction
  • Migration
  • MigrationCleaner
  • Monitor
  • MonitorModel
  • MonitorType
  • Netpoint
  • Network
  • NetworkAlias
  • NetworkEquipment
  • NetworkEquipmentModel
  • NetworkEquipmentType
  • NetworkInterface
  • NetworkName
  • NetworkPort
  • NetworkPort_NetworkPort
  • NetworkPort_Vlan
  • NetworkPortAggregate
  • NetworkPortAlias
  • NetworkPortDialup
  • NetworkPortEthernet
  • NetworkPortFiberchannel
  • NetworkPortInstantiation
  • NetworkPortLocal
  • NetworkPortMigration
  • NetworkPortWifi
  • Notepad
  • Notification
  • Notification_NotificationTemplate
  • NotificationAjax
  • NotificationAjaxSetting
  • NotificationEvent
  • NotificationEventAbstract
  • NotificationEventAjax
  • NotificationEventMailing
  • NotificationMailing
  • NotificationMailingSetting
  • NotificationSetting
  • NotificationSettingConfig
  • NotificationTarget
  • NotificationTargetCartridgeItem
  • NotificationTargetCertificate
  • NotificationTargetChange
  • NotificationTargetCommonITILObject
  • NotificationTargetConsumableItem
  • NotificationTargetContract
  • NotificationTargetCrontask
  • NotificationTargetDBConnection
  • NotificationTargetFieldUnicity
  • NotificationTargetInfocom
  • NotificationTargetMailCollector
  • NotificationTargetObjectLock
  • NotificationTargetPlanningRecall
  • NotificationTargetProblem
  • NotificationTargetProject
  • NotificationTargetProjectTask
  • NotificationTargetReservation
  • NotificationTargetSavedsearch_Alert
  • NotificationTargetSoftwareLicense
  • NotificationTargetTicket
  • NotificationTargetUser
  • NotificationTemplate
  • NotificationTemplateTranslation
  • NotImportedEmail
  • ObjectLock
  • OLA
  • OlaLevel
  • OlaLevel_Ticket
  • OlaLevelAction
  • OlaLevelCriteria
  • OperatingSystem
  • OperatingSystemArchitecture
  • OperatingSystemEdition
  • OperatingSystemKernel
  • OperatingSystemKernelVersion
  • OperatingSystemServicePack
  • OperatingSystemVersion
  • PDU
  • Pdu_Plug
  • PDU_Rack
  • PDUModel
  • PDUType
  • Peripheral
  • PeripheralModel
  • PeripheralType
  • Phone
  • PhoneModel
  • PhonePowerSupply
  • PhoneType
  • Planning
  • PlanningRecall
  • Plug
  • Plugin
  • Preference
  • Printer
  • PrinterModel
  • PrinterType
  • Problem
  • Problem_Supplier
  • Problem_Ticket
  • Problem_User
  • ProblemCost
  • ProblemTask
  • Profile
  • Profile_Reminder
  • Profile_RSSFeed
  • Profile_User
  • ProfileRight
  • Project
  • ProjectCost
  • ProjectState
  • ProjectTask
  • ProjectTask_Ticket
  • ProjectTaskTeam
  • ProjectTaskTemplate
  • ProjectTaskType
  • ProjectTeam
  • ProjectType
  • PurgeLogs
  • QueryExpression
  • QueryParam
  • QuerySubQuery
  • QueryUnion
  • QueuedNotification
  • Rack
  • RackModel
  • RackType
  • RegisteredID
  • Reminder
  • Reminder_User
  • Report
  • RequestType
  • Reservation
  • ReservationItem
  • RSSFeed
  • RSSFeed_User
  • Rule
  • RuleAction
  • RuleAsset
  • RuleAssetCollection
  • RuleCollection
  • RuleCriteria
  • RuleDictionnaryComputerModel
  • RuleDictionnaryComputerModelCollection
  • RuleDictionnaryComputerType
  • RuleDictionnaryComputerTypeCollection
  • RuleDictionnaryDropdown
  • RuleDictionnaryDropdownCollection
  • RuleDictionnaryManufacturer
  • RuleDictionnaryManufacturerCollection
  • RuleDictionnaryMonitorModel
  • RuleDictionnaryMonitorModelCollection
  • RuleDictionnaryMonitorType
  • RuleDictionnaryMonitorTypeCollection
  • RuleDictionnaryNetworkEquipmentModel
  • RuleDictionnaryNetworkEquipmentModelCollection
  • RuleDictionnaryNetworkEquipmentType
  • RuleDictionnaryNetworkEquipmentTypeCollection
  • RuleDictionnaryOperatingSystem
  • RuleDictionnaryOperatingSystemArchitecture
  • RuleDictionnaryOperatingSystemArchitectureCollection
  • RuleDictionnaryOperatingSystemCollection
  • RuleDictionnaryOperatingSystemServicePack
  • RuleDictionnaryOperatingSystemServicePackCollection
  • RuleDictionnaryOperatingSystemVersion
  • RuleDictionnaryOperatingSystemVersionCollection
  • RuleDictionnaryPeripheralModel
  • RuleDictionnaryPeripheralModelCollection
  • RuleDictionnaryPeripheralType
  • RuleDictionnaryPeripheralTypeCollection
  • RuleDictionnaryPhoneModel
  • RuleDictionnaryPhoneModelCollection
  • RuleDictionnaryPhoneType
  • RuleDictionnaryPhoneTypeCollection
  • RuleDictionnaryPrinter
  • RuleDictionnaryPrinterCollection
  • RuleDictionnaryPrinterModel
  • RuleDictionnaryPrinterModelCollection
  • RuleDictionnaryPrinterType
  • RuleDictionnaryPrinterTypeCollection
  • RuleDictionnarySoftware
  • RuleDictionnarySoftwareCollection
  • RuleImportComputer
  • RuleImportComputerCollection
  • RuleImportEntity
  • RuleImportEntityCollection
  • RuleMailCollector
  • RuleMailCollectorCollection
  • RuleRight
  • RuleRightCollection
  • RuleRightParameter
  • RuleSoftwareCategory
  • RuleSoftwareCategoryCollection
  • RuleTicket
  • RuleTicketCollection
  • SavedSearch
  • SavedSearch_Alert
  • SavedSearch_User
  • Search
  • Session
  • SingletonRuleList
  • SLA
  • SlaLevel
  • SlaLevel_Ticket
  • SlaLevelAction
  • SlaLevelCriteria
  • SLM
  • Software
  • SoftwareCategory
  • SoftwareLicense
  • SoftwareLicenseType
  • SoftwareVersion
  • SolutionTemplate
  • SolutionType
  • SsoVariable
  • Stat
  • State
  • Supplier
  • Supplier_Ticket
  • SupplierType
  • TaskCategory
  • TaskTemplate
  • Telemetry
  • Ticket
  • Ticket_Ticket
  • Ticket_User
  • TicketCost
  • TicketFollowup
  • TicketRecurrent
  • TicketSatisfaction
  • TicketTask
  • TicketTemplate
  • TicketTemplateHiddenField
  • TicketTemplateMandatoryField
  • TicketTemplatePredefinedField
  • TicketValidation
  • Timer
  • Toolbox
  • Transfer
  • Update
  • User
  • UserCategory
  • UserEmail
  • UserTitle
  • VirtualMachineState
  • VirtualMachineSystem
  • VirtualMachineType
  • Vlan
  • WifiNetwork
  • XHProf
  • XML

Interfaces

  • NotificationEventInterface
  • NotificationInterface

Traits

  • DCBreadcrumb

Exceptions

  • CommonDBConnexityItemNotFound
  • HTMLTableCellFatherCoherentHeader
  • HTMLTableCellFatherSameRow
  • HTMLTableCellWithoutFather
  • HTMLTableUnknownHeader
  • HTMLTableUnknownHeaders
  • HTMLTableUnknownHeadersOrder

Functions

  • __
  • __s
  • _n
  • _nx
  • _sn
  • _sx
  • _x
  • autoName
  • closeDBConnections
  • contructListFromTree
  • contructTreeFromList
  • countDistinctElementsInTable
  • countElementsInTable
  • countElementsInTableForEntity
  • countElementsInTableForMyEntities
  • exportArrayToDB
  • formatUserName
  • get_hour_from_sql
  • getAllDatasFromTable
  • getAncestorsOf
  • getDateCriteria
  • getDateRequest
  • getDbRelations
  • getEntitiesRestrictCriteria
  • getEntitiesRestrictRequest
  • getForeignKeyFieldForItemType
  • getForeignKeyFieldForTable
  • getItemForItemtype
  • getItemtypeForForeignKeyField
  • getItemTypeForTable
  • getNextItem
  • getPlural
  • getPreviousItem
  • getRealQueryForTreeItem
  • getSingular
  • getSonsAndAncestorsOf
  • getSonsOf
  • getTableForItemType
  • getTableNameForForeignKeyField
  • getTreeForItem
  • getTreeLeafValueName
  • getTreeValueCompleteName
  • getTreeValueName
  • getUserName
  • glpi_autoload
  • importArrayFromDB
  • isAPI
  • isCommandLine
  • isForeignKeyField
  • isIndex
  • isPluginItemType
  • regenerateTreeCompleteName
  • Overview
  • Namespace
  • Class
  • Tree
  • Deprecated
  • Todo

Class Session

Session Class

Located at session.class.php
Methods summary
public static
# destroy( )

Destroy the current session

Destroy the current session

public static
# init( Auth $auth )

Init session for the user is defined

Init session for the user is defined

Parameters

$auth
Auth object to init session
public static
# setPath( )

Set the directory where are store the session file

Set the directory where are store the session file

public static
# start( )

Start the GLPI php session

Start the GLPI php session

public string
# getRootEntityName( )

Get root entity name

Get root entity name

Returns

string

Since

0.84
public static boolean
# isMultiEntitiesMode( )

Is GLPI used in multi-entities mode?

Is GLPI used in multi-entities mode?

Returns

boolean
public static boolean
# canViewAllEntities( )

Does user have right to see all entities?

Does user have right to see all entities?

Returns

boolean

Since

9.3.2
public static
# addToNavigateListItems( string $itemtype, integer $ID )

Add an item to the navigate through search results list

Add an item to the navigate through search results list

Parameters

$itemtype
Device type
$ID
ID of the item
public static
# initNavigateListItems( string $itemtype, string $title = "" )

Initialise a list of items to use navigate through search results

Initialise a list of items to use navigate through search results

Parameters

$itemtype
Device type
$title
List title (default '')
public static Nothing
# changeActiveEntities( integer|'All' $ID = "all", boolean $is_recursive = false )

Change active entity to the $ID one. Update glpiactiveentities session variable. Reload groups related to this entity.

Change active entity to the $ID one. Update glpiactiveentities session variable. Reload groups related to this entity.

Parameters

$ID

ID of the new active entity ("all"=>load all possible entities) (default 'all')

$is_recursive
Also display sub entities of the active entity? (false by default)

Returns

Nothing
public static
# changeProfile( integer $ID )

Change active profile to the $ID one. Update glpiactiveprofile session variable.

Change active profile to the $ID one. Update glpiactiveprofile session variable.

Parameters

$ID
ID of the new profile
public static
# initEntityProfiles( integer $userID )

Set the entities session variable. Load all entities from DB

Set the entities session variable. Load all entities from DB

Parameters

$userID
ID of the user
public static
# loadGroups( )

Load current user's group on active entity

Load current user's group on active entity

public static
# loadLanguage( string $forcelang = '', boolean $with_plugins = true )

Include the good language dict.

Include the good language dict.

Get the default language from current user in $_SESSION["glpilanguage"]. And load the dict that correspond.

Parameters

$forcelang
Force to load a specific lang
$with_plugins
Whether to load plugin languages or not
public static integer
# getPluralNumber( )

Get plural form number

Get plural form number

Returns

integer
public static boolean
# isCron( )

Detect cron mode or interactive

Detect cron mode or interactive

Returns

boolean

Since

0.84
public static false|integer|string
# getLoginUserID( boolean $force_human = true )

Get the Login User ID or return cron user ID for cron jobs

Get the Login User ID or return cron user ID for cron jobs

Parameters

$force_human
Force human / do not return cron user (true by default)

Returns

false|integer|string

false if user is not logged in int for user id, string for cron jobs

public static
# redirectIfNotLoggedIn( )

Redirect User to login if not logged in

Redirect User to login if not logged in

Since

0.85
public static |true
# checkValidSessionId( )

Global check of session to prevent PHP vulnerability

Global check of session to prevent PHP vulnerability

Returns

|true

Since

0.85

See

https://wiki.php.net/rfc/strict_sessions
public static
# checkCentralAccess( )

Check if I have access to the central interface

Check if I have access to the central interface

public static
# checkFaqAccess( )

Check if I have the right to access to the FAQ (profile or anonymous FAQ)

Check if I have the right to access to the FAQ (profile or anonymous FAQ)

public static
# checkHelpdeskAccess( )

Check if I have access to the helpdesk interface

Check if I have access to the helpdesk interface

public static
# checkLoginUser( )

Check if I am logged in

Check if I am logged in

public static
# checkRight( string $module, integer $right )

Check if I have the right $right to module $module (conpare to session variable)

Check if I have the right $right to module $module (conpare to session variable)

Parameters

$module
Module to check
$right
Right to check
public static
# checkRightsOr( string $module, array $rights = [] )

Check if I one right of array $rights to module $module (conpare to session variable)

Check if I one right of array $rights to module $module (conpare to session variable)

Parameters

$module
Module to check
$rights
Rights to check
public static
# checkSeveralRightsOr( array $modules )

Check if I have one of the right specified

Check if I have one of the right specified

You can't use this function if several rights for same module name

Parameters

$modules
Array of modules where keys are modules and value are right
public static boolean
# haveAccessToAllOfEntities( array $tab )

Check if you could access to ALL the entities of an list

Check if you could access to ALL the entities of an list

Parameters

$tab
List ID of entities

Returns

boolean
public static boolean
# haveAccessToEntity( integer $ID, boolean $is_recursive = 0 )

Check if you could access (read) to the entity of id = $ID

Check if you could access (read) to the entity of id = $ID

Parameters

$ID
ID of the entity
$is_recursive
if recursive item (default 0)

Returns

boolean
public static boolean
# haveAccessToOneOfEntities( array $tab, boolean $is_recursive = 0 )

Check if you could access to one entity of an list

Check if you could access to one entity of an list

Parameters

$tab
list ID of entities
$is_recursive
if recursive item (default 0)

Returns

boolean
public static boolean
# haveRecursiveAccessToEntity( integer $ID )

Check if you could create recursive object in the entity of id = $ID

Check if you could create recursive object in the entity of id = $ID

Parameters

$ID
ID of the entity

Returns

boolean
public static boolean
# haveRight( string $module, integer $right )

Have I the right $right to module $module (conpare to session variable)

Have I the right $right to module $module (conpare to session variable)

Parameters

$module
Module to check
$right
Right to check

Returns

boolean
public static boolean
# haveRightsAnd( string $module, integer[] $rights = [] )

Have I all rights of array $rights to module $module (conpare to session variable)

Have I all rights of array $rights to module $module (conpare to session variable)

Parameters

$module
Module to check
$rights
Rights to check

Returns

boolean
public static boolean
# haveRightsOr( string $module, integer[] $rights = [] )

Have I one right of array $rights to module $module (conpare to session variable)

Have I one right of array $rights to module $module (conpare to session variable)

Parameters

$module
Module to check
$rights
Rights to check

Returns

boolean
public static string
# getActiveTab( string $itemtype )

Get active Tab for an itemtype

Get active Tab for an itemtype

Parameters

$itemtype
item type

Returns

string
public static
# addMessageAfterRedirect( string $msg, boolean $check_once = false, integer $message_type = INFO, boolean $reset = false )

Add a message to be displayed after redirect

Add a message to be displayed after redirect

Parameters

$msg
Message to add
$check_once
Check if the message is not already added (false by default)
$message_type
Message type (INFO, WARNING, ERROR) (default INFO)
$reset
Clear previous added message (false by default)
public static
# setActiveTab( string $itemtype, integer $tab )

Force active Tab for an itemtype

Force active Tab for an itemtype

Parameters

$itemtype
item type
$tab
ID of the tab
public static mixed
# getSavedOption( string $itemtype, string $name, mixed $defvalue )

Get a saved option from request or session if get from request, save it

Get a saved option from request or session if get from request, save it

Parameters

$itemtype
name of itemtype
$name
name of the option
$defvalue
mixed default value for option

Returns

mixed

Since

0.83
public static boolean
# isReadOnlyAccount( )

Is the current account read-only

Is the current account read-only

Returns

boolean

Since

0.83
public static string
# getNewCSRFToken( )

Get new CSRF token

Get new CSRF token

Returns

string

Since

0.83.3
public static
# cleanCSRFTokens( )

Clean expires CSRF tokens

Clean expires CSRF tokens

Since

0.83.3
public static boolean
# validateCSRF( array $data )

Validate that the page has a CSRF token in the POST data and that the token is legit/not expired. If the token is valid it will be removed from the list of valid tokens.

Validate that the page has a CSRF token in the POST data and that the token is legit/not expired. If the token is valid it will be removed from the list of valid tokens.

Parameters

$data
$_POST data

Returns

boolean

Since

0.83.3
public static
# checkCSRF( array $data )

Check CSRF data

Check CSRF data

Parameters

$data
$_POST data

Since

0.84.2
public static boolean
# haveTranslations( string $itemtype, string $field )

Is field having translations ?

Is field having translations ?

Parameters

$itemtype
itemtype
$field
field

Returns

boolean

Since

0.85
public static false
# getCurrentInterface( )

Get current interface name extracted from session var (if exists)

Get current interface name extracted from session var (if exists)

Returns

false
or [helpdesk|central]

Since

9.2.2
Constants summary
integer NORMAL_MODE
# 0
integer TRANSLATION_MODE
# 1
integer DEBUG_MODE
# 2
GLPI version 9.4.7 API API documentation generated by ApiGen