first commit
This commit is contained in:
46
.gitignore
vendored
Normal file
46
.gitignore
vendored
Normal file
@ -0,0 +1,46 @@
|
|||||||
|
# Répertoire vendor si tu utilises Composer
|
||||||
|
/vendor/
|
||||||
|
|
||||||
|
# Cache
|
||||||
|
/files/_log/
|
||||||
|
/files/_cache/
|
||||||
|
files/_tmp/
|
||||||
|
|
||||||
|
# Configuration locale
|
||||||
|
/config/config_db.php
|
||||||
|
/config/config_path.php
|
||||||
|
|
||||||
|
# Backups éventuels
|
||||||
|
/files/_dumps/
|
||||||
|
|
||||||
|
# Fichiers temporaires
|
||||||
|
*.log
|
||||||
|
*.tmp
|
||||||
|
*.swp
|
||||||
|
*.swo
|
||||||
|
|
||||||
|
# Éviter les fichiers système
|
||||||
|
.DS_Store
|
||||||
|
Thumbs.db
|
||||||
|
|
||||||
|
# Environnement IDE
|
||||||
|
.idea/
|
||||||
|
.vscode/
|
||||||
|
*.sublime-workspace
|
||||||
|
*.sublime-project
|
||||||
|
|
||||||
|
# Si tu as installé GLPI via git clone, ignorer aussi les tests si inutiles
|
||||||
|
/tests/
|
||||||
|
|
||||||
|
# Si tu fais du dev avec des plugins
|
||||||
|
plugins/*/node_modules/
|
||||||
|
plugins/*/vendor/
|
||||||
|
plugins/*/files/_log/
|
||||||
|
plugins/*/files/_cache/
|
||||||
|
plugins/*/files/_tmp/
|
||||||
|
plugins/*/.env
|
||||||
|
|
||||||
|
|
||||||
|
/fiche_eval_upload
|
||||||
|
/file_upload
|
||||||
|
/files
|
||||||
98
.htaccess
Normal file
98
.htaccess
Normal file
@ -0,0 +1,98 @@
|
|||||||
|
# If you have problem with session.auto_start or session.use_trans_sid on install
|
||||||
|
# you need to set thse configurations values to 0 in php.ini or uncomment this line
|
||||||
|
# php_value session.auto_start 0
|
||||||
|
# php_value session.use_trans_sid 0
|
||||||
|
|
||||||
|
|
||||||
|
# The following lines enable the apache rewriting for the api. You can use url like http://glpi/api/.
|
||||||
|
<IfModule mod_rewrite.c>
|
||||||
|
RewriteEngine On
|
||||||
|
RewriteCond %{REQUEST_FILENAME} !-f
|
||||||
|
RewriteCond %{REQUEST_FILENAME} !-d
|
||||||
|
RewriteRule api/(.*)$ apirest.php/$1
|
||||||
|
</IfModule>
|
||||||
|
|
||||||
|
|
||||||
|
# You can uncomment following lines to enable caching of web assets (pictures, javascript files, etc)
|
||||||
|
<IfModule mod_expires.c>
|
||||||
|
ExpiresActive On
|
||||||
|
ExpiresByType image/jpg "access 1 year"
|
||||||
|
ExpiresByType image/jpeg "access 1 year"
|
||||||
|
ExpiresByType image/gif "access 1 year"
|
||||||
|
ExpiresByType image/png "access 1 year"
|
||||||
|
ExpiresByType text/css "access 1 year"
|
||||||
|
ExpiresByType text/x-javascript "access 1 month"
|
||||||
|
ExpiresByType text/javascript "access 1 month"
|
||||||
|
ExpiresByType application/javascript "access 1 month"
|
||||||
|
</IfModule>
|
||||||
|
|
||||||
|
<IfModule deflate_module>
|
||||||
|
<IfModule filter_module>
|
||||||
|
AddOutputFilterByType DEFLATE text/plain text/html
|
||||||
|
AddOutputFilterByType DEFLATE text/xml application/xml application/xhtml+xml application/xml-dtd
|
||||||
|
AddOutputFilterByType DEFLATE application/rdf+xml application/rss+xml application/atom+xml image/svg+xml
|
||||||
|
AddOutputFilterByType DEFLATE text/css text/javascript application/javascript application/x-javascript
|
||||||
|
AddOutputFilterByType DEFLATE font/otf font/opentype application/font-otf application/x-font-otf
|
||||||
|
AddOutputFilterByType DEFLATE font/ttf font/truetype application/font-ttf application/x-font-ttf
|
||||||
|
</IfModule>
|
||||||
|
</IfModule>
|
||||||
|
|
||||||
|
<IfModule mod_headers.c>
|
||||||
|
# Serve brotli compressed CSS and JS files if they exist
|
||||||
|
# and the client accepts brotli.
|
||||||
|
RewriteCond "%{HTTP:Accept-encoding}" "br"
|
||||||
|
RewriteCond "%{REQUEST_FILENAME}\.br" "-s"
|
||||||
|
RewriteRule "^(.*)\.(js|css)" "$1\.$2\.br" [QSA]
|
||||||
|
|
||||||
|
# Serve correct content types, and prevent double compression.
|
||||||
|
RewriteRule "\.css\.br$" "-" [T=text/css,E=no-brotli:1]
|
||||||
|
RewriteRule "\.js\.br$" "-" [T=text/javascript,E=no-brotli:1]
|
||||||
|
|
||||||
|
<FilesMatch "(\.js\.br|\.css\.br)$">
|
||||||
|
# Serve correct encoding type.
|
||||||
|
Header append Content-Encoding br
|
||||||
|
|
||||||
|
# Force proxies to cache brotli &
|
||||||
|
# non-brotli css/js files separately.
|
||||||
|
Header append Vary Accept-Encoding
|
||||||
|
</FilesMatch>
|
||||||
|
</IfModule>
|
||||||
|
# -------------------------------------------------------
|
||||||
|
# Free IP2Location Firewall List by Country
|
||||||
|
# Source: https://www.ip2location.com/free/visitor-blocker
|
||||||
|
# Last Generated: 17 Nov 2021 12:40:02 GMT
|
||||||
|
# [Important] Please update this list every month
|
||||||
|
# -------------------------------------------------------
|
||||||
|
|
||||||
|
<Files 403.shtml>
|
||||||
|
order allow,deny
|
||||||
|
allow from all
|
||||||
|
</Files>
|
||||||
|
|
||||||
|
deny from 144.91.68.184
|
||||||
|
deny from 35.216.166.72
|
||||||
|
deny from 103.92.27.198
|
||||||
|
deny from 68.183.65.255
|
||||||
|
deny from 180.137.132.91
|
||||||
|
deny from 47.243.78.78
|
||||||
|
deny from 45.195.9.237
|
||||||
|
deny from 101.34.69.208
|
||||||
|
deny from 54.254.196.21
|
||||||
|
deny from 180.211.99.217
|
||||||
|
deny from 208.109.11.58
|
||||||
|
deny from 164.92.143.142
|
||||||
|
deny from 172.104.249.21
|
||||||
|
deny from 199.201.110.210
|
||||||
|
deny from 170.64.156.13
|
||||||
|
deny from 35.216.201.154
|
||||||
|
deny from 104.165.127.125
|
||||||
|
deny from 45.39.72.220
|
||||||
|
deny from 91.205.175.8
|
||||||
|
deny from 173.249.11.93
|
||||||
|
|
||||||
|
# php -- BEGIN cPanel-generated handler, do not edit
|
||||||
|
# Set the “ea-php74” package as the default “PHP” programming language.
|
||||||
|
<IfModule mime_module>
|
||||||
|
AddHandler application/x-httpd-ea-php74 .php .php7 .phtml
|
||||||
|
</IfModule>
|
||||||
|
# php -- END cPanel-generated handler, do not edit
|
||||||
668
CHANGELOG.md
Normal file
668
CHANGELOG.md
Normal file
@ -0,0 +1,668 @@
|
|||||||
|
# GLPI changes
|
||||||
|
|
||||||
|
The present file will list all changes made to the project; according to the
|
||||||
|
[Keep a Changelog](http://keepachangelog.com/) project.
|
||||||
|
|
||||||
|
## [9.5.2] 2020-10-07
|
||||||
|
|
||||||
|
### API changes
|
||||||
|
|
||||||
|
#### Removed
|
||||||
|
|
||||||
|
- Ability to use SQL expressions as string in criterion values in SQL iterator (replaced by usage of `QueryExpression`).
|
||||||
|
- Ability to delete a plugin image using `/front/pluginimage.send.php` script.
|
||||||
|
|
||||||
|
## [9.5.1] 2020-07-16
|
||||||
|
|
||||||
|
## [9.5.0] 2020-07-07
|
||||||
|
|
||||||
|
### Added
|
||||||
|
|
||||||
|
- Encrypted file systems support.
|
||||||
|
- Mails collected from suppliers can be marked as private on an entity basis.
|
||||||
|
- Ability to add custom CSS in entity configuration.
|
||||||
|
- CLI commands to enable and disable maintenance mode.
|
||||||
|
- Operating system links on Monitors, Peripherals, Phones and Printers.
|
||||||
|
- Add datacenter items to global search
|
||||||
|
- Project task search options for Projects
|
||||||
|
- Automatic action to purge closed tickets
|
||||||
|
- Ability to automatically calculate project's percent done
|
||||||
|
- Software link on Phones.
|
||||||
|
- Add and answer approvals from timeline
|
||||||
|
- Add lightbox with PhotoSwipe to timeline images
|
||||||
|
- Ability to copy tasks while merging tickets
|
||||||
|
- the API gives the ID of the user who logs in with initSession
|
||||||
|
- Kanban view for projects
|
||||||
|
- Network ports on Monitors
|
||||||
|
- Add warning when there are unsaved changes in forms
|
||||||
|
- Add ability to get information from the status endpoint in JSON format using Accept header
|
||||||
|
- Add `glpi:system:status` CLI command for getting the GLPI status
|
||||||
|
|
||||||
|
### Changed
|
||||||
|
|
||||||
|
- PHP error_reporting and display_errors configuration directives are no longer overrided by GLPI, unless in debug mode (which forces reporting and display of all errors).
|
||||||
|
- `scripts/migrations/racks_plugin.php` has been replaced by `glpi:migration:racks_plugin_to_core` command available using `bin/console`
|
||||||
|
- Encryption alogithm improved using libsodium
|
||||||
|
|
||||||
|
### API changes
|
||||||
|
|
||||||
|
#### Added
|
||||||
|
|
||||||
|
- Add translation functions `__()`, `_n()`, `_x()` and `_nx()` in javascript in browser context.
|
||||||
|
- `Migration::renameItemtype()` method to update of database schema/values when an itemtype class is renamed
|
||||||
|
- Menu returned by `CommonGLPI::getMenuContent()` method override may now define an icon for each menu entry.
|
||||||
|
- `CommonDBConnexity::getItemsAssociatedTo()` method to get the items associated to the given one
|
||||||
|
- `CommonDBConnexity::getItemsAssociationRequest()` method to get the DB request to use to get the items associated to the given one
|
||||||
|
- `CommonDBTM::clone()` method to clone the current item
|
||||||
|
- `CommonDBTM::prepareInputForClone()` method to modify the input data that will be used for the cloning
|
||||||
|
- `CommonDBTM::post_clone()` method to perform other steps after an item has been cloned (like clone the elements it is associated to)
|
||||||
|
|
||||||
|
#### Changes
|
||||||
|
|
||||||
|
- jQuery library has been upgraded from 2.2.x to 3.4.x. jQuery Migrate is used to ensure backward compatibility in most cases.
|
||||||
|
- `DBmysqlIterator::handleOrderClause()` supports QueryExpressions
|
||||||
|
- Use Laminas instead of deprecated ZendFramework
|
||||||
|
- Database datetime fields have been replaced by timestamp fields to handle timezones support.
|
||||||
|
- Database integer/float fields values are now returned as number instead of strings from DB read operations.
|
||||||
|
- Field `domains_id` of Computer, NetworkEquipment and Printer has been dropped and data has been transfered into `glpi_domains_items` table.
|
||||||
|
- Plugin status hook can now be used to provide an array with more information about the plugin's status the status of any child services.
|
||||||
|
- Returned array should contain a 'status' value at least (See status values in Glpi\System\Status\StatusChecker)
|
||||||
|
- Old style returns are still supported
|
||||||
|
|
||||||
|
#### Deprecated
|
||||||
|
|
||||||
|
- `DBMysql::fetch_array()`
|
||||||
|
- `DBMysql::fetch_row()`
|
||||||
|
- `DBMysql::fetch_assoc()`
|
||||||
|
- `DBMysql::fetch_object()`
|
||||||
|
- `DBMysql::data_seek()`
|
||||||
|
- `DBMysql::insert_id()`
|
||||||
|
- `DBMysql::num_fields()`
|
||||||
|
- `DBMysql::field_name()`
|
||||||
|
- `DBMysql::list_fields()`
|
||||||
|
- `DBMysql::affected_rows()`
|
||||||
|
- `DBMysql::free_result()`
|
||||||
|
- `DBMysql::isMySQLStrictMode()`
|
||||||
|
- `getAllDatasFromTable` renamed to `getAllDataFromTable()`
|
||||||
|
- Usage of `$order` parameter in `getAllDataFromTable()` (`DbUtils::getAllDataFromTable()`)
|
||||||
|
- `Ticket::getTicketTemplateToUse()` renamed to `Ticket::getITILTemplateToUse()`
|
||||||
|
- `TicketTemplate::getFromDBWithDatas()` renamed to `TicketTemplate::getFromDBWithData()` (inherited from `ITILTemplate`)
|
||||||
|
- `Computer_SoftwareLicense` replaced by `Item_SoftwareLicense` and table `glpi_computers_softwarelicenses` renamed to `glpi_items_softwarelicenses`
|
||||||
|
- `Computer_SoftwareVersion` replaced by `Item_SoftwareVersion` and table `glpi_computers_softwareversions` renamed to `glpi_items_softwareversions`
|
||||||
|
- `Item_SoftwareVersion::updateDatasForComputer` renamed to `Item_SoftwareVersion::updateDatasForItem`
|
||||||
|
- `Item_SoftwareVersion::showForComputer` renamed to `Item_SoftwareVersion::showForItem`
|
||||||
|
- `Item_SoftwareVersion::softsByCategory` renamed to `Item_SoftwareVersion::softwareByCategory`
|
||||||
|
- `Item_SoftwareVersion::displaySoftsByLicense` renamed to `Item_SoftwareVersion::displaySoftwareByLicense`
|
||||||
|
- `Item_SoftwareVersion::cloneComputer` renamed to `Item_SoftwareVersion::cloneItem`
|
||||||
|
- `Transfer::transferComputerSoftwares` renamed to `Transfer::transferItemSoftwares`
|
||||||
|
- 'getRealQueryForTreeItem()'
|
||||||
|
- ``getCommonSelect`` and ``getCommonLeftJoin()`` from ``Ticket``, ``Change`` and ``Problem`` are replaced with ``getCommonCriteria()`` compliant with db iterator
|
||||||
|
- `Config::checkWriteAccessToDirs()`
|
||||||
|
- `Config::displayCheckExtensions()`
|
||||||
|
- `Toolbox::checkSELinux()`
|
||||||
|
- `Toolbox::userErrorHandlerDebug()`
|
||||||
|
- `Toolbox::userErrorHandlerNormal()`
|
||||||
|
- `Html::jsDisable()`
|
||||||
|
- `Html::jsEnable()`
|
||||||
|
- `Plugin::setLoaded()`
|
||||||
|
- `Plugin::setUnloaded()`
|
||||||
|
- `Plugin::setUnloadedByName()`
|
||||||
|
- Usage of `$LOADED_PLUGINS` global variable
|
||||||
|
- `CommonDBTM::getRawName()` replaced by `CommonDBTM::getFriendlyName()`
|
||||||
|
- `Calendar_Holiday::cloneCalendar()`
|
||||||
|
- `CalendarSegment::cloneCalendar()`
|
||||||
|
- `Computer_Item::cloneComputer()`
|
||||||
|
- `Computer_Item::cloneItem()`
|
||||||
|
- `ComputerAntivirus::cloneComputer()`
|
||||||
|
- `Contract::cloneItem()`
|
||||||
|
- `Contract_Item::cloneItem()`
|
||||||
|
- `ContractCost::cloneContract()`
|
||||||
|
- `Document_Item::cloneItem()`
|
||||||
|
- `Infocom::cloneItem()`
|
||||||
|
- `Item_Devices::cloneItem()`
|
||||||
|
- `Item_Disk::cloneItem()`
|
||||||
|
- `Item_OperatingSystem::cloneItem()`
|
||||||
|
- `Item_SoftwareLicense::cloneComputer()`
|
||||||
|
- `Item_SoftwareLicense::cloneItem()`
|
||||||
|
- `Item_SoftwareVersion::cloneComputer()`
|
||||||
|
- `Item_SoftwareVersion::cloneItem()`
|
||||||
|
- `Itil_Project::cloneItilProject()`
|
||||||
|
- `KnowbaseItem_Item::cloneItem()`
|
||||||
|
- `NetworkPort::cloneItem()`
|
||||||
|
- `Notepad::cloneItem()`
|
||||||
|
- `ProjectCost::cloneProject()`
|
||||||
|
- `ProjectTeam::cloneProjectTask()`
|
||||||
|
- `ProjectTask::cloneProjectTeam()`
|
||||||
|
- Usage of `GLPIKEY` constant
|
||||||
|
- `Toolbox::encrypt()` and `Toolbox::decrypt()` because they use the old encryption aglogithm
|
||||||
|
|
||||||
|
#### Removed
|
||||||
|
|
||||||
|
- Usage of string `$condition` parameter in `CommonDBTM::find()`
|
||||||
|
- Usage of string `$condition` parameter in `Dropdown::addNewCondition()`
|
||||||
|
- Usage of string in `$option['condition']` parameter in `Dropdown::show()`
|
||||||
|
- `KnowbaseItemCategory::showFirstLevel()`
|
||||||
|
- `Ticket::getTicketActors()`
|
||||||
|
- `NotificationTarget::getProfileJoinSql()`
|
||||||
|
- `NotificationTarget::getDistinctUserSql()`
|
||||||
|
- `NotificationTargetCommonITILObject::getProfileJoinSql()`
|
||||||
|
- `RuleCollection::getRuleListQuery()`
|
||||||
|
- `getNextItem()`
|
||||||
|
- `getPreviousItem()`
|
||||||
|
- `CommonDBChild::getSQLRequestToSearchForItem()`
|
||||||
|
- `CommonDBConnexity::getSQLRequestToSearchForItem()`
|
||||||
|
- `CommonDBRelation::getSQLRequestToSearchForItem()`
|
||||||
|
- `Project::addVisibility()`
|
||||||
|
- `Project::addVisibilityJoins()`
|
||||||
|
- `Plugin::hasBeenInit()`
|
||||||
|
- 'SELECT DISTINCT' and 'DISTINCT FIELDS' criteria in `DBmysqlIterator::buildQuery()`
|
||||||
|
- `CommonDBTM::getTablesOf()`
|
||||||
|
- `CommonDBTM::getForeignKeyFieldsOf()`
|
||||||
|
- `TicketFollowup`
|
||||||
|
- `getDateRequest` and `DbUtils::getDateRequest()`
|
||||||
|
- `Html::convertTagFromRichTextToImageTag()`
|
||||||
|
- `Transfer::createSearchConditionUsingArray()`
|
||||||
|
- Unused constants GLPI_FONT_FREESANS and GLPI_SCRIPT_DIR
|
||||||
|
|
||||||
|
## [9.4.6] 2020-05-05
|
||||||
|
|
||||||
|
## [9.4.5] 2019-12-18
|
||||||
|
|
||||||
|
## [9.4.4] 2019-09-24
|
||||||
|
|
||||||
|
### API changes
|
||||||
|
|
||||||
|
#### Changes
|
||||||
|
- For security reasons, autocompletion feature requires now to be authorized by a `'autocomplete' => true` flag in corresponding field search option.
|
||||||
|
|
||||||
|
## [9.4.3] 2019-06-20
|
||||||
|
|
||||||
|
### API changes
|
||||||
|
|
||||||
|
#### Deprecated
|
||||||
|
|
||||||
|
The following methods have been deprecated:
|
||||||
|
|
||||||
|
- `Html::convertTagFromRichTextToImageTag()`
|
||||||
|
|
||||||
|
## [9.4.2] 2019-04-11
|
||||||
|
|
||||||
|
### API changes
|
||||||
|
|
||||||
|
#### Deprecated
|
||||||
|
|
||||||
|
The following methods have been deprecated:
|
||||||
|
|
||||||
|
- `CommonDBTM::getTablesOf()`
|
||||||
|
- `CommonDBTM::getForeignKeyFieldsOf()`
|
||||||
|
|
||||||
|
## [9.4.1] 2019-03-15
|
||||||
|
|
||||||
|
### API changes
|
||||||
|
|
||||||
|
#### Added
|
||||||
|
|
||||||
|
- new display hook `timeline_actions` to add new buttons to timeline forms
|
||||||
|
- Ability to copy document links while merging tickets
|
||||||
|
|
||||||
|
#### Deprecated
|
||||||
|
|
||||||
|
The following methods have been deprecated:
|
||||||
|
|
||||||
|
- `Plugin::hasBeenInit()`
|
||||||
|
- Deprecate 'SELECT DISTINCT' and 'DISTINCT FIELDS' criteria in `DBmysqlIterator::buildQuery()`
|
||||||
|
|
||||||
|
#### Removed
|
||||||
|
|
||||||
|
- Drop `CommonITILObject::showSolutions()`.
|
||||||
|
|
||||||
|
## [9.4.0] 2019-02-11
|
||||||
|
|
||||||
|
### Added
|
||||||
|
|
||||||
|
- Ability to link project with problems and tickets.
|
||||||
|
- Ability to specify creation and modification dates during CommonDBTM object add method
|
||||||
|
- Add followups to Changes and Problems.
|
||||||
|
- Add timeline to Changes and Problems.
|
||||||
|
- CLI console to centralize CLI commands.
|
||||||
|
- Search on devices from Printers and Network equipments.
|
||||||
|
- Ability to merge and split tickets.
|
||||||
|
- Search on devices from Printers and Network equipments.
|
||||||
|
- Ability to specify creation and modification dates during CommonDBTM object add method.
|
||||||
|
|
||||||
|
### Changed
|
||||||
|
- `license_id` field in `glpi_items_operatingsystems` table has been renamed to `licenseid`
|
||||||
|
- `olas_tto_id` field in `glpi_tickets` table has been renamed to `olas_id_tto`
|
||||||
|
- `olas_ttr_id` field in `glpi_tickets` table has been renamed to `olas_id_ttr`
|
||||||
|
- `ttr_olalevels_id` field in `glpi_tickets` table has been renamed to `olalevels_id_ttr`
|
||||||
|
- `slas_tto_id` field in `glpi_tickets` table has been renamed to `slas_id_tto`
|
||||||
|
- `slas_ttr_id` field in `glpi_tickets` table has been renamed to `slas_id_ttr`
|
||||||
|
- `ttr_slalevels_id` field in `glpi_tickets` table has been renamed to `slalevels_id_ttr`
|
||||||
|
- `scripts/add_creation_date.php` has been replaced by `glpi:migration:build_missing_timestamps` command available using `bin/console`
|
||||||
|
- `scripts/checkdb.php` has been replaced by `glpi:database:check` command available using `bin/console`
|
||||||
|
- `scripts/cliinstall.php` has been replaced by `glpi:database:install` command available using `bin/console`
|
||||||
|
- `scripts/cliupdate.php` has been replaced by `glpi:database:update` command available using `bin/console`
|
||||||
|
- `scripts/ldap_mass_sync.php` has been replaced by `glpi:ldap:synchronize_users` command available using `bin/console`
|
||||||
|
- `scripts/innodb_migration.php` has been replaced by `glpi:migration:myisam_to_innodb` command available using `bin/console`
|
||||||
|
- `scripts/unlock_tasks.php` has been replaced by `glpi:task:unlock` command available using `bin/console`
|
||||||
|
|
||||||
|
### API changes
|
||||||
|
|
||||||
|
#### Changes
|
||||||
|
- Plugins are now loaded in ajax files.
|
||||||
|
- `TicketFollowup` has been replaced by `ITILFollowup`
|
||||||
|
- `$num` parameter has been removed from several `Search` class methods:
|
||||||
|
- `addSelect()`,
|
||||||
|
- `addOrderBy()`,
|
||||||
|
- `addHaving()`,
|
||||||
|
- `giveItem()`
|
||||||
|
- `NotificationTarget::getMode()` visibility is now `public`.
|
||||||
|
- Added `add_recipient_to_target` hook, triggered when a recipient is added to a notification.
|
||||||
|
|
||||||
|
#### Deprecated
|
||||||
|
|
||||||
|
- Remove `$CFG_GLPI['use_rich_text']` parameter. Will now be `true` per default.
|
||||||
|
- Remove `$CFG_GLPI['ticket_timeline']` parameter. Will now be `true` per default.
|
||||||
|
- Remove `$CFG_GLPI['ticket_timeline_keep_replaced_tabs']` parameter. Will now be `false` per default.
|
||||||
|
- Usage of `TicketFollowup` class has been deprecated.
|
||||||
|
- Usage of string `$condition` parameter in `CommonDBTM::find()` has been deprecated.
|
||||||
|
- Usage of string `$condition` parameter in `Dropdown::addNewCondition()` has been deprecated.
|
||||||
|
- Usage of string in `$option['condition']` parameter in `Dropdown::show()` has been deprecated.
|
||||||
|
|
||||||
|
The following methods have been deprecated:
|
||||||
|
|
||||||
|
- `KnowbaseItemCategory::showFirstLevel()`
|
||||||
|
- `Ticket::getTicketActors()`
|
||||||
|
- `Ticket::processMassiveActionsForOneItemtype()`
|
||||||
|
- `Ticket::showFormMassiveAction()`
|
||||||
|
- `Ticket::showMassiveActionsSubForm()`
|
||||||
|
- `NotificationTarget::getProfileJoinSql()`
|
||||||
|
- `NotificationTarget::getDistinctUserSql()`
|
||||||
|
- `NotificationTargetCommonITILObject::getProfileJoinSql()`
|
||||||
|
- `RuleCollection::getRuleListQuery()`
|
||||||
|
- `getNextItem()`
|
||||||
|
- `getPreviousItem()`
|
||||||
|
- `CommonDBChild::getSQLRequestToSearchForItem()`
|
||||||
|
- `CommonDBConnexity::getSQLRequestToSearchForItem()`
|
||||||
|
- `CommonDBRelation::getSQLRequestToSearchForItem()`
|
||||||
|
- `Project::addVisibility()`
|
||||||
|
- `Project::addVisibilityJoins()`
|
||||||
|
|
||||||
|
#### Removed
|
||||||
|
|
||||||
|
- Drop ability to use `JOIN` in `DBmysqlIterator::buildQuery()`
|
||||||
|
- Drop `NotificationTarget::datas` property
|
||||||
|
- Drop support of string `$filter` parameter in `Profileuser::getUserProfiles()`
|
||||||
|
- Drop support of string `$condition` parameter in `User::getFromDBbyEmail()`
|
||||||
|
- Drop support of string `$condition` parameter in `Group_User::getUserGroups()`
|
||||||
|
- Drop support of string `$condition` parameter in `Group_User::getGroupUsers()`
|
||||||
|
- Drop support of string `$condition` parameter in `countElementsInTable` (`DbUtils::countElementsInTable()`)
|
||||||
|
- Drop support of string `$condition` parameter in `countDistinctElementsInTable` (`DbUtils::countDistinctElementsInTable()`)
|
||||||
|
- Drop support of string `$condition` parameter in `countElementsInTableForMyEntities` (`DbUtils::countElementsInTableForMyEntities()`)
|
||||||
|
- Drop support of string `$condition` parameter in `countElementsInTableForEntity` (`DbUtils::countElementsInTableForEntity()`)
|
||||||
|
- Drop support of string `$condition` parameter in `getAllDatasFromTable` (`DbUtils::getAllDataFromTable()`)
|
||||||
|
- Drop ITIL Tasks, Followups and Solutions `showSummary()` and massive actions related methods that are replaced with timeline
|
||||||
|
|
||||||
|
- Drop class alias `Event` for `Glpi\Event`
|
||||||
|
- Drop `Zend\Loader\SplAutoloader` interface
|
||||||
|
- Drop all methods that have been deprecated in GLPI 9.2
|
||||||
|
- `_e()`
|
||||||
|
- `_ex()`
|
||||||
|
- `FieldExists()`
|
||||||
|
- `formatOutputWebLink()`
|
||||||
|
- `TableExists()`
|
||||||
|
- `CommonTreeDropodwn::recursiveCleanSonsAboveID()`
|
||||||
|
- `DBMysql::optimize_tables()`
|
||||||
|
- `NotificationTarget::addToAddressesList()`
|
||||||
|
- `NotificationTarget::getAdditionalTargets()`
|
||||||
|
- `NotificationTarget::getAddressesByGroup()`
|
||||||
|
- `NotificationTarget::getAddressesByTarget()`
|
||||||
|
- `NotificationTarget::getAdminAddress()`
|
||||||
|
- `NotificationTarget::getEntityAdminAddress()`
|
||||||
|
- `NotificationTarget::getItemAuthorAddress()`
|
||||||
|
- `NotificationTarget::getItemGroupAddress()`
|
||||||
|
- `NotificationTarget::getItemGroupSupervisorAddress()`
|
||||||
|
- `NotificationTarget::getItemGroupTechInChargeAddress()`
|
||||||
|
- `NotificationTarget::getItemGroupWithoutSupervisorAddress()`
|
||||||
|
- `NotificationTarget::getItemOwnerAddress()`
|
||||||
|
- `NotificationTarget::getItemTechnicianInChargeAddress()`
|
||||||
|
- `NotificationTarget::getNotificationTargets()`
|
||||||
|
- `NotificationTarget::getSpecificTargets()`
|
||||||
|
- `NotificationTarget::getUserByField()`
|
||||||
|
- `NotificationTarget::getUsersAddressesByProfile()`
|
||||||
|
- `NotificationTargetCommonITILObject::getDatasForObject()`
|
||||||
|
- `NotificationTargetCommonITILObject::getFollowupAuthor()`
|
||||||
|
- `NotificationTargetCommonITILObject::getLinkedGroupByType()`
|
||||||
|
- `NotificationTargetCommonITILObject::getLinkedGroupSupervisorByType()`
|
||||||
|
- `NotificationTargetCommonITILObject::getLinkedGroupWithoutSupervisorByType()`
|
||||||
|
- `NotificationTargetCommonITILObject::getLinkedUserByType()`
|
||||||
|
- `NotificationTargetCommonITILObject::getOldAssignTechnicianAddress()`
|
||||||
|
- `NotificationTargetCommonITILObject::getRecipientAddress()`
|
||||||
|
- `NotificationTargetCommonITILObject::getSupplierAddress()`
|
||||||
|
- `NotificationTargetCommonITILObject::getTaskAssignGroup()`
|
||||||
|
- `NotificationTargetCommonITILObject::getTaskAssignUser()`
|
||||||
|
- `NotificationTargetCommonITILObject::getTaskAuthor()`
|
||||||
|
- `NotificationTargetCommonITILObject::getValidationApproverAddress()`
|
||||||
|
- `NotificationTargetCommonITILObject::getValidationRequesterAddress()`
|
||||||
|
- `NotificationTargetProjectTask::getTeamContacts()`
|
||||||
|
- `NotificationTargetProjectTask::getTeamGroups()`
|
||||||
|
- `NotificationTargetProjectTask::getTeamSuppliers()`
|
||||||
|
- `NotificationTargetProjectTask::getTeamUsers()`
|
||||||
|
- `QueuedNotification::sendMailById()`
|
||||||
|
- `Ticket::convertContentForNotification()`
|
||||||
|
- `User::getPersonalToken()`
|
||||||
|
- `User::getUniquePersonalToken()`
|
||||||
|
- Drop all methods that have been deprecated in GLPI 9.3.0
|
||||||
|
- `CommonDBTM::getFromDBByQuery()`
|
||||||
|
- `CommonDBTM::getSearchOptions()`
|
||||||
|
- `CommonDBTM::getSearchOptionsNew()`
|
||||||
|
- `CommonDBTM::getSearchOptionsToAddNew()`
|
||||||
|
- `CommonITILObject::getStatusIconURL()`
|
||||||
|
- `DBMysql::list_tables()`
|
||||||
|
- `Dropdown::showPrivatePublicSwitch()`
|
||||||
|
- `NotificationTargetProjectTask::getTeamContacts()`
|
||||||
|
- `NotificationTargetProjectTask::getTeamGroups()`
|
||||||
|
- `NotificationTargetProjectTask::getTeamSuppliers()`
|
||||||
|
- `NotificationTargetProjectTask::getTeamUsers()`
|
||||||
|
- `Search::constructDatas()`
|
||||||
|
- `Search::displayDatas()`
|
||||||
|
- `Transfer::transferComputerDisks()`
|
||||||
|
- Drop all methods that have been deprecated in GLPI 9.3.1
|
||||||
|
- `ComputerVirtualMachine::getUUIDRestrictRequest()`
|
||||||
|
- `Config::getSQLMode()`
|
||||||
|
- `DBMysql::checkForCrashedTables()`
|
||||||
|
- `Html::checkAllAsCheckbox()`
|
||||||
|
- `Html::scriptEnd()`
|
||||||
|
- `Html::scriptStart()`
|
||||||
|
- `Plugin::isAllPluginsCSRFCompliant()`
|
||||||
|
- `Profile::getUnderActiveProfileRestrictRequest()`
|
||||||
|
- `Toolbox::is_a()`
|
||||||
|
- Drop all constants that have been deprecated in GLPI 9.3.1
|
||||||
|
- `CommonDBTM::ERROR_FIELDSIZE_EXCEEDED`
|
||||||
|
- `CommonDBTM::HAS_DUPLICATE`
|
||||||
|
- `CommonDBTM::NOTHING_TO_DO`
|
||||||
|
- `CommonDBTM::SUCCESS`
|
||||||
|
- `CommonDBTM::TYPE_MISMATCH`
|
||||||
|
- Drop all methods that have been deprecated in GLPI 9.3.2
|
||||||
|
- `ITILSolution::removeForItem()`
|
||||||
|
- `Session::isViewAllEntities()`
|
||||||
|
|
||||||
|
## [9.3.3] 2018-11-27
|
||||||
|
|
||||||
|
### Changed
|
||||||
|
|
||||||
|
- Fix some cache issues
|
||||||
|
- Fix reservation tab of an item
|
||||||
|
- Fix actors notifications massive action
|
||||||
|
- Improve racks plugins migration script
|
||||||
|
|
||||||
|
### API changes
|
||||||
|
|
||||||
|
No API changes.
|
||||||
|
|
||||||
|
## [9.3.2] 2018-10-26
|
||||||
|
|
||||||
|
### API changes
|
||||||
|
|
||||||
|
#### Changed
|
||||||
|
|
||||||
|
- `Rule::executePluginsActions()` signature has changed
|
||||||
|
- Javascript function `formatResult()` has been renamed to `templateResult()`
|
||||||
|
|
||||||
|
#### Deprecated
|
||||||
|
|
||||||
|
The following methods have been deprecated:
|
||||||
|
|
||||||
|
- `CommonITILTask::displayTabContentForItem()`
|
||||||
|
- `CommonITILTask::showFormMassiveAction()`
|
||||||
|
- `CommonITILTask::showSummary()`
|
||||||
|
- `ITILSolution::displayTabContentForItem()`
|
||||||
|
- `ITILSolution::removeForItem()`
|
||||||
|
- `ITILSolution::showSummary()`
|
||||||
|
- `Session::isViewAllEntities()`
|
||||||
|
- `TicketFollowup::processMassiveActionsForOneItemtype()`
|
||||||
|
- `TicketFollowup::showFormMassiveAction()`
|
||||||
|
- `TicketFollowup::showMassiveActionsSubForm()`
|
||||||
|
- `TicketFollowup::showSummary()`
|
||||||
|
- `Plugin::removeFromSession()`
|
||||||
|
|
||||||
|
## [9.3.1] 2018-09-12
|
||||||
|
|
||||||
|
### Added
|
||||||
|
- List receivers folders to choose imported/refused folders
|
||||||
|
|
||||||
|
### API changes
|
||||||
|
|
||||||
|
#### Deprecated
|
||||||
|
|
||||||
|
- Usage of string `$condition` parameter in `Group_User::getUserGroups()` has been deprecated
|
||||||
|
- Usage of string `$condition` parameter in `Group_User::getGroupUsers()` has been deprecated
|
||||||
|
- Usage of string `$condition` parameter in `countElementsInTable` (`DbUtils::countElementsInTable()`) has been deprecated
|
||||||
|
- Usage of string `$condition` parameter in `countDistinctElementsInTable` (`DbUtils::countDistinctElementsInTable()`) has been deprecated
|
||||||
|
- Usage of string `$condition` parameter in `countElementsInTableForMyEntities` (`DbUtils::countElementsInTableForMyEntities()`) has been deprecated
|
||||||
|
- Usage of string `$condition` parameter in `countElementsInTableForEntity` (`DbUtils::countElementsInTableForEntity()`) has been deprecated
|
||||||
|
- Usage of string `$condition` parameter in `getAllDatasFromTable` (`DbUtils::getAllDataFromTable()`) has been deprecated
|
||||||
|
|
||||||
|
The following methods have been deprecated:
|
||||||
|
|
||||||
|
- `Config::getSQLMode()`
|
||||||
|
- `DBMysql::checkForCrashedTables()`
|
||||||
|
- `Html::checkAllAsCheckbox()`
|
||||||
|
- `Html::scriptEnd()`
|
||||||
|
- `Html::scriptStart()`
|
||||||
|
- `Toolbox::is_a()`
|
||||||
|
- `ComputerVirtualMachine::getUUIDRestrictRequest()`
|
||||||
|
- `Plugin::isAllPluginsCSRFCompliant()`
|
||||||
|
- `Profile::getUnderActiveProfileRestrictRequest()`
|
||||||
|
|
||||||
|
The following constants have been deprecated:
|
||||||
|
- `CommonDBTM::ERROR_FIELDSIZE_EXCEEDED`
|
||||||
|
- `CommonDBTM::HAS_DUPLICATE`
|
||||||
|
- `CommonDBTM::NOTHING_TO_DO`
|
||||||
|
- `CommonDBTM::SUCCESS`
|
||||||
|
- `CommonDBTM::TYPE_MISMATCH`
|
||||||
|
|
||||||
|
## [9.3.0] 2018-06-28
|
||||||
|
|
||||||
|
### Added
|
||||||
|
- Add DCIM management
|
||||||
|
- Add OSM view to set locations and on Search
|
||||||
|
- Add login source selection
|
||||||
|
- Add logs purge
|
||||||
|
- Filter in items logs
|
||||||
|
|
||||||
|
### Changed
|
||||||
|
- Switch MySQL engine from MyIsam to Innodb
|
||||||
|
- Rework solutions for Tickets, Problems and Changes to support history
|
||||||
|
- Disks can be attached to network equipments and printers
|
||||||
|
|
||||||
|
### API changes
|
||||||
|
|
||||||
|
#### Changes
|
||||||
|
- Added `DB::insert()`, `DB::update()` and `DB::delete()` to replace raw SQL queries
|
||||||
|
- `CommonITILObject::showMassiveSolutionForm()` now takes a `CommonITILObject` as argument
|
||||||
|
- `Profileuser::getUserProfiles()` `$filter` parameter is now an array
|
||||||
|
- `User::getFromDBbyEmail()` `$condition` parameter is now an array
|
||||||
|
- Select2 javascript component has been upgraded to 4.0 version, see [Migrating from Select2 3.5](https://select2.org/upgrading/migrating-from-35)
|
||||||
|
- `CommonDevice::getItem_DeviceType()` has a new optional `$devicetype` parameter
|
||||||
|
|
||||||
|
#### Deprecated
|
||||||
|
|
||||||
|
- Usage of string `$filter` parameter in `Profileuser::getUserProfiles()` has been deprecated
|
||||||
|
- Usage of string `$condition` parameter in `User::getFromDBbyEmail()` has been deprecated
|
||||||
|
|
||||||
|
The following methods have been deprecated:
|
||||||
|
|
||||||
|
- `CommonDBTM::getFromDBByQuery()`
|
||||||
|
- `CommonDBTM::getSearchOptions()`
|
||||||
|
- `CommonDBTM::getSearchOptionsNew()`
|
||||||
|
- `CommonDBTM::getSearchOptionsToAddNew()`
|
||||||
|
- `CommonITILObject::getStatusIconURL()`
|
||||||
|
- `DBMysql::list_tables()`
|
||||||
|
- `Dropdown::showPrivatePublicSwitch()`
|
||||||
|
- `NotificationTargetProject::getTeamContacts()`
|
||||||
|
- `NotificationTargetProject::getTeamGroups()`
|
||||||
|
- `NotificationTargetProject::getTeamSuppliers()`
|
||||||
|
- `NotificationTargetProject::getTeamUsers()`
|
||||||
|
- `Search::constructDatas()`
|
||||||
|
- `Search::displayDatas()`
|
||||||
|
- `Transfer::transferComputerDisks()`
|
||||||
|
|
||||||
|
#### Removed
|
||||||
|
|
||||||
|
- `CommonITILValidation::isAllValidationsHaveSameStatusForTicket`
|
||||||
|
- `CommonITILValidation::getNumberValidationForTicket`
|
||||||
|
- PHPCas library is no longer provided (for licensing issues)
|
||||||
|
|
||||||
|
## [9.2.4] 2018-06-21
|
||||||
|
|
||||||
|
## [9.2.3] 2018-04-27
|
||||||
|
|
||||||
|
## [9.2.2] 2018-03-01
|
||||||
|
|
||||||
|
|
||||||
|
### Deprecated
|
||||||
|
|
||||||
|
- `CommonITILValidation::isAllValidationsHaveSameStatusForTicket`
|
||||||
|
- `CommonITILValidation::getNumberValidationForTicket`
|
||||||
|
- `DBMysql::optimize_tables()`
|
||||||
|
|
||||||
|
## [9.2.1] 2017-11-16
|
||||||
|
|
||||||
|
### Added
|
||||||
|
|
||||||
|
- Search engine, added ``itemtype_item_revert`` jointype
|
||||||
|
|
||||||
|
### Deprecated
|
||||||
|
|
||||||
|
- `Ticket::convertContentForNotification()`
|
||||||
|
|
||||||
|
## [9.2] 2017-09-25
|
||||||
|
|
||||||
|
### Added
|
||||||
|
- Link knowledge base entries with assets or tickets
|
||||||
|
- Revisions on knowledge base entries and their translations, with diff view
|
||||||
|
- Add recursive comments on knowledge base entries
|
||||||
|
- Direct links to KB article's title for a direct access
|
||||||
|
- Load minified CSS and JS files (core and plugins) that are generated on release
|
||||||
|
- Link beetween software licenses
|
||||||
|
- Alerts on saved searches
|
||||||
|
- Add ajax browsers notifications in addition to emails
|
||||||
|
- Plugins can now add new notifications types (xmpp, sms, telegram, ...) to be used along with standard notifications
|
||||||
|
- Simcard component
|
||||||
|
- Synchronization field for LDAP
|
||||||
|
- Improved performances on large entities databases
|
||||||
|
- Remember me on login
|
||||||
|
- Fuzzy search
|
||||||
|
- Paste images in rich text editor
|
||||||
|
- Add tasks in tickets templates
|
||||||
|
- Composite tickets (link on sons/parents)
|
||||||
|
- Telemetry
|
||||||
|
- Certificates component
|
||||||
|
- Firmwares components (BIOSes, firwmwares, ...)
|
||||||
|
- Add OLA management
|
||||||
|
|
||||||
|
### Changed
|
||||||
|
- Many bugs have been fixed
|
||||||
|
- Display knowledge base category items in tickets using a popup instead of a
|
||||||
|
new whole window
|
||||||
|
- Reviewed all richtext editor (tinymce) and their upload parts, now more simpler and intuitive
|
||||||
|
- Don't ask user to select a template if there is no configured template
|
||||||
|
- personal_token is not used anymore for api authentication, a new api_token field has been added (empty by default, you should regenerate it)
|
||||||
|
- Operating systems management has been improved
|
||||||
|
- Direct language change from any page
|
||||||
|
- Better icons harmonization
|
||||||
|
|
||||||
|
### API changes
|
||||||
|
|
||||||
|
#### Changes
|
||||||
|
|
||||||
|
- `CommonDBTM::getTable()` signature has changed
|
||||||
|
- `User::getFromDBbyToken()` signature has changed
|
||||||
|
- `Bookmark` has been renamed to `SavedSearch`
|
||||||
|
- Update to latest jsTree plugin
|
||||||
|
- `RuleDictionnarySoftwareCollection::versionExists()` signature has changed
|
||||||
|
- `NotificationTemplate::getDataToSend()` signature has changed
|
||||||
|
- `QueuedMail` has been renamed to `QueuedNotification`
|
||||||
|
- `CommonDBTM::mailqueueonaction()` has been renamed to `CommonDBTM::notificationqueueonaction()`
|
||||||
|
- `NotificationTarget::getSender()` no longer takes any parameters (was not used)
|
||||||
|
- `TableExists()` has been moved to `DBMysql::tableExists()`
|
||||||
|
- `FieldExists()` has been moved to `DBMysql::fieldExists()`
|
||||||
|
- `Profile_User::getUserEntitiesForRight()` signature has changed
|
||||||
|
- `NotificationTarget` property `datas` has been renamed to `data`
|
||||||
|
|
||||||
|
#### Deprecated
|
||||||
|
|
||||||
|
- Ability to use `JOIN` in `DBmysqlIterator::buildQuery()` has been deprecated
|
||||||
|
- Usage of `NotificationTarget::datas` property has been deprecated
|
||||||
|
- Usage of `Zend\Loader\SplAutoloader` interface has been deprecated
|
||||||
|
|
||||||
|
The following methods have been deprecated:
|
||||||
|
|
||||||
|
- `_e()`
|
||||||
|
- `_ex()`
|
||||||
|
- `Bookmark::mark_default()`
|
||||||
|
- `Bookmark::unmark_default()`
|
||||||
|
- `CommonTreeDropodwn::recursiveCleanSonsAboveID()`
|
||||||
|
- `NotificationTarget::addToAddressesList()`
|
||||||
|
- `NotificationTarget::getAdditionalTargets()`
|
||||||
|
- `NotificationTarget::getAddressesByGroup()`
|
||||||
|
- `NotificationTarget::getAddressesByTarget()`
|
||||||
|
- `NotificationTarget::getAdminAddress()`
|
||||||
|
- `NotificationTarget::getEntityAdminAddress()`
|
||||||
|
- `NotificationTarget::getItemAuthorAddress()`
|
||||||
|
- `NotificationTarget::getItemGroupAddress()`
|
||||||
|
- `NotificationTarget::getItemGroupSupervisorAddress()`
|
||||||
|
- `NotificationTarget::getItemGroupTechInChargeAddress()`
|
||||||
|
- `NotificationTarget::getItemGroupWithoutSupervisorAddress()`
|
||||||
|
- `NotificationTarget::getItemOwnerAddress()`
|
||||||
|
- `NotificationTarget::getItemTechnicianInChargeAddress()`
|
||||||
|
- `NotificationTarget::getNotificationTargets()`
|
||||||
|
- `NotificationTarget::getSpecificTargets()`
|
||||||
|
- `NotificationTarget::getUserByField()`
|
||||||
|
- `NotificationTarget::getUsersAddressesByProfile()`
|
||||||
|
- `NotificationTargetCommonITILObject::getDatasForObject()`
|
||||||
|
- `NotificationTargetCommonITILObject::getFollowupAuthor()`
|
||||||
|
- `NotificationTargetCommonITILObject::getLinkedGroupByType()`
|
||||||
|
- `NotificationTargetCommonITILObject::getLinkedGroupSupervisorByType()`
|
||||||
|
- `NotificationTargetCommonITILObject::getLinkedGroupWithoutSupervisorByType()`
|
||||||
|
- `NotificationTargetCommonITILObject::getLinkedUserByType()`
|
||||||
|
- `NotificationTargetCommonITILObject::getOldAssignTechnicianAddress()`
|
||||||
|
- `NotificationTargetCommonITILObject::getRecipientAddress()`
|
||||||
|
- `NotificationTargetCommonITILObject::getSupplierAddress()`
|
||||||
|
- `NotificationTargetCommonITILObject::getTaskAssignGroup()`
|
||||||
|
- `NotificationTargetCommonITILObject::getTaskAssignUser()`
|
||||||
|
- `NotificationTargetCommonITILObject::getTaskAuthor()`
|
||||||
|
- `NotificationTargetCommonITILObject::getValidationApproverAddress()`
|
||||||
|
- `NotificationTargetCommonITILObject::getValidationRequesterAddress()`
|
||||||
|
- `NotificationTargetProjectTask::getTeamContacts()`
|
||||||
|
- `NotificationTargetProjectTask::getTeamGroups()`
|
||||||
|
- `NotificationTargetProjectTask::getTeamSuppliers()`
|
||||||
|
- `NotificationTargetProjectTask::getTeamUsers()`
|
||||||
|
- `QueuedNotification::sendMailById()`
|
||||||
|
- `User::getPersonalToken()`
|
||||||
|
- `User::getUniquePersonalToken()`
|
||||||
|
- `formatOutputWebLink()`
|
||||||
|
|
||||||
|
#### Removals
|
||||||
|
|
||||||
|
The following methods have been dropped:
|
||||||
|
|
||||||
|
- `Ajax::displaySearchTextForDropdown()`
|
||||||
|
- `Ajax::getSearchTextForDropdown()`
|
||||||
|
- `Bookmark::changeBookmarkOrder()`
|
||||||
|
- `Bookmark::moveBookmark()`
|
||||||
|
- `CommonGLPI::addDivForTabs()`
|
||||||
|
- `CommonGLPI::showTabs()`
|
||||||
|
- `CommonGLPI::showNavigationHeaderOld()`
|
||||||
|
- `CommonGLPI::show()`
|
||||||
|
- `Dropdown::showInteger()`
|
||||||
|
- `DBMysql::field_flags()`
|
||||||
|
- `Html::showDateFormItem()`
|
||||||
|
- `Html::showDateTimeFormItem()`
|
||||||
|
- `Profile::dropdownNoneReadWrite()`
|
||||||
|
- `Toolbox::get_magic_quotes_runtime()`
|
||||||
|
- `Toolbox::get_magic_quotes_gpc()`
|
||||||
|
- `Dropdown::showAllItems()`
|
||||||
|
|
||||||
|
For older entries, please check [GLPI website](http://glpi-project.org).
|
||||||
35
CONTRIBUTING.md
Normal file
35
CONTRIBUTING.md
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
# Contributing to GLPI
|
||||||
|
|
||||||
|
:+1::tada: First off, thanks for taking the time to contribute! :tada::+1:
|
||||||
|
|
||||||
|
Please note that current repository is about GLPI core only. All related plugins are the responsibility of their respective owners and all requests must be done on their own systems.
|
||||||
|
|
||||||
|
**Please write only in english!**
|
||||||
|
|
||||||
|
## Bugs
|
||||||
|
|
||||||
|
Note that issues are handled on a best-effort basis. If you need a quick fix or any guarantee, take a look at **[profesionnal services](http://services.glpi-network.com/)** or [partners](https://glpi-project.org/partners/).
|
||||||
|
|
||||||
|
If you found a bug, the first steps to do are:
|
||||||
|
- check if you're using the latest version, and if not, upgrade to see if problem is not yet solved,
|
||||||
|
- search in already existing tickets to see if someone else already report the issue.
|
||||||
|
|
||||||
|
If the last release does not solve the issue and there is no existing ticket, create one using the bug report template. Be sure you provide all requested details, log entries, and whatever may be usefull to understand and reproduce the issue.
|
||||||
|
|
||||||
|
If developpers are not able to reproduce the issue, it may not be fixed.
|
||||||
|
|
||||||
|
## Features
|
||||||
|
|
||||||
|
If you want to work on a new feature, open a ticket using the feature template, so we can discuss on it.
|
||||||
|
|
||||||
|
If you're just asking for something to be added without doing it yourself, please consider adding (or upvoting) an enhancement on the [suggestion website](https//suggest.glpi-project.org).
|
||||||
|
|
||||||
|
## Support request
|
||||||
|
|
||||||
|
You have a question on GLPI usage, or want to know what are the capabilities.
|
||||||
|
|
||||||
|
Current repository is not the right place for that. You may try to aks your question on [the forums](https://forum.glpi-project.org), on the mailing lists, on telegram channels, ...
|
||||||
|
|
||||||
|
## Coding
|
||||||
|
|
||||||
|
If you want to contribute to the project code, please take a time to read the [project coding guidelines](https://glpi-developer-documentation.readthedocs.io).
|
||||||
339
COPYING.txt
Normal file
339
COPYING.txt
Normal file
@ -0,0 +1,339 @@
|
|||||||
|
GNU GENERAL PUBLIC LICENSE
|
||||||
|
Version 2, June 1991
|
||||||
|
|
||||||
|
Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
|
||||||
|
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
Everyone is permitted to copy and distribute verbatim copies
|
||||||
|
of this license document, but changing it is not allowed.
|
||||||
|
|
||||||
|
Preamble
|
||||||
|
|
||||||
|
The licenses for most software are designed to take away your
|
||||||
|
freedom to share and change it. By contrast, the GNU General Public
|
||||||
|
License is intended to guarantee your freedom to share and change free
|
||||||
|
software--to make sure the software is free for all its users. This
|
||||||
|
General Public License applies to most of the Free Software
|
||||||
|
Foundation's software and to any other program whose authors commit to
|
||||||
|
using it. (Some other Free Software Foundation software is covered by
|
||||||
|
the GNU Lesser General Public License instead.) You can apply it to
|
||||||
|
your programs, too.
|
||||||
|
|
||||||
|
When we speak of free software, we are referring to freedom, not
|
||||||
|
price. Our General Public Licenses are designed to make sure that you
|
||||||
|
have the freedom to distribute copies of free software (and charge for
|
||||||
|
this service if you wish), that you receive source code or can get it
|
||||||
|
if you want it, that you can change the software or use pieces of it
|
||||||
|
in new free programs; and that you know you can do these things.
|
||||||
|
|
||||||
|
To protect your rights, we need to make restrictions that forbid
|
||||||
|
anyone to deny you these rights or to ask you to surrender the rights.
|
||||||
|
These restrictions translate to certain responsibilities for you if you
|
||||||
|
distribute copies of the software, or if you modify it.
|
||||||
|
|
||||||
|
For example, if you distribute copies of such a program, whether
|
||||||
|
gratis or for a fee, you must give the recipients all the rights that
|
||||||
|
you have. You must make sure that they, too, receive or can get the
|
||||||
|
source code. And you must show them these terms so they know their
|
||||||
|
rights.
|
||||||
|
|
||||||
|
We protect your rights with two steps: (1) copyright the software, and
|
||||||
|
(2) offer you this license which gives you legal permission to copy,
|
||||||
|
distribute and/or modify the software.
|
||||||
|
|
||||||
|
Also, for each author's protection and ours, we want to make certain
|
||||||
|
that everyone understands that there is no warranty for this free
|
||||||
|
software. If the software is modified by someone else and passed on, we
|
||||||
|
want its recipients to know that what they have is not the original, so
|
||||||
|
that any problems introduced by others will not reflect on the original
|
||||||
|
authors' reputations.
|
||||||
|
|
||||||
|
Finally, any free program is threatened constantly by software
|
||||||
|
patents. We wish to avoid the danger that redistributors of a free
|
||||||
|
program will individually obtain patent licenses, in effect making the
|
||||||
|
program proprietary. To prevent this, we have made it clear that any
|
||||||
|
patent must be licensed for everyone's free use or not licensed at all.
|
||||||
|
|
||||||
|
The precise terms and conditions for copying, distribution and
|
||||||
|
modification follow.
|
||||||
|
|
||||||
|
GNU GENERAL PUBLIC LICENSE
|
||||||
|
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||||
|
|
||||||
|
0. This License applies to any program or other work which contains
|
||||||
|
a notice placed by the copyright holder saying it may be distributed
|
||||||
|
under the terms of this General Public License. The "Program", below,
|
||||||
|
refers to any such program or work, and a "work based on the Program"
|
||||||
|
means either the Program or any derivative work under copyright law:
|
||||||
|
that is to say, a work containing the Program or a portion of it,
|
||||||
|
either verbatim or with modifications and/or translated into another
|
||||||
|
language. (Hereinafter, translation is included without limitation in
|
||||||
|
the term "modification".) Each licensee is addressed as "you".
|
||||||
|
|
||||||
|
Activities other than copying, distribution and modification are not
|
||||||
|
covered by this License; they are outside its scope. The act of
|
||||||
|
running the Program is not restricted, and the output from the Program
|
||||||
|
is covered only if its contents constitute a work based on the
|
||||||
|
Program (independent of having been made by running the Program).
|
||||||
|
Whether that is true depends on what the Program does.
|
||||||
|
|
||||||
|
1. You may copy and distribute verbatim copies of the Program's
|
||||||
|
source code as you receive it, in any medium, provided that you
|
||||||
|
conspicuously and appropriately publish on each copy an appropriate
|
||||||
|
copyright notice and disclaimer of warranty; keep intact all the
|
||||||
|
notices that refer to this License and to the absence of any warranty;
|
||||||
|
and give any other recipients of the Program a copy of this License
|
||||||
|
along with the Program.
|
||||||
|
|
||||||
|
You may charge a fee for the physical act of transferring a copy, and
|
||||||
|
you may at your option offer warranty protection in exchange for a fee.
|
||||||
|
|
||||||
|
2. You may modify your copy or copies of the Program or any portion
|
||||||
|
of it, thus forming a work based on the Program, and copy and
|
||||||
|
distribute such modifications or work under the terms of Section 1
|
||||||
|
above, provided that you also meet all of these conditions:
|
||||||
|
|
||||||
|
a) You must cause the modified files to carry prominent notices
|
||||||
|
stating that you changed the files and the date of any change.
|
||||||
|
|
||||||
|
b) You must cause any work that you distribute or publish, that in
|
||||||
|
whole or in part contains or is derived from the Program or any
|
||||||
|
part thereof, to be licensed as a whole at no charge to all third
|
||||||
|
parties under the terms of this License.
|
||||||
|
|
||||||
|
c) If the modified program normally reads commands interactively
|
||||||
|
when run, you must cause it, when started running for such
|
||||||
|
interactive use in the most ordinary way, to print or display an
|
||||||
|
announcement including an appropriate copyright notice and a
|
||||||
|
notice that there is no warranty (or else, saying that you provide
|
||||||
|
a warranty) and that users may redistribute the program under
|
||||||
|
these conditions, and telling the user how to view a copy of this
|
||||||
|
License. (Exception: if the Program itself is interactive but
|
||||||
|
does not normally print such an announcement, your work based on
|
||||||
|
the Program is not required to print an announcement.)
|
||||||
|
|
||||||
|
These requirements apply to the modified work as a whole. If
|
||||||
|
identifiable sections of that work are not derived from the Program,
|
||||||
|
and can be reasonably considered independent and separate works in
|
||||||
|
themselves, then this License, and its terms, do not apply to those
|
||||||
|
sections when you distribute them as separate works. But when you
|
||||||
|
distribute the same sections as part of a whole which is a work based
|
||||||
|
on the Program, the distribution of the whole must be on the terms of
|
||||||
|
this License, whose permissions for other licensees extend to the
|
||||||
|
entire whole, and thus to each and every part regardless of who wrote it.
|
||||||
|
|
||||||
|
Thus, it is not the intent of this section to claim rights or contest
|
||||||
|
your rights to work written entirely by you; rather, the intent is to
|
||||||
|
exercise the right to control the distribution of derivative or
|
||||||
|
collective works based on the Program.
|
||||||
|
|
||||||
|
In addition, mere aggregation of another work not based on the Program
|
||||||
|
with the Program (or with a work based on the Program) on a volume of
|
||||||
|
a storage or distribution medium does not bring the other work under
|
||||||
|
the scope of this License.
|
||||||
|
|
||||||
|
3. You may copy and distribute the Program (or a work based on it,
|
||||||
|
under Section 2) in object code or executable form under the terms of
|
||||||
|
Sections 1 and 2 above provided that you also do one of the following:
|
||||||
|
|
||||||
|
a) Accompany it with the complete corresponding machine-readable
|
||||||
|
source code, which must be distributed under the terms of Sections
|
||||||
|
1 and 2 above on a medium customarily used for software interchange; or,
|
||||||
|
|
||||||
|
b) Accompany it with a written offer, valid for at least three
|
||||||
|
years, to give any third party, for a charge no more than your
|
||||||
|
cost of physically performing source distribution, a complete
|
||||||
|
machine-readable copy of the corresponding source code, to be
|
||||||
|
distributed under the terms of Sections 1 and 2 above on a medium
|
||||||
|
customarily used for software interchange; or,
|
||||||
|
|
||||||
|
c) Accompany it with the information you received as to the offer
|
||||||
|
to distribute corresponding source code. (This alternative is
|
||||||
|
allowed only for noncommercial distribution and only if you
|
||||||
|
received the program in object code or executable form with such
|
||||||
|
an offer, in accord with Subsection b above.)
|
||||||
|
|
||||||
|
The source code for a work means the preferred form of the work for
|
||||||
|
making modifications to it. For an executable work, complete source
|
||||||
|
code means all the source code for all modules it contains, plus any
|
||||||
|
associated interface definition files, plus the scripts used to
|
||||||
|
control compilation and installation of the executable. However, as a
|
||||||
|
special exception, the source code distributed need not include
|
||||||
|
anything that is normally distributed (in either source or binary
|
||||||
|
form) with the major components (compiler, kernel, and so on) of the
|
||||||
|
operating system on which the executable runs, unless that component
|
||||||
|
itself accompanies the executable.
|
||||||
|
|
||||||
|
If distribution of executable or object code is made by offering
|
||||||
|
access to copy from a designated place, then offering equivalent
|
||||||
|
access to copy the source code from the same place counts as
|
||||||
|
distribution of the source code, even though third parties are not
|
||||||
|
compelled to copy the source along with the object code.
|
||||||
|
|
||||||
|
4. You may not copy, modify, sublicense, or distribute the Program
|
||||||
|
except as expressly provided under this License. Any attempt
|
||||||
|
otherwise to copy, modify, sublicense or distribute the Program is
|
||||||
|
void, and will automatically terminate your rights under this License.
|
||||||
|
However, parties who have received copies, or rights, from you under
|
||||||
|
this License will not have their licenses terminated so long as such
|
||||||
|
parties remain in full compliance.
|
||||||
|
|
||||||
|
5. You are not required to accept this License, since you have not
|
||||||
|
signed it. However, nothing else grants you permission to modify or
|
||||||
|
distribute the Program or its derivative works. These actions are
|
||||||
|
prohibited by law if you do not accept this License. Therefore, by
|
||||||
|
modifying or distributing the Program (or any work based on the
|
||||||
|
Program), you indicate your acceptance of this License to do so, and
|
||||||
|
all its terms and conditions for copying, distributing or modifying
|
||||||
|
the Program or works based on it.
|
||||||
|
|
||||||
|
6. Each time you redistribute the Program (or any work based on the
|
||||||
|
Program), the recipient automatically receives a license from the
|
||||||
|
original licensor to copy, distribute or modify the Program subject to
|
||||||
|
these terms and conditions. You may not impose any further
|
||||||
|
restrictions on the recipients' exercise of the rights granted herein.
|
||||||
|
You are not responsible for enforcing compliance by third parties to
|
||||||
|
this License.
|
||||||
|
|
||||||
|
7. If, as a consequence of a court judgment or allegation of patent
|
||||||
|
infringement or for any other reason (not limited to patent issues),
|
||||||
|
conditions are imposed on you (whether by court order, agreement or
|
||||||
|
otherwise) that contradict the conditions of this License, they do not
|
||||||
|
excuse you from the conditions of this License. If you cannot
|
||||||
|
distribute so as to satisfy simultaneously your obligations under this
|
||||||
|
License and any other pertinent obligations, then as a consequence you
|
||||||
|
may not distribute the Program at all. For example, if a patent
|
||||||
|
license would not permit royalty-free redistribution of the Program by
|
||||||
|
all those who receive copies directly or indirectly through you, then
|
||||||
|
the only way you could satisfy both it and this License would be to
|
||||||
|
refrain entirely from distribution of the Program.
|
||||||
|
|
||||||
|
If any portion of this section is held invalid or unenforceable under
|
||||||
|
any particular circumstance, the balance of the section is intended to
|
||||||
|
apply and the section as a whole is intended to apply in other
|
||||||
|
circumstances.
|
||||||
|
|
||||||
|
It is not the purpose of this section to induce you to infringe any
|
||||||
|
patents or other property right claims or to contest validity of any
|
||||||
|
such claims; this section has the sole purpose of protecting the
|
||||||
|
integrity of the free software distribution system, which is
|
||||||
|
implemented by public license practices. Many people have made
|
||||||
|
generous contributions to the wide range of software distributed
|
||||||
|
through that system in reliance on consistent application of that
|
||||||
|
system; it is up to the author/donor to decide if he or she is willing
|
||||||
|
to distribute software through any other system and a licensee cannot
|
||||||
|
impose that choice.
|
||||||
|
|
||||||
|
This section is intended to make thoroughly clear what is believed to
|
||||||
|
be a consequence of the rest of this License.
|
||||||
|
|
||||||
|
8. If the distribution and/or use of the Program is restricted in
|
||||||
|
certain countries either by patents or by copyrighted interfaces, the
|
||||||
|
original copyright holder who places the Program under this License
|
||||||
|
may add an explicit geographical distribution limitation excluding
|
||||||
|
those countries, so that distribution is permitted only in or among
|
||||||
|
countries not thus excluded. In such case, this License incorporates
|
||||||
|
the limitation as if written in the body of this License.
|
||||||
|
|
||||||
|
9. The Free Software Foundation may publish revised and/or new versions
|
||||||
|
of the General Public License from time to time. Such new versions will
|
||||||
|
be similar in spirit to the present version, but may differ in detail to
|
||||||
|
address new problems or concerns.
|
||||||
|
|
||||||
|
Each version is given a distinguishing version number. If the Program
|
||||||
|
specifies a version number of this License which applies to it and "any
|
||||||
|
later version", you have the option of following the terms and conditions
|
||||||
|
either of that version or of any later version published by the Free
|
||||||
|
Software Foundation. If the Program does not specify a version number of
|
||||||
|
this License, you may choose any version ever published by the Free Software
|
||||||
|
Foundation.
|
||||||
|
|
||||||
|
10. If you wish to incorporate parts of the Program into other free
|
||||||
|
programs whose distribution conditions are different, write to the author
|
||||||
|
to ask for permission. For software which is copyrighted by the Free
|
||||||
|
Software Foundation, write to the Free Software Foundation; we sometimes
|
||||||
|
make exceptions for this. Our decision will be guided by the two goals
|
||||||
|
of preserving the free status of all derivatives of our free software and
|
||||||
|
of promoting the sharing and reuse of software generally.
|
||||||
|
|
||||||
|
NO WARRANTY
|
||||||
|
|
||||||
|
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
|
||||||
|
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
|
||||||
|
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
|
||||||
|
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
|
||||||
|
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||||
|
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
|
||||||
|
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
|
||||||
|
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
|
||||||
|
REPAIR OR CORRECTION.
|
||||||
|
|
||||||
|
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||||
|
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
|
||||||
|
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
|
||||||
|
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
|
||||||
|
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
|
||||||
|
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
|
||||||
|
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
|
||||||
|
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
|
||||||
|
POSSIBILITY OF SUCH DAMAGES.
|
||||||
|
|
||||||
|
END OF TERMS AND CONDITIONS
|
||||||
|
|
||||||
|
How to Apply These Terms to Your New Programs
|
||||||
|
|
||||||
|
If you develop a new program, and you want it to be of the greatest
|
||||||
|
possible use to the public, the best way to achieve this is to make it
|
||||||
|
free software which everyone can redistribute and change under these terms.
|
||||||
|
|
||||||
|
To do so, attach the following notices to the program. It is safest
|
||||||
|
to attach them to the start of each source file to most effectively
|
||||||
|
convey the exclusion of warranty; and each file should have at least
|
||||||
|
the "copyright" line and a pointer to where the full notice is found.
|
||||||
|
|
||||||
|
<one line to give the program's name and a brief idea of what it does.>
|
||||||
|
Copyright (C) <year> <name of author>
|
||||||
|
|
||||||
|
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 2 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, write to the Free Software Foundation, Inc.,
|
||||||
|
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
|
|
||||||
|
Also add information on how to contact you by electronic and paper mail.
|
||||||
|
|
||||||
|
If the program is interactive, make it output a short notice like this
|
||||||
|
when it starts in an interactive mode:
|
||||||
|
|
||||||
|
Gnomovision version 69, Copyright (C) year name of author
|
||||||
|
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||||
|
This is free software, and you are welcome to redistribute it
|
||||||
|
under certain conditions; type `show c' for details.
|
||||||
|
|
||||||
|
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||||
|
parts of the General Public License. Of course, the commands you use may
|
||||||
|
be called something other than `show w' and `show c'; they could even be
|
||||||
|
mouse-clicks or menu items--whatever suits your program.
|
||||||
|
|
||||||
|
You should also get your employer (if you work as a programmer) or your
|
||||||
|
school, if any, to sign a "copyright disclaimer" for the program, if
|
||||||
|
necessary. Here is a sample; alter the names:
|
||||||
|
|
||||||
|
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
|
||||||
|
`Gnomovision' (which makes passes at compilers) written by James Hacker.
|
||||||
|
|
||||||
|
<signature of Ty Coon>, 1 April 1989
|
||||||
|
Ty Coon, President of Vice
|
||||||
|
|
||||||
|
This General Public License does not permit incorporating your program into
|
||||||
|
proprietary programs. If your program is a subroutine library, you may
|
||||||
|
consider it more useful to permit linking proprietary applications with the
|
||||||
|
library. If this is what you want to do, use the GNU Lesser General
|
||||||
|
Public License instead of this License.
|
||||||
BIN
Charte Informatique.pdf
Normal file
BIN
Charte Informatique.pdf
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
15
INSTALL.md
Normal file
15
INSTALL.md
Normal file
@ -0,0 +1,15 @@
|
|||||||
|

|
||||||
|
|
||||||
|
## How to install?
|
||||||
|
|
||||||
|
Installation procedure is entirely automated; there is an [installation documentation](https://readthedocs.org/projects/glpi-install/) you should rely on.
|
||||||
|
|
||||||
|
When you are using the source code, there are extra steps, to get all third party libraries installed.
|
||||||
|
|
||||||
|
First, [download and install composer](https://getcomposer.org/), a PHP dependency management tool.
|
||||||
|
Second, [download and install npm](https://www.npmjs.com/), a JS dependency management tool.
|
||||||
|
Once done, go to the GLPI directory and just run:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ php bin/console dependencies install
|
||||||
|
```
|
||||||
116
README.md
Normal file
116
README.md
Normal file
@ -0,0 +1,116 @@
|
|||||||
|
## About GLPI
|
||||||
|
|
||||||
|
GLPI stands for **Gestionnaire Libre de Parc Informatique** is a Free Asset and IT Management Software package, that provides ITIL Service Desk features, licenses tracking and software auditing.
|
||||||
|
|
||||||
|
GLPI features:
|
||||||
|
* Inventory of computers, peripherals, network printers and any associated components through an interface, with inventory tools such as: [FusionInventory](http://fusioninventory.org/) or [OCS Inventory](https://www.ocsinventory-ng.org/)
|
||||||
|
* Data Center Infrastructure Management (DCIM)
|
||||||
|
* Item lifecycle management
|
||||||
|
* Licenses management (ITIL compliant)
|
||||||
|
* Management of warranty and financial information (purchase order, warranty and extension, damping)
|
||||||
|
* Management of contracts, contacts, documents related to inventory items
|
||||||
|
* Incidents, requests, problems and changes management
|
||||||
|
* Knowledge base and Frequently-Asked Questions (FAQ)
|
||||||
|
* Asset reservation
|
||||||
|
|
||||||
|
Moreover, GLPI supports many [plugins](http://plugins.glpi-project.org) that provide additional features.
|
||||||
|
|
||||||
|
## Demonstration
|
||||||
|
|
||||||
|
Check GLPI features by asking a free personnal demonstration on **[glpi-network.cloud](https://www.glpi-network.cloud)**
|
||||||
|
|
||||||
|
## License
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
It is distributed under the GNU GENERAL PUBLIC LICENSE Version 2 - please consult the file called [COPYING](https://raw.githubusercontent.com/glpi-project/glpi/master/COPYING.txt) for more details.
|
||||||
|
|
||||||
|
## Some screenshots
|
||||||
|
|
||||||
|
**Tickets Timeline**
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
**DCIM drag&drop**
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
**Components**
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
## Prerequisites
|
||||||
|
|
||||||
|
* A web server (Apache, Nginx, IIS, etc.)
|
||||||
|
* MariaDB >= 10.0 or MySQL >= 5.6
|
||||||
|
* PHP 7.2 or higher
|
||||||
|
* Mandatory PHP extensions:
|
||||||
|
- ctype
|
||||||
|
- curl
|
||||||
|
- gd (picture generation)
|
||||||
|
- iconv
|
||||||
|
- intl
|
||||||
|
- json
|
||||||
|
- mbstring
|
||||||
|
- mysqli
|
||||||
|
- session
|
||||||
|
- simplexml
|
||||||
|
- zlib
|
||||||
|
|
||||||
|
* Recommended PHP extensions (to enable optional features)
|
||||||
|
- exif (security enhancement on images validation)
|
||||||
|
- imap (mail collector and users authentication)
|
||||||
|
- ldap (users authentication)
|
||||||
|
- openssl (encrypted communication)
|
||||||
|
- sodium (performances enhancement on sensitive data encryption/decryption)
|
||||||
|
- zip and bz2 (installation of zip and bz2 packages from marketplace)
|
||||||
|
|
||||||
|
* Supported browsers:
|
||||||
|
- Edge
|
||||||
|
- Firefox (including 2 latests ESR version)
|
||||||
|
- Chrome
|
||||||
|
|
||||||
|
Please, consider using browsers on editor's supported version
|
||||||
|
|
||||||
|
|
||||||
|
## Download
|
||||||
|
|
||||||
|
See :
|
||||||
|
* [releases](https://github.com/glpi-project/glpi/releases) for tarball packages.
|
||||||
|
* [Remi's RPM repository](http://rpms.remirepo.net/) for RPM packages (Fedora, RHEL, CentOS)
|
||||||
|
|
||||||
|
|
||||||
|
## Documentation
|
||||||
|
|
||||||
|
Here is a [pdf version](https://forge.glpi-project.org/attachments/download/1901/glpidoc-0.85-en-partial.pdf).
|
||||||
|
We are working on a [markdown version](https://github.com/glpi-project/doc)
|
||||||
|
|
||||||
|
* [Installation](https://readthedocs.org/projects/glpi-install/)
|
||||||
|
* [Update](https://glpi-install.readthedocs.io/en/latest/update.html)
|
||||||
|
|
||||||
|
|
||||||
|
## Additional resources
|
||||||
|
|
||||||
|
* [Official website](http://glpi-project.org)
|
||||||
|
* [Demo](https://www.glpi-network.cloud)
|
||||||
|
* [Translations on transifex service](https://www.transifex.com/glpi/public/)
|
||||||
|
* [Issues](https://github.com/glpi-project/glpi/issues)
|
||||||
|
* [Suggestions](http://suggest.glpi-project.org)
|
||||||
|
* [Forum](http://forum.glpi-project.org)
|
||||||
|
* IRC : irc://irc.freenode.org/glpi
|
||||||
|
* [Development documentation](http://glpi-developer-documentation.readthedocs.io/en/master/)
|
||||||
|
* [Plugin directory](http://plugins.glpi-project.org)
|
||||||
|
* [Plugin development documentation](http://glpi-developer-documentation.readthedocs.io/en/master/plugins/index.html)
|
||||||
|
|
||||||
|
|
||||||
|
## Support
|
||||||
|
GLPI is a living software. Improvements are continuously made, new functionalities are being developed, and issues are being fixed.
|
||||||
|
|
||||||
|
To ease support and development, we need your help when encountering issues.
|
||||||
|
There is a GLPI version typical lifecycle:
|
||||||
|
* A new major version (9.3) is released.
|
||||||
|
* Minor versions (9.3.x), fixing bugs or issues, are published after several weeks.
|
||||||
|
Please consider updating to the latest realeased minor version if you encounter some bugs or performance issues.
|
||||||
|
* Several months after major version realesed, a new major version (9.4) is released
|
||||||
|
Previous major versions become unsupported, please update to the new major version.
|
||||||
|
Obviously, we provide support for the migration tools too!
|
||||||
26
SECURITY.md
Normal file
26
SECURITY.md
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
# Security Policy
|
||||||
|
|
||||||
|
## Supported Versions
|
||||||
|
|
||||||
|
| Version | Supported |
|
||||||
|
| ------- | ------------------ |
|
||||||
|
| 9.5.x | :heavy_check_mark: |
|
||||||
|
| 9.4.x | :x: |
|
||||||
|
| 9.3.x | :x: |
|
||||||
|
| 9.2.x | :x: |
|
||||||
|
| < 9.2 | :x: |
|
||||||
|
|
||||||
|
## Reporting a Vulnerability
|
||||||
|
|
||||||
|
If you found a security issue, please contact us using the following email:
|
||||||
|
glpi-security AT ow2.org
|
||||||
|
|
||||||
|
Please **never** use standard issues to report security problems;
|
||||||
|
vulnerabilities are published once a fix release is available.
|
||||||
|
|
||||||
|
You should provide us all details about the issue and the way to reproduce it.
|
||||||
|
You may also provide a script that can be used to check the issue exists.
|
||||||
|
|
||||||
|
Once the report will be handled, and if the issue is not yet fixed (or in progress)
|
||||||
|
we'll add it to the GitHub security tab, and add you as observer. Meanwhile,
|
||||||
|
you will reserve a CVE for the issue.
|
||||||
11
SUPPORT.md
Normal file
11
SUPPORT.md
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
# GLPI support
|
||||||
|
|
||||||
|
Looking for help on usage, capabilities or even configuration of your GLPI instance?
|
||||||
|
|
||||||
|
You can ask on:
|
||||||
|
- [GLPI forums](https://forum.glpi-project.org),
|
||||||
|
- [GLPI Telegram channel](https://t.me/glpien),
|
||||||
|
- [GLPI IRC channel](http://webchat.freenode.net/?channels=glpi) #glpi on Freenode,
|
||||||
|
- Subscribe to one of [GLPI mailing lists](https://glpi-project.org/community).
|
||||||
|
|
||||||
|
You may also be looking for [GLPI documentation](https://glpi-project.org/resources/#documentation).
|
||||||
209
ajax/accesmanagment.php
Normal file
209
ajax/accesmanagment.php
Normal file
@ -0,0 +1,209 @@
|
|||||||
|
<?php
|
||||||
|
if (!defined('GLPI_ROOT')) {
|
||||||
|
define('GLPI_ROOT', dirname(__DIR__));
|
||||||
|
}
|
||||||
|
|
||||||
|
include_once GLPI_ROOT . '/inc/based_config.php';
|
||||||
|
// Init Timer to compute time of display
|
||||||
|
$TIMER_DEBUG = new Timer();
|
||||||
|
$TIMER_DEBUG->start();
|
||||||
|
/// TODO try to remove them if possible
|
||||||
|
include_once (GLPI_ROOT . "/inc/db.function.php");
|
||||||
|
// Standard includes
|
||||||
|
include_once (GLPI_ROOT . "/inc/config.php");
|
||||||
|
//disbled errors =>pour le variable res (Ajax)
|
||||||
|
ini_set('display_errors', 0);
|
||||||
|
|
||||||
|
Session::checkLoginUser();
|
||||||
|
global $DB;
|
||||||
|
|
||||||
|
function get_Function($user_id){
|
||||||
|
|
||||||
|
global $DB;
|
||||||
|
|
||||||
|
$query = "SELECT value as fonction FROM `glpi_users`
|
||||||
|
LEFT JOIN picklist on glpi_users.id_fonction = picklist.id
|
||||||
|
WHERE glpi_users.id = ?";
|
||||||
|
$stmt = $DB->prepare($query);
|
||||||
|
|
||||||
|
$stmt->bind_param("i" , $user_id);
|
||||||
|
|
||||||
|
$stmt->execute();
|
||||||
|
$result = $stmt->get_result();
|
||||||
|
|
||||||
|
if ($result->num_rows > 0) {
|
||||||
|
|
||||||
|
while($row = $result->fetch_assoc()) {
|
||||||
|
$res[] = $row;
|
||||||
|
}
|
||||||
|
return $res[0]['fonction'];
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
function get_matricule($user_id){
|
||||||
|
|
||||||
|
global $DB;
|
||||||
|
|
||||||
|
$query = "SELECT registration_number AS mat FROM `glpi_users`
|
||||||
|
WHERE glpi_users.id = ?";
|
||||||
|
$stmt = $DB->prepare($query);
|
||||||
|
|
||||||
|
$stmt->bind_param("i" , $user_id);
|
||||||
|
|
||||||
|
$stmt->execute();
|
||||||
|
$result = $stmt->get_result();
|
||||||
|
|
||||||
|
if ($result->num_rows > 0) {
|
||||||
|
|
||||||
|
while($row = $result->fetch_assoc()) {
|
||||||
|
$res[] = $row;
|
||||||
|
}
|
||||||
|
return $res[0]['mat'];
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function get_structure($user_id){
|
||||||
|
|
||||||
|
global $DB;
|
||||||
|
|
||||||
|
$query = "SELECT value as structure FROM `glpi_users`
|
||||||
|
LEFT JOIN picklist on glpi_users.id_structure = picklist.id
|
||||||
|
WHERE glpi_users.id = ?";
|
||||||
|
$stmt = $DB->prepare($query);
|
||||||
|
|
||||||
|
$stmt->bind_param("i" , $user_id);
|
||||||
|
|
||||||
|
$stmt->execute();
|
||||||
|
$result = $stmt->get_result();
|
||||||
|
|
||||||
|
if ($result->num_rows > 0) {
|
||||||
|
|
||||||
|
while($row = $result->fetch_assoc()) {
|
||||||
|
$res[] = $row;
|
||||||
|
}
|
||||||
|
return $res[0]['structure'];
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
|
||||||
|
}
|
||||||
|
function get_username($user_id){
|
||||||
|
|
||||||
|
global $DB;
|
||||||
|
|
||||||
|
$query = "SELECT concat(`realname`,' ',`firstname`) AS fullname
|
||||||
|
FROM `glpi_users`
|
||||||
|
WHERE glpi_users.id = ?";
|
||||||
|
$stmt = $DB->prepare($query);
|
||||||
|
|
||||||
|
$stmt->bind_param("i" , $user_id);
|
||||||
|
|
||||||
|
$stmt->execute();
|
||||||
|
$result = $stmt->get_result();
|
||||||
|
|
||||||
|
if ($result->num_rows > 0) {
|
||||||
|
|
||||||
|
while($row = $result->fetch_assoc()) {
|
||||||
|
$res[] = $row;
|
||||||
|
}
|
||||||
|
return $res[0]['fullname'];
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
function get_Ordinateurs($user_id){
|
||||||
|
|
||||||
|
global $DB;
|
||||||
|
$res = array();
|
||||||
|
$query = "SELECT DISTINCT
|
||||||
|
glpi_computers.id AS Computer_id, glpi_manufacturers.name AS fabricant, glpi_computers.serial AS serial,
|
||||||
|
glpi_computertypes.name AS types, glpi_computermodels.name AS modele, glpi_users.id AS users_id,
|
||||||
|
glpi_computers.uuid , glpi_computers.comment AS comment , glpi_computers.serial as num_serie
|
||||||
|
FROM glpi_computers
|
||||||
|
LEFT JOIN glpi_states ON (glpi_computers.states_id = glpi_states.id )
|
||||||
|
LEFT JOIN glpi_manufacturers ON (glpi_computers.manufacturers_id = glpi_manufacturers.id )
|
||||||
|
LEFT JOIN glpi_computertypes ON (glpi_computers.computertypes_id = glpi_computertypes.id )
|
||||||
|
LEFT JOIN glpi_computermodels ON (glpi_computers.computermodels_id = glpi_computermodels.id )
|
||||||
|
LEFT JOIN glpi_items_operatingsystems ON (glpi_computers.id = glpi_items_operatingsystems.items_id AND glpi_items_operatingsystems.itemtype = 'Computer' )
|
||||||
|
LEFT JOIN glpi_operatingsystems AS glpi_operatingsystems_8 ON (glpi_items_operatingsystems.operatingsystems_id = glpi_operatingsystems_8.id )
|
||||||
|
LEFT JOIN glpi_locations ON (glpi_computers.locations_id = glpi_locations.id )
|
||||||
|
LEFT JOIN glpi_users ON (glpi_computers.users_id = glpi_users.id )
|
||||||
|
LEFT JOIN glpi_items_deviceprocessors ON (glpi_computers.id = glpi_items_deviceprocessors.items_id AND glpi_items_deviceprocessors.itemtype = 'Computer' )
|
||||||
|
LEFT JOIN glpi_deviceprocessors AS glpi_deviceprocessors_7 ON (glpi_items_deviceprocessors.deviceprocessors_id = glpi_deviceprocessors_7.id )
|
||||||
|
WHERE glpi_computers.is_deleted = 0 AND glpi_computers.is_template = 0 and glpi_users.id = ?
|
||||||
|
GROUP BY glpi_computers.id";
|
||||||
|
$stmt = $DB->prepare($query);
|
||||||
|
|
||||||
|
$stmt->bind_param("i" , $user_id);
|
||||||
|
|
||||||
|
$stmt->execute();
|
||||||
|
$result = $stmt->get_result();
|
||||||
|
|
||||||
|
if ($result->num_rows > 0) {
|
||||||
|
|
||||||
|
while($row = $result->fetch_assoc()) {
|
||||||
|
$Ordinateurs[] = $row;
|
||||||
|
}
|
||||||
|
|
||||||
|
for($i = 0 ; $i < count($Ordinateurs) ; $i++){
|
||||||
|
$data_all = array();
|
||||||
|
$temp = array();
|
||||||
|
$temp[0] = !empty($Ordinateurs[$i]['types']) ? $Ordinateurs[$i]['types'] : null;
|
||||||
|
$temp[0] = !empty($Ordinateurs[$i]['fabricant']) ? $temp[0].' '.$Ordinateurs[$i]['fabricant'] : $temp[0];
|
||||||
|
$temp[1] = !empty($Ordinateurs[$i]['modele']) ? 'Modèle : '.$Ordinateurs[$i]['modele'] : null;
|
||||||
|
$temp[2] = !empty($Ordinateurs[$i]['num_serie']) ? 'S/N : '.$Ordinateurs[$i]['num_serie'] : null;
|
||||||
|
$temp[3] = !empty($Ordinateurs[$i]['uuid']) ? 'Caracteristiques : '.$Ordinateurs[$i]['uuid'] : null;
|
||||||
|
|
||||||
|
for($k = 0 ; $k < count($temp) ; $k++) {
|
||||||
|
if($temp[$k] != null) array_push($data_all ,$temp[$k]);
|
||||||
|
}
|
||||||
|
|
||||||
|
array_push($res,implode(' - ',$data_all));
|
||||||
|
}
|
||||||
|
|
||||||
|
return $res;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $res;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(isset($_POST)){
|
||||||
|
|
||||||
|
switch ($_GET['action']) {
|
||||||
|
|
||||||
|
case "get_utilisateur_fonction":
|
||||||
|
$function = get_Function($_GET['userid']);
|
||||||
|
echo $function;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case "get_utilisateur_matricule":
|
||||||
|
$mat = get_matricule($_GET['userid']);
|
||||||
|
echo $mat;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case "get_utilisateur_structure":
|
||||||
|
$struct = get_structure($_GET['userid']);
|
||||||
|
echo $struct;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case "get_utilisateur_fullname":
|
||||||
|
$name = get_username($_GET['userid']);
|
||||||
|
echo $name;
|
||||||
|
break;
|
||||||
|
case "get_utilisateur_hardware":
|
||||||
|
$hardware = get_Ordinateurs($_GET['userid']);
|
||||||
|
echo json_encode($hardware);
|
||||||
|
break;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
94
ajax/autocompletion.php
Normal file
94
ajax/autocompletion.php
Normal file
@ -0,0 +1,94 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* ---------------------------------------------------------------------
|
||||||
|
* GLPI - Gestionnaire Libre de Parc Informatique
|
||||||
|
* Copyright (C) 2015-2020 Teclib' and contributors.
|
||||||
|
*
|
||||||
|
* http://glpi-project.org
|
||||||
|
*
|
||||||
|
* based on GLPI - Gestionnaire Libre de Parc Informatique
|
||||||
|
* Copyright (C) 2003-2014 by the INDEPNET Development Team.
|
||||||
|
*
|
||||||
|
* ---------------------------------------------------------------------
|
||||||
|
*
|
||||||
|
* LICENSE
|
||||||
|
*
|
||||||
|
* This file is part of GLPI.
|
||||||
|
*
|
||||||
|
* GLPI 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 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* GLPI 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 GLPI. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
* ---------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
|
// Include plugin if it is a plugin table
|
||||||
|
if (!strstr($_GET['itemtype'], "Plugin")) {
|
||||||
|
$AJAX_INCLUDE = 1;
|
||||||
|
}
|
||||||
|
include ('../inc/includes.php');
|
||||||
|
header("Content-Type: application/json; charset=UTF-8");
|
||||||
|
Html::header_nocache();
|
||||||
|
|
||||||
|
Session::checkLoginUser();
|
||||||
|
|
||||||
|
// Security
|
||||||
|
if (!isset($_GET['itemtype']) || !($item = getItemForItemtype($_GET['itemtype']))) {
|
||||||
|
exit();
|
||||||
|
}
|
||||||
|
|
||||||
|
$item->getEmpty();
|
||||||
|
$table = $item->getTable();
|
||||||
|
// Security
|
||||||
|
if (!isset($item->fields[$_GET['field']]) || !$item->canView()) {
|
||||||
|
exit();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Security : check whitelist
|
||||||
|
$field_so = $item->getSearchOptionByField('field', $_GET['field'], $item->getTable());
|
||||||
|
$can_autocomplete = array_key_exists('autocomplete', $field_so) && $field_so['autocomplete'];
|
||||||
|
if (!$can_autocomplete) {
|
||||||
|
exit();
|
||||||
|
}
|
||||||
|
|
||||||
|
$entity = [];
|
||||||
|
if (isset($_GET['entity_restrict']) && $_GET['entity_restrict']>=0) {
|
||||||
|
if ($item->isEntityAssign()) {
|
||||||
|
$entity['entities_id'] = $_GET['entity_restrict'];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isset($_GET['user_restrict']) && $_GET['user_restrict']>0) {
|
||||||
|
$entity['users_id'] = $_GET['user_restrict'];
|
||||||
|
}
|
||||||
|
|
||||||
|
$iterator = $DB->request([
|
||||||
|
'SELECT' => $_GET['field'],
|
||||||
|
'DISTINCT' => true,
|
||||||
|
'FROM' => $table,
|
||||||
|
'WHERE' => [
|
||||||
|
[$_GET['field'] => ['LIKE', $_GET['term'] . '%']],
|
||||||
|
[$_GET['field'] => ['<>', $_GET['term']]]
|
||||||
|
] + $entity,
|
||||||
|
'ORDER' => $_GET['field']
|
||||||
|
]);
|
||||||
|
|
||||||
|
$values = [];
|
||||||
|
|
||||||
|
if (count($iterator)) {
|
||||||
|
while ($data = $iterator->next()) {
|
||||||
|
$values[] = Html::entity_decode_deep($data[$_GET['field']]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (count($values)) {
|
||||||
|
echo json_encode($values);
|
||||||
|
}
|
||||||
95
ajax/comments.php
Normal file
95
ajax/comments.php
Normal file
@ -0,0 +1,95 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* ---------------------------------------------------------------------
|
||||||
|
* GLPI - Gestionnaire Libre de Parc Informatique
|
||||||
|
* Copyright (C) 2015-2020 Teclib' and contributors.
|
||||||
|
*
|
||||||
|
* http://glpi-project.org
|
||||||
|
*
|
||||||
|
* based on GLPI - Gestionnaire Libre de Parc Informatique
|
||||||
|
* Copyright (C) 2003-2014 by the INDEPNET Development Team.
|
||||||
|
*
|
||||||
|
* ---------------------------------------------------------------------
|
||||||
|
*
|
||||||
|
* LICENSE
|
||||||
|
*
|
||||||
|
* This file is part of GLPI.
|
||||||
|
*
|
||||||
|
* GLPI 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 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* GLPI 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 GLPI. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
* ---------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
|
$AJAX_INCLUDE = 1;
|
||||||
|
include ('../inc/includes.php');
|
||||||
|
|
||||||
|
// Send UTF8 Headers
|
||||||
|
header("Content-Type: text/html; charset=UTF-8");
|
||||||
|
Html::header_nocache();
|
||||||
|
|
||||||
|
Session::checkLoginUser();
|
||||||
|
|
||||||
|
if (isset($_POST["table"])
|
||||||
|
&& isset($_POST["value"])) {
|
||||||
|
// Security
|
||||||
|
if (!$DB->tableExists($_POST['table'])) {
|
||||||
|
exit();
|
||||||
|
}
|
||||||
|
|
||||||
|
switch ($_POST["table"]) {
|
||||||
|
case "glpi_users" :
|
||||||
|
if ($_POST['value'] == 0) {
|
||||||
|
$tmpname = [
|
||||||
|
'link' => $CFG_GLPI['root_doc']."/front/user.php",
|
||||||
|
'comment' => "",
|
||||||
|
];
|
||||||
|
} else {
|
||||||
|
if (is_array($_POST["value"])) {
|
||||||
|
$comments = [];
|
||||||
|
foreach ($_POST["value"] as $users_id) {
|
||||||
|
$username = getUserName($users_id, 2);
|
||||||
|
$comments[] = $username['comment'] ?? "";
|
||||||
|
}
|
||||||
|
$tmpname = [
|
||||||
|
'comment' => implode("<br>", $comments),
|
||||||
|
];
|
||||||
|
unset($_POST['withlink']);
|
||||||
|
} else {
|
||||||
|
$tmpname = getUserName($_POST["value"], 2);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
echo $tmpname["comment"];
|
||||||
|
|
||||||
|
if (isset($_POST['withlink'])) {
|
||||||
|
echo "<script type='text/javascript' >\n";
|
||||||
|
echo Html::jsGetElementbyID($_POST['withlink']).".attr('href', '".$tmpname['link']."');";
|
||||||
|
echo "</script>\n";
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
default :
|
||||||
|
if ($_POST["value"] > 0) {
|
||||||
|
$tmpname = Dropdown::getDropdownName($_POST["table"], $_POST["value"], 1);
|
||||||
|
if (is_array($tmpname) && isset($tmpname["comment"])) {
|
||||||
|
echo $tmpname["comment"];
|
||||||
|
}
|
||||||
|
if (isset($_POST['withlink'])) {
|
||||||
|
$itemtype = getItemTypeForTable($_POST["table"]);
|
||||||
|
echo "<script type='text/javascript' >\n";
|
||||||
|
echo Html::jsGetElementbyID($_POST['withlink']).".
|
||||||
|
attr('href', '".$itemtype::getFormURLWithID($_POST["value"])."');";
|
||||||
|
echo "</script>\n";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
117
ajax/common.tabs.php
Normal file
117
ajax/common.tabs.php
Normal file
@ -0,0 +1,117 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* ---------------------------------------------------------------------
|
||||||
|
* GLPI - Gestionnaire Libre de Parc Informatique
|
||||||
|
* Copyright (C) 2015-2020 Teclib' and contributors.
|
||||||
|
*
|
||||||
|
* http://glpi-project.org
|
||||||
|
*
|
||||||
|
* based on GLPI - Gestionnaire Libre de Parc Informatique
|
||||||
|
* Copyright (C) 2003-2014 by the INDEPNET Development Team.
|
||||||
|
*
|
||||||
|
* ---------------------------------------------------------------------
|
||||||
|
*
|
||||||
|
* LICENSE
|
||||||
|
*
|
||||||
|
* This file is part of GLPI.
|
||||||
|
*
|
||||||
|
* GLPI 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 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* GLPI 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 GLPI. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
* ---------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
|
include ('../inc/includes.php');
|
||||||
|
|
||||||
|
if (isset($_GET['full_page_tab'])) {
|
||||||
|
Html::header('Only tab for debug', $_SERVER['PHP_SELF']);
|
||||||
|
} else {
|
||||||
|
header("Content-Type: text/html; charset=UTF-8");
|
||||||
|
Html::header_nocache();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Not possible to check right for anonymous FAQ
|
||||||
|
//Session::checkLoginUser();
|
||||||
|
|
||||||
|
if (!isset($_GET['_glpi_tab'])) {
|
||||||
|
exit();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!isset($_GET['_itemtype']) || empty($_GET['_itemtype'])) {
|
||||||
|
exit();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!isset($_GET["sort"])) {
|
||||||
|
$_GET["sort"] = "";
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!isset($_GET["order"])) {
|
||||||
|
$_GET["order"] = "";
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!isset($_GET["withtemplate"])) {
|
||||||
|
$_GET["withtemplate"] = "";
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($item = getItemForItemtype($_UGET['_itemtype'])) {
|
||||||
|
if ($item->get_item_to_display_tab) {
|
||||||
|
// No id if ruleCollection but check right
|
||||||
|
if ($item instanceof RuleCollection) {
|
||||||
|
if (!$item->canList()) {
|
||||||
|
exit();
|
||||||
|
}
|
||||||
|
} else if (!isset($_GET["id"])|| $item->isNewID($_GET["id"])) {
|
||||||
|
if (!$item->can(-1, CREATE, $_GET)) {
|
||||||
|
exit();
|
||||||
|
}
|
||||||
|
} else if (!$item->can($_GET["id"], READ)) {
|
||||||
|
exit();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$notvalidoptions = ['_glpi_tab', '_itemtype', 'sort', 'order', 'withtemplate'];
|
||||||
|
$options = $_GET;
|
||||||
|
foreach ($notvalidoptions as $key) {
|
||||||
|
if (isset($options[$key])) {
|
||||||
|
unset($options[$key]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (isset($options['locked'])) {
|
||||||
|
ObjectLock::setReadOnlyProfile();
|
||||||
|
}
|
||||||
|
CommonGLPI::displayStandardTab($item, $_UGET['_glpi_tab'], $_GET["withtemplate"], $options);
|
||||||
|
|
||||||
|
|
||||||
|
if (isset($_GET['full_page_tab'])) {
|
||||||
|
echo "<div class='center' id='debugajax'>";
|
||||||
|
echo "<a href='".htmlentities($_SERVER['REQUEST_URI'])."' class='vsubmit'>Reload</a>";
|
||||||
|
echo "</div>";
|
||||||
|
|
||||||
|
// I think that we should display this warning, because tabs are not prepare
|
||||||
|
// for being used full space ...
|
||||||
|
if (!isset($_SESSION['glpi_warned_about_full_page_tab'])) {
|
||||||
|
// Debug string : not really need translation.
|
||||||
|
$msg = 'WARNING: full page tabs are only for debug/validation purpose !\n';
|
||||||
|
$msg .= 'Actions on this page may have undefined result.';
|
||||||
|
echo "<script type='text/javascript' >\n";
|
||||||
|
echo "alert('$msg')";
|
||||||
|
echo "</script>";
|
||||||
|
$_SESSION['glpi_warned_about_full_page_tab'] = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
Html::footer();
|
||||||
|
|
||||||
|
|
||||||
|
} else {
|
||||||
|
Html::ajaxFooter();
|
||||||
|
}
|
||||||
68
ajax/compareKbRevisions.php
Normal file
68
ajax/compareKbRevisions.php
Normal file
@ -0,0 +1,68 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* ---------------------------------------------------------------------
|
||||||
|
* GLPI - Gestionnaire Libre de Parc Informatique
|
||||||
|
* Copyright (C) 2015-2020 Teclib' and contributors.
|
||||||
|
*
|
||||||
|
* http://glpi-project.org
|
||||||
|
*
|
||||||
|
* based on GLPI - Gestionnaire Libre de Parc Informatique
|
||||||
|
* Copyright (C) 2003-2014 by the INDEPNET Development Team.
|
||||||
|
*
|
||||||
|
* ---------------------------------------------------------------------
|
||||||
|
*
|
||||||
|
* LICENSE
|
||||||
|
*
|
||||||
|
* This file is part of GLPI.
|
||||||
|
*
|
||||||
|
* GLPI 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 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* GLPI 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 GLPI. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
* ---------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @since 9.1
|
||||||
|
*/
|
||||||
|
|
||||||
|
include ('../inc/includes.php');
|
||||||
|
header("Content-Type: application/json; charset=UTF-8");
|
||||||
|
Html::header_nocache();
|
||||||
|
|
||||||
|
Session::checkLoginUser();
|
||||||
|
|
||||||
|
if (!isset($_POST['kbid']) || !isset($_POST['oldid']) || !isset($_POST['diffid'])) {
|
||||||
|
throw new \RuntimeException('Required argument missing!');
|
||||||
|
}
|
||||||
|
|
||||||
|
$oldid = $_POST['oldid'];
|
||||||
|
$diffid = $_POST['diffid'];
|
||||||
|
$kbid = $_POST['kbid'];
|
||||||
|
|
||||||
|
$revision = new KnowbaseItem_Revision();
|
||||||
|
$revision->getFromDB($oldid);
|
||||||
|
$old = [
|
||||||
|
'name' => $revision->fields['name'],
|
||||||
|
'answer' => Toolbox::unclean_html_cross_side_scripting_deep($revision->fields['answer'])
|
||||||
|
];
|
||||||
|
|
||||||
|
$revision = $diffid == 0 ? new KnowbaseItem() : new KnowbaseItem_Revision();
|
||||||
|
$revision->getFromDB($diffid == 0 ? $kbid : $diffid);
|
||||||
|
$diff = [
|
||||||
|
'name' => $revision->fields['name'],
|
||||||
|
'answer' => Toolbox::unclean_html_cross_side_scripting_deep($revision->fields['answer'])
|
||||||
|
];
|
||||||
|
|
||||||
|
echo json_encode([
|
||||||
|
'old' => $old,
|
||||||
|
'diff' => $diff
|
||||||
|
]);
|
||||||
124
ajax/dashboard.php
Normal file
124
ajax/dashboard.php
Normal file
@ -0,0 +1,124 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* ---------------------------------------------------------------------
|
||||||
|
* GLPI - Gestionnaire Libre de Parc Informatique
|
||||||
|
* Copyright (C) 2015-2020 Teclib' and contributors.
|
||||||
|
*
|
||||||
|
* http://glpi-project.org
|
||||||
|
*
|
||||||
|
* based on GLPI - Gestionnaire Libre de Parc Informatique
|
||||||
|
* Copyright (C) 2003-2014 by the INDEPNET Development Team.
|
||||||
|
*
|
||||||
|
* ---------------------------------------------------------------------
|
||||||
|
*
|
||||||
|
* LICENSE
|
||||||
|
*
|
||||||
|
* This file is part of GLPI.
|
||||||
|
*
|
||||||
|
* GLPI 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 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* GLPI 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 GLPI. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
* ---------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
|
include ('../inc/includes.php');
|
||||||
|
|
||||||
|
use Glpi\Dashboard\Grid;
|
||||||
|
|
||||||
|
if (!isset($_REQUEST["action"])) {
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!isset($_REQUEST['embed']) || !$_REQUEST['embed']) {
|
||||||
|
Session::checkCentralAccess();
|
||||||
|
|
||||||
|
} else if (!in_array($_REQUEST['action'], [
|
||||||
|
'get_dashboard_items',
|
||||||
|
'get_card'
|
||||||
|
])) {
|
||||||
|
Html::displayRightError();
|
||||||
|
}
|
||||||
|
|
||||||
|
$dashboard = new Glpi\Dashboard\Dashboard($_REQUEST['dashboard'] ?? "");
|
||||||
|
|
||||||
|
switch ($_REQUEST['action']) {
|
||||||
|
case 'save_new_dashboard':
|
||||||
|
echo $dashboard->saveNew(
|
||||||
|
$_REQUEST['title'] ?? "",
|
||||||
|
$_REQUEST['context'] ?? ""
|
||||||
|
);
|
||||||
|
exit;
|
||||||
|
|
||||||
|
case 'save_items':
|
||||||
|
$dashboard->saveitems($_REQUEST['items'] ?? []);
|
||||||
|
$dashboard->saveTitle($_REQUEST['title'] ?? "");
|
||||||
|
exit;
|
||||||
|
|
||||||
|
case 'save_rights':
|
||||||
|
echo $dashboard->saveRights($_REQUEST['rights'] ?? []);
|
||||||
|
exit;
|
||||||
|
|
||||||
|
case 'delete_dashboard':
|
||||||
|
echo $dashboard->delete(['key' => $_REQUEST['dashboard']]);
|
||||||
|
exit;
|
||||||
|
|
||||||
|
case 'set_last_dashboard':
|
||||||
|
$grid = new Grid($_REQUEST['dashboard'] ?? "");
|
||||||
|
echo $grid->setLastDashboard($_REQUEST['page'], $_REQUEST['dashboard']);
|
||||||
|
exit;
|
||||||
|
|
||||||
|
case 'clone_dashboard':
|
||||||
|
$new_dashboard = $dashboard->cloneCurrent();
|
||||||
|
echo json_encode($new_dashboard);
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
$grid = new Grid($_REQUEST['dashboard'] ?? "");
|
||||||
|
|
||||||
|
session_write_close();
|
||||||
|
header("Content-Type: text/html; charset=UTF-8");
|
||||||
|
switch ($_REQUEST['action']) {
|
||||||
|
case 'add_new':
|
||||||
|
$grid->displayAddDashboardForm();
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'edit_rights':
|
||||||
|
$grid->displayEditRightsForm();
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'display_edit_widget':
|
||||||
|
case 'display_add_widget':
|
||||||
|
$grid->displayWidgetForm($_REQUEST);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'display_embed_form':
|
||||||
|
$grid->displayEmbedForm();
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'get_card':
|
||||||
|
echo $grid->getCardHtml($_REQUEST['card_id'], $_REQUEST);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'display_add_filter':
|
||||||
|
$grid->displayFilterForm($_REQUEST);
|
||||||
|
break;
|
||||||
|
case 'get_dashboard_filters':
|
||||||
|
echo $grid->getFiltersSetHtml($_REQUEST['filters'] ?? []);
|
||||||
|
break;
|
||||||
|
case 'get_filter':
|
||||||
|
echo $grid->getFilterHtml($_REQUEST['filter_id']);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'get_dashboard_items':
|
||||||
|
echo $grid->getGridItemsHtml(true, $_REQUEST['embed'] ?? false);
|
||||||
|
break;
|
||||||
|
}
|
||||||
62
ajax/dcroom_size.php
Normal file
62
ajax/dcroom_size.php
Normal file
@ -0,0 +1,62 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* ---------------------------------------------------------------------
|
||||||
|
* GLPI - Gestionnaire Libre de Parc Informatique
|
||||||
|
* Copyright (C) 2015-2020 Teclib' and contributors.
|
||||||
|
*
|
||||||
|
* http://glpi-project.org
|
||||||
|
*
|
||||||
|
* based on GLPI - Gestionnaire Libre de Parc Informatique
|
||||||
|
* Copyright (C) 2003-2014 by the INDEPNET Development Team.
|
||||||
|
*
|
||||||
|
* ---------------------------------------------------------------------
|
||||||
|
*
|
||||||
|
* LICENSE
|
||||||
|
*
|
||||||
|
* This file is part of GLPI.
|
||||||
|
*
|
||||||
|
* GLPI 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 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* GLPI 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 GLPI. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
* ---------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
|
include ('../inc/includes.php');
|
||||||
|
Html::header_nocache();
|
||||||
|
|
||||||
|
Session::checkLoginUser();
|
||||||
|
|
||||||
|
if (!isset($_REQUEST['id'])) {
|
||||||
|
throw new \RuntimeException('Required argument missing!');
|
||||||
|
}
|
||||||
|
|
||||||
|
$id = $_REQUEST['id'];
|
||||||
|
$current = isset($_REQUEST['current']) ? $_REQUEST['current'] : null;
|
||||||
|
$rand = isset($_REQUEST['rand']) ? $_REQUEST['rand'] : mt_rand();
|
||||||
|
|
||||||
|
$room = new DCRoom();
|
||||||
|
if ($room->getFromDB($id)) {
|
||||||
|
$used = $room->getFilled($current);
|
||||||
|
$positions = $room->getAllPositions();
|
||||||
|
|
||||||
|
Dropdown::showFromArray(
|
||||||
|
'position',
|
||||||
|
$positions, [
|
||||||
|
'value' => $current,
|
||||||
|
'rand' => $rand,
|
||||||
|
'display_emptychoice' => true,
|
||||||
|
'used' => $used
|
||||||
|
]
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
echo __('No room found or selected');
|
||||||
|
}
|
||||||
382
ajax/decharge.php
Normal file
382
ajax/decharge.php
Normal file
@ -0,0 +1,382 @@
|
|||||||
|
<?php
|
||||||
|
if (!defined('GLPI_ROOT')) {
|
||||||
|
define('GLPI_ROOT', dirname(__DIR__));
|
||||||
|
}
|
||||||
|
|
||||||
|
include_once GLPI_ROOT . '/inc/based_config.php';
|
||||||
|
// Init Timer to compute time of display
|
||||||
|
$TIMER_DEBUG = new Timer();
|
||||||
|
$TIMER_DEBUG->start();
|
||||||
|
/// TODO try to remove them if possible
|
||||||
|
include_once (GLPI_ROOT . "/inc/db.function.php");
|
||||||
|
// Standard includes
|
||||||
|
include_once (GLPI_ROOT . "/inc/config.php");
|
||||||
|
//disbled errors =>pour le variable res (Ajax)
|
||||||
|
ini_set('display_errors', 0);
|
||||||
|
|
||||||
|
Session::checkLoginUser();
|
||||||
|
global $DB;
|
||||||
|
|
||||||
|
|
||||||
|
function update_sequence($last_seq , $type){
|
||||||
|
global $DB;
|
||||||
|
$stmt = $DB->prepare("UPDATE `sequence` SET `last_seq`= ? WHERE type = ? ");
|
||||||
|
$stmt->bind_param("is", $last_seq , $type);
|
||||||
|
$stmt->execute();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function get_num_refernce($type){
|
||||||
|
|
||||||
|
global $DB;
|
||||||
|
$res = array();
|
||||||
|
$stmt = $DB->prepare("SELECT * FROM `sequence` where type = ? ");
|
||||||
|
$stmt->bind_param("s",$type);
|
||||||
|
$stmt->execute();
|
||||||
|
$result = $stmt->get_result();
|
||||||
|
|
||||||
|
if ($result->num_rows > 0) {
|
||||||
|
|
||||||
|
while($row = $result->fetch_array(MYSQLI_ASSOC)) {
|
||||||
|
$res[] = $row;
|
||||||
|
}
|
||||||
|
return $res[0]['last_seq'];
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
function get_Phones($user_id){
|
||||||
|
|
||||||
|
global $DB;
|
||||||
|
$res = array();
|
||||||
|
$stmt = $DB->prepare(" SELECT DISTINCT glpi_phonemodels.name as modele , glpi_phonetypes.name as types ,glpi_phonepowersupplies.name as alimentation,
|
||||||
|
glpi_phones.`number_line`,glpi_phones.users_id ,glpi_phones.comment,glpi_phones.brand as marque,
|
||||||
|
glpi_phones.serial as num_serie
|
||||||
|
FROM `glpi_phones`
|
||||||
|
LEFT JOIN `glpi_phonemodels` ON (glpi_phones.phonemodels_id = glpi_phonemodels.id )
|
||||||
|
LEFT JOIN `glpi_phonetypes` ON (glpi_phones.phonetypes_id = glpi_phonetypes.id )
|
||||||
|
LEFT JOIN `glpi_phonepowersupplies` ON (glpi_phones.phonepowersupplies_id = glpi_phonepowersupplies.id )
|
||||||
|
WHERE glpi_phones.users_id = ? AND glpi_phones.is_deleted = 0 AND glpi_phones.is_template = 0");
|
||||||
|
$stmt->bind_param("i",$user_id);
|
||||||
|
$stmt->execute();
|
||||||
|
$result = $stmt->get_result();
|
||||||
|
|
||||||
|
if ($result->num_rows > 0) {
|
||||||
|
|
||||||
|
while($row = $result->fetch_array(MYSQLI_ASSOC)) {
|
||||||
|
$Phones[] = $row;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
for($ph = 0 ; $ph < count($Phones) ; $ph++){
|
||||||
|
$data_all = array();
|
||||||
|
$temp = array();
|
||||||
|
$temp[0] = !empty($Phones[$ph]['types']) ? 'Type :'.$Phones[$ph]['types'] : null;
|
||||||
|
$temp[1] = !empty($Phones[$ph]['modele']) ? 'Modèle :'.$Phones[$ph]['modele'] : null;
|
||||||
|
$temp[2] = !empty($Phones[$ph]['marque']) ? 'Marque :'.$Phones[$ph]['marque'] : null;
|
||||||
|
$temp[3] = !empty($Phones[$ph]['alimentation']) ? 'Alimentation :'.$Phones[$ph]['alimentation'] : null;
|
||||||
|
$temp[4] = !empty($Phones[$ph]['num_serie']) ? 'S/N :'.$Phones[$ph]['num_serie'] : null;
|
||||||
|
$temp[5] = !empty($Phones[$ph]['number_line']) ? 'Nombre de lignes :'.$Phones[$ph]['number_line'] : null;
|
||||||
|
|
||||||
|
for($v = 0 ; $v < count($temp) ; $v++) {
|
||||||
|
if($temp[$v] != null) array_push($data_all ,$temp[$v]);
|
||||||
|
}
|
||||||
|
|
||||||
|
$Phone = ['Téléphone','1',implode(' , ',$data_all),$Phones[$ph]['comment']];
|
||||||
|
array_push($res,$Phone);
|
||||||
|
|
||||||
|
}
|
||||||
|
return $res;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $res;
|
||||||
|
}
|
||||||
|
|
||||||
|
function get_Ordinateurs($user_id){
|
||||||
|
|
||||||
|
global $DB;
|
||||||
|
$res = array();
|
||||||
|
$stmt = $DB->prepare("SELECT DISTINCT
|
||||||
|
glpi_computers.id AS Computer_id, glpi_manufacturers.name AS fabricant, glpi_computers.serial AS serial,
|
||||||
|
glpi_computertypes.name AS types, glpi_computermodels.name AS modele, glpi_users.id AS users_id,
|
||||||
|
glpi_computers.uuid , glpi_computers.comment AS comment , glpi_computers.serial as num_serie
|
||||||
|
FROM glpi_computers
|
||||||
|
LEFT JOIN glpi_states ON (glpi_computers.states_id = glpi_states.id )
|
||||||
|
LEFT JOIN glpi_manufacturers ON (glpi_computers.manufacturers_id = glpi_manufacturers.id )
|
||||||
|
LEFT JOIN glpi_computertypes ON (glpi_computers.computertypes_id = glpi_computertypes.id )
|
||||||
|
LEFT JOIN glpi_computermodels ON (glpi_computers.computermodels_id = glpi_computermodels.id )
|
||||||
|
LEFT JOIN glpi_items_operatingsystems ON (glpi_computers.id = glpi_items_operatingsystems.items_id AND glpi_items_operatingsystems.itemtype = 'Computer' )
|
||||||
|
LEFT JOIN glpi_operatingsystems AS glpi_operatingsystems_8 ON (glpi_items_operatingsystems.operatingsystems_id = glpi_operatingsystems_8.id )
|
||||||
|
LEFT JOIN glpi_locations ON (glpi_computers.locations_id = glpi_locations.id )
|
||||||
|
LEFT JOIN glpi_users ON (glpi_computers.users_id = glpi_users.id )
|
||||||
|
LEFT JOIN glpi_items_deviceprocessors ON (glpi_computers.id = glpi_items_deviceprocessors.items_id AND glpi_items_deviceprocessors.itemtype = 'Computer' )
|
||||||
|
LEFT JOIN glpi_deviceprocessors AS glpi_deviceprocessors_7 ON (glpi_items_deviceprocessors.deviceprocessors_id = glpi_deviceprocessors_7.id )
|
||||||
|
WHERE glpi_computers.is_deleted = 0 AND glpi_computers.is_template = 0 and glpi_users.id = ?
|
||||||
|
GROUP BY glpi_computers.id");
|
||||||
|
$stmt->bind_param("i",$user_id);
|
||||||
|
$stmt->execute();
|
||||||
|
$result = $stmt->get_result();
|
||||||
|
|
||||||
|
if ($result->num_rows > 0) {
|
||||||
|
|
||||||
|
while($row = $result->fetch_array(MYSQLI_ASSOC)) {
|
||||||
|
$Ordinateurs[] = $row;
|
||||||
|
}
|
||||||
|
|
||||||
|
for($i = 0 ; $i < count($Ordinateurs) ; $i++){
|
||||||
|
$data_all = array();
|
||||||
|
$temp = array();
|
||||||
|
$temp[0] = !empty($Ordinateurs[$i]['types']) ? 'Type : '.$Ordinateurs[$i]['types'] : null;
|
||||||
|
$temp[1] = !empty($Ordinateurs[$i]['modele']) ? 'Modèle : '.$Ordinateurs[$i]['modele'] : null;
|
||||||
|
$temp[2] = !empty($Ordinateurs[$i]['fabricant']) ? 'Fabricant : '.$Ordinateurs[$i]['fabricant'] : null;
|
||||||
|
$temp[3] = !empty($Ordinateurs[$i]['num_serie']) ? 'S/N : '.$Ordinateurs[$i]['num_serie'] : null;
|
||||||
|
$temp[4] = !empty($Ordinateurs[$i]['uuid']) ? $Ordinateurs[$i]['uuid'] : null;
|
||||||
|
|
||||||
|
for($k = 0 ; $k < count($temp) ; $k++) {
|
||||||
|
if($temp[$k] != null) array_push($data_all ,$temp[$k]);
|
||||||
|
}
|
||||||
|
|
||||||
|
$Ordinateur = ['Ordinateur','1',implode(' , ',$data_all),$Ordinateurs[$i]['comment']];
|
||||||
|
array_push($res,$Ordinateur);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $res;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $res;
|
||||||
|
}
|
||||||
|
|
||||||
|
function add(array $request){
|
||||||
|
global $DB;
|
||||||
|
|
||||||
|
if(isset($request["id_user"])){
|
||||||
|
$stmt = $DB->prepare("INSERT INTO decharge_entete(id_user , fonction, num, date, type, date_creation ,titre) VALUES ( ?,?,?,?,?, NOW(),?)");
|
||||||
|
$stmt->bind_param("isssss" ,
|
||||||
|
$request["id_user"] ,
|
||||||
|
$request["fonction"] ,
|
||||||
|
$request["num"] ,
|
||||||
|
$request["date"] ,
|
||||||
|
$request["type"] ,
|
||||||
|
$request["titre"]
|
||||||
|
);
|
||||||
|
$stmt->execute();
|
||||||
|
|
||||||
|
$lastId = $DB->insert_id();
|
||||||
|
$nbr = count($request["designation"]);
|
||||||
|
|
||||||
|
for($i=0;$i < $nbr ;$i++){
|
||||||
|
$stmt = $DB->prepare("INSERT INTO decharge_lignes (id_entete ,designation , quantite, fiche, etat) VALUES ( ?,?,?,?,?)");
|
||||||
|
$stmt->bind_param("issss" ,
|
||||||
|
$lastId ,
|
||||||
|
$request["designation"][$i] ,
|
||||||
|
$request["quantite"][$i] ,
|
||||||
|
$request["fiche"][$i] ,
|
||||||
|
$request["etat"][$i]
|
||||||
|
);
|
||||||
|
$stmt->execute();
|
||||||
|
}
|
||||||
|
update_sequence($request["num"] ,$request["type"]);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function update(array $request){
|
||||||
|
global $DB;
|
||||||
|
|
||||||
|
if(isset($request["id_entete"])){
|
||||||
|
//decharge_entete
|
||||||
|
$stmt = $DB->prepare("UPDATE decharge_entete SET fonction = ?,
|
||||||
|
num = ?, date = ?, type = ? , date_modification = NOW() ,titre = ?
|
||||||
|
where id_entete = ?
|
||||||
|
");
|
||||||
|
$stmt->bind_param("sssssi" ,
|
||||||
|
$request["fonction"] ,
|
||||||
|
$request["num"] ,
|
||||||
|
$request["date"] ,
|
||||||
|
$request["type"] ,
|
||||||
|
$request["titre"] ,
|
||||||
|
$request["id_entete"]
|
||||||
|
);
|
||||||
|
$stmt->execute();
|
||||||
|
|
||||||
|
|
||||||
|
//decharge_lignes
|
||||||
|
$nbr = count($request["designation"]);
|
||||||
|
|
||||||
|
for($i=0;$i < $nbr ;$i++){
|
||||||
|
//Insert
|
||||||
|
if($_POST["ids"][$i] == 0){
|
||||||
|
$stmt = $DB->prepare("INSERT INTO decharge_lignes (id_entete ,designation , quantite, fiche, etat) VALUES ( ?,?,?,?,?)");
|
||||||
|
$stmt->bind_param("issss" ,
|
||||||
|
$request["id_entete"] ,
|
||||||
|
$request["designation"][$i] ,
|
||||||
|
$request["quantite"][$i] ,
|
||||||
|
$request["fiche"][$i] ,
|
||||||
|
$request["etat"][$i]
|
||||||
|
);
|
||||||
|
$stmt->execute();
|
||||||
|
//Update
|
||||||
|
}elseif($_POST["ids"][$i] != 0){
|
||||||
|
$stmt = $DB->prepare("UPDATE decharge_lignes SET designation = ? , quantite = ?, fiche = ?, etat = ?
|
||||||
|
where id = ? ");
|
||||||
|
$stmt->bind_param("ssssi" ,
|
||||||
|
$request["designation"][$i] ,
|
||||||
|
$request["quantite"][$i] ,
|
||||||
|
$request["fiche"][$i] ,
|
||||||
|
$request["etat"][$i] ,
|
||||||
|
$request["ids"][$i]
|
||||||
|
);
|
||||||
|
$stmt->execute();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//Deleted
|
||||||
|
$idsToDelete = explode(",", $_GET['idsToDelete']);
|
||||||
|
for ($c = 0; $c< count($idsToDelete); $c++) {
|
||||||
|
$stmt = $DB->prepare( "DELETE FROM decharge_lignes WHERE id = ?");
|
||||||
|
$stmt->bind_param("i", $idsToDelete[$c]);
|
||||||
|
$stmt->execute();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function get_Function($user_id){
|
||||||
|
|
||||||
|
global $DB;
|
||||||
|
|
||||||
|
$stmt = $DB->prepare("SELECT value as fonction FROM `glpi_users`
|
||||||
|
LEFT JOIN picklist on glpi_users.id_fonction = picklist.id
|
||||||
|
WHERE glpi_users.id = ? ");
|
||||||
|
$stmt->bind_param("i",$user_id);
|
||||||
|
$stmt->execute();
|
||||||
|
$result = $stmt->get_result();
|
||||||
|
|
||||||
|
if ($result->num_rows > 0) {
|
||||||
|
|
||||||
|
while($row = $result->fetch_array(MYSQLI_ASSOC)) {
|
||||||
|
$res[] = $row;
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
function filtre($id , $num , $type , $date){
|
||||||
|
|
||||||
|
global $DB;
|
||||||
|
|
||||||
|
$filtre_values = array();
|
||||||
|
|
||||||
|
$id = $id <> 0 ? array_push($filtre_values,"en.id_user =".$id) : "";
|
||||||
|
$num = $num <> '' ? array_push($filtre_values,"en.num =".$num) : "";
|
||||||
|
$type = $type <> 'all' ? array_push($filtre_values,"en.type ='".$type."'") : "";
|
||||||
|
$date = $date <> '' ? array_push($filtre_values,"en.date ='".$date."'") : "";
|
||||||
|
|
||||||
|
if(count($filtre_values) > 0){
|
||||||
|
$sql=" WHERE ".implode(" and ",$filtre_values);
|
||||||
|
}else{
|
||||||
|
$sql="";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
$query = "SELECT en.id_entete,en.fonction ,en.num,en.date,en.type ,
|
||||||
|
concat(glpi_users.realname,' ',glpi_users.firstname) as fullname
|
||||||
|
FROM decharge_entete as en
|
||||||
|
LEFT JOIN glpi_users on en.id_user = glpi_users.id ".$sql." ORDER BY `en`.`id_entete` DESC";
|
||||||
|
$result = $DB->query($query);
|
||||||
|
|
||||||
|
if ($result->num_rows > 0) {
|
||||||
|
|
||||||
|
while($row = $result->fetch_assoc()) {
|
||||||
|
$res[] = $row;
|
||||||
|
}
|
||||||
|
return $res;
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
function delete_decharge($id){
|
||||||
|
|
||||||
|
global $DB;
|
||||||
|
|
||||||
|
//decharge_entete
|
||||||
|
$stmt = $DB->prepare("DELETE FROM decharge_entete where id_entete = ? ");
|
||||||
|
$stmt->bind_param("i" , $id);
|
||||||
|
$stmt->execute();
|
||||||
|
//decharge_lignes
|
||||||
|
$stmt = $DB->prepare("DELETE FROM decharge_lignes where id_entete = ? ");
|
||||||
|
$stmt->bind_param("i" , $id);
|
||||||
|
$stmt->execute();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
if(isset($_POST)){
|
||||||
|
|
||||||
|
switch ($_GET['action']) {
|
||||||
|
|
||||||
|
case "add":
|
||||||
|
add($_POST);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case "update":
|
||||||
|
update($_POST);
|
||||||
|
break;
|
||||||
|
/*
|
||||||
|
case "delete":
|
||||||
|
delete_decharge($_GET['id_entete']);
|
||||||
|
Html::redirect($CFG_GLPI["root_doc"]."/front/decharge.list.php");
|
||||||
|
break;
|
||||||
|
*/
|
||||||
|
|
||||||
|
case "get_utilisateur_fonction":
|
||||||
|
//header('Content-type: application/json');
|
||||||
|
$function = get_Function($_GET['userid']);
|
||||||
|
//echo json_encode($function);
|
||||||
|
echo $function;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case "filtre":
|
||||||
|
header('Content-type: application/json; charset=utf-8');
|
||||||
|
$res = filtre($_GET['iduser'],$_GET['num'],$_GET['type'],$_GET['date']);
|
||||||
|
echo json_encode($res,JSON_UNESCAPED_UNICODE);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case "user_equipments":
|
||||||
|
|
||||||
|
if(isset($_GET['userid']) && !empty($_GET['userid'])){
|
||||||
|
header('Content-type: application/json');
|
||||||
|
$equipments = array();
|
||||||
|
$Ordinateurs = get_Ordinateurs($_GET['userid']) ;
|
||||||
|
$Phones = get_Phones($_GET['userid']);
|
||||||
|
|
||||||
|
|
||||||
|
$equipments['ordinateurs'] = $Ordinateurs;
|
||||||
|
$equipments['phones'] = $Phones;
|
||||||
|
|
||||||
|
echo json_encode($equipments,JSON_UNESCAPED_UNICODE);
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
|
||||||
|
|
||||||
|
case "get_refernce":
|
||||||
|
|
||||||
|
if(isset($_GET['type']) && !empty($_GET['type'])){
|
||||||
|
header('Content-type: application/json; charset=utf-8');
|
||||||
|
$res['last_num'] = get_num_refernce($_GET['type']);
|
||||||
|
echo json_encode($res);
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
42
ajax/displayMessageAfterRedirect.php
Normal file
42
ajax/displayMessageAfterRedirect.php
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* ---------------------------------------------------------------------
|
||||||
|
* GLPI - Gestionnaire Libre de Parc Informatique
|
||||||
|
* Copyright (C) 2015-2020 Teclib' and contributors.
|
||||||
|
*
|
||||||
|
* http://glpi-project.org
|
||||||
|
*
|
||||||
|
* based on GLPI - Gestionnaire Libre de Parc Informatique
|
||||||
|
* Copyright (C) 2003-2014 by the INDEPNET Development Team.
|
||||||
|
*
|
||||||
|
* ---------------------------------------------------------------------
|
||||||
|
*
|
||||||
|
* LICENSE
|
||||||
|
*
|
||||||
|
* This file is part of GLPI.
|
||||||
|
*
|
||||||
|
* GLPI 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 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* GLPI 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 GLPI. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
* ---------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
|
$AJAX_INCLUDE = 1;
|
||||||
|
include ('../inc/includes.php');
|
||||||
|
|
||||||
|
// Send UTF8 Headers
|
||||||
|
header("Content-Type: text/html; charset=UTF-8");
|
||||||
|
Html::header_nocache();
|
||||||
|
|
||||||
|
Session::checkLoginUser();
|
||||||
|
|
||||||
|
Html::displayMessageAfterRedirect();
|
||||||
53
ajax/drh.score.employees.php
Normal file
53
ajax/drh.score.employees.php
Normal file
@ -0,0 +1,53 @@
|
|||||||
|
<?php
|
||||||
|
if (!defined('GLPI_ROOT')) {
|
||||||
|
define('GLPI_ROOT', dirname(__DIR__));
|
||||||
|
}
|
||||||
|
|
||||||
|
include_once GLPI_ROOT . '/inc/based_config.php';
|
||||||
|
// Init Timer to compute time of display
|
||||||
|
$TIMER_DEBUG = new Timer();
|
||||||
|
$TIMER_DEBUG->start();
|
||||||
|
/// TODO try to remove them if possible
|
||||||
|
include_once (GLPI_ROOT . "/inc/db.function.php");
|
||||||
|
// Standard includes
|
||||||
|
include_once (GLPI_ROOT . "/inc/config.php");
|
||||||
|
//disbled errors =>pour le variable res (Ajax)
|
||||||
|
ini_set('display_errors', 0);
|
||||||
|
|
||||||
|
Session::checkLoginUser();
|
||||||
|
global $DB;
|
||||||
|
|
||||||
|
function getUsersScores($year){
|
||||||
|
global $DB;
|
||||||
|
|
||||||
|
|
||||||
|
$query = "SELECT *
|
||||||
|
FROM `resultat_eval_scores`
|
||||||
|
WHERE type_id = ? ";
|
||||||
|
$stmt = $DB->prepare($query);
|
||||||
|
$stmt->bind_param("i" , $year);
|
||||||
|
$stmt->execute();
|
||||||
|
$result = $stmt->get_result();
|
||||||
|
|
||||||
|
if ($result->num_rows > 0) {
|
||||||
|
$res = array();
|
||||||
|
while($row = $result->fetch_assoc()){
|
||||||
|
$res[$row['user_id']] = array($row['score'],$row['id_rfe']);
|
||||||
|
}
|
||||||
|
return $res;
|
||||||
|
}
|
||||||
|
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
|
if(isset($_POST)){
|
||||||
|
|
||||||
|
switch ($_GET['action']) {
|
||||||
|
case "get_utilisateur_scores":
|
||||||
|
$scores = getUsersScores($_GET['year']);
|
||||||
|
echo json_encode($scores);
|
||||||
|
break;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
96
ajax/dropdownAllItems.php
Normal file
96
ajax/dropdownAllItems.php
Normal file
@ -0,0 +1,96 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* ---------------------------------------------------------------------
|
||||||
|
* GLPI - Gestionnaire Libre de Parc Informatique
|
||||||
|
* Copyright (C) 2015-2020 Teclib' and contributors.
|
||||||
|
*
|
||||||
|
* http://glpi-project.org
|
||||||
|
*
|
||||||
|
* based on GLPI - Gestionnaire Libre de Parc Informatique
|
||||||
|
* Copyright (C) 2003-2014 by the INDEPNET Development Team.
|
||||||
|
*
|
||||||
|
* ---------------------------------------------------------------------
|
||||||
|
*
|
||||||
|
* LICENSE
|
||||||
|
*
|
||||||
|
* This file is part of GLPI.
|
||||||
|
*
|
||||||
|
* GLPI 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 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* GLPI 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 GLPI. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
* ---------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
|
include ('../inc/includes.php');
|
||||||
|
|
||||||
|
header("Content-Type: text/html; charset=UTF-8");
|
||||||
|
Html::header_nocache();
|
||||||
|
|
||||||
|
Session::checkCentralAccess();
|
||||||
|
|
||||||
|
// Make a select box
|
||||||
|
if ($_POST["idtable"] && class_exists($_POST["idtable"])) {
|
||||||
|
// Link to user for search only > normal users
|
||||||
|
$link = "getDropdownValue.php";
|
||||||
|
|
||||||
|
if ($_POST["idtable"] == 'User') {
|
||||||
|
$link = "getDropdownUsers.php";
|
||||||
|
}
|
||||||
|
|
||||||
|
$rand = mt_rand();
|
||||||
|
if (isset($_POST['rand'])) {
|
||||||
|
$rand = $_POST['rand'];
|
||||||
|
}
|
||||||
|
|
||||||
|
$field_id = Html::cleanId("dropdown_".$_POST["name"].$rand);
|
||||||
|
|
||||||
|
$p = ['value' => 0,
|
||||||
|
'valuename' => Dropdown::EMPTY_VALUE,
|
||||||
|
'itemtype' => $_POST["idtable"],
|
||||||
|
'display_emptychoice' => true,
|
||||||
|
'displaywith' => ['otherserial', 'serial']];
|
||||||
|
if (isset($_POST['value'])) {
|
||||||
|
$p['value'] = $_POST['value'];
|
||||||
|
}
|
||||||
|
if (isset($_POST['entity_restrict'])) {
|
||||||
|
$p['entity_restrict'] = $_POST['entity_restrict'];
|
||||||
|
}
|
||||||
|
if (isset($_POST['condition'])) {
|
||||||
|
$p['condition'] = $_POST['condition'];
|
||||||
|
}
|
||||||
|
if (isset($_POST['used'])) {
|
||||||
|
$_POST['used'] = Toolbox::jsonDecode($_POST['used'], true);
|
||||||
|
}
|
||||||
|
if (isset($_POST['used'][$_POST['idtable']])) {
|
||||||
|
$p['used'] = $_POST['used'][$_POST['idtable']];
|
||||||
|
}
|
||||||
|
if (isset($_POST['width'])) {
|
||||||
|
$p['width'] = $_POST['width'];
|
||||||
|
}
|
||||||
|
|
||||||
|
echo Html::jsAjaxDropdown($_POST["name"], $field_id,
|
||||||
|
$CFG_GLPI['root_doc']."/ajax/".$link,
|
||||||
|
$p);
|
||||||
|
|
||||||
|
if (!empty($_POST['showItemSpecificity'])) {
|
||||||
|
$params = ['items_id' => '__VALUE__',
|
||||||
|
'itemtype' => $_POST["idtable"]];
|
||||||
|
if (isset($_POST['entity_restrict'])) {
|
||||||
|
$params['entity_restrict'] = $_POST['entity_restrict'];
|
||||||
|
}
|
||||||
|
|
||||||
|
Ajax::updateItemOnSelectEvent($field_id, "showItemSpecificity_".$_POST["name"]."$rand",
|
||||||
|
$_POST['showItemSpecificity'], $params);
|
||||||
|
|
||||||
|
echo "<br><span id='showItemSpecificity_".$_POST["name"]."$rand'> </span>\n";
|
||||||
|
}
|
||||||
|
}
|
||||||
52
ajax/dropdownConnect.php
Normal file
52
ajax/dropdownConnect.php
Normal file
@ -0,0 +1,52 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* ---------------------------------------------------------------------
|
||||||
|
* GLPI - Gestionnaire Libre de Parc Informatique
|
||||||
|
* Copyright (C) 2015-2020 Teclib' and contributors.
|
||||||
|
*
|
||||||
|
* http://glpi-project.org
|
||||||
|
*
|
||||||
|
* based on GLPI - Gestionnaire Libre de Parc Informatique
|
||||||
|
* Copyright (C) 2003-2014 by the INDEPNET Development Team.
|
||||||
|
*
|
||||||
|
* ---------------------------------------------------------------------
|
||||||
|
*
|
||||||
|
* LICENSE
|
||||||
|
*
|
||||||
|
* This file is part of GLPI.
|
||||||
|
*
|
||||||
|
* GLPI 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 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* GLPI 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 GLPI. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
* ---------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
|
if (strpos($_SERVER['PHP_SELF'], "dropdownConnect.php")) {
|
||||||
|
include ('../inc/includes.php');
|
||||||
|
header("Content-Type: text/html; charset=UTF-8");
|
||||||
|
Html::header_nocache();
|
||||||
|
} else if (!defined('GLPI_ROOT')) {
|
||||||
|
die("Sorry. You can't access this file directly");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!isset($_POST['fromtype']) || !($fromitem = getItemForItemtype($_POST['fromtype']))) {
|
||||||
|
exit();
|
||||||
|
}
|
||||||
|
|
||||||
|
$fromitem->checkGlobal(UPDATE);
|
||||||
|
|
||||||
|
$used = [];
|
||||||
|
if (isset($_POST["used"])) {
|
||||||
|
$used = $_POST["used"];
|
||||||
|
}
|
||||||
|
Computer_Item::dropdownConnect($_POST["itemtype"], $_POST['fromtype'], $_POST['myname'],
|
||||||
|
$_POST["entity_restrict"], $_POST["onlyglobal"], $used);
|
||||||
145
ajax/dropdownConnectNetworkPort.php
Normal file
145
ajax/dropdownConnectNetworkPort.php
Normal file
@ -0,0 +1,145 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* ---------------------------------------------------------------------
|
||||||
|
* GLPI - Gestionnaire Libre de Parc Informatique
|
||||||
|
* Copyright (C) 2015-2020 Teclib' and contributors.
|
||||||
|
*
|
||||||
|
* http://glpi-project.org
|
||||||
|
*
|
||||||
|
* based on GLPI - Gestionnaire Libre de Parc Informatique
|
||||||
|
* Copyright (C) 2003-2014 by the INDEPNET Development Team.
|
||||||
|
*
|
||||||
|
* ---------------------------------------------------------------------
|
||||||
|
*
|
||||||
|
* LICENSE
|
||||||
|
*
|
||||||
|
* This file is part of GLPI.
|
||||||
|
*
|
||||||
|
* GLPI 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 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* GLPI 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 GLPI. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
* ---------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @since 0.84
|
||||||
|
*/
|
||||||
|
|
||||||
|
$AJAX_INCLUDE = 1;
|
||||||
|
|
||||||
|
include ('../inc/includes.php');
|
||||||
|
|
||||||
|
header("Content-Type: text/html; charset=UTF-8");
|
||||||
|
Html::header_nocache();
|
||||||
|
|
||||||
|
Session::checkRight("networking", UPDATE);
|
||||||
|
|
||||||
|
// Make a select box
|
||||||
|
if (class_exists($_POST["itemtype"])
|
||||||
|
&& isset($_POST["item"])) {
|
||||||
|
$table = getTableForItemType($_POST["itemtype"]);
|
||||||
|
|
||||||
|
$joins = [];
|
||||||
|
$name_field = new QueryExpression("'' AS " . $DB->quoteName('npname'));
|
||||||
|
|
||||||
|
if ($_POST['instantiation_type'] == 'NetworkPortEthernet') {
|
||||||
|
$name_field = 'glpi_netpoints.name AS npname';
|
||||||
|
$joins = [
|
||||||
|
'glpi_networkportethernets' => [
|
||||||
|
'ON' => [
|
||||||
|
'glpi_networkportethernets' => 'id',
|
||||||
|
'glpi_networkports' => 'id'
|
||||||
|
]
|
||||||
|
],
|
||||||
|
'glpi_netpoints' => [
|
||||||
|
'ON' => [
|
||||||
|
'glpi_networkportethernets' => 'netpoints_id',
|
||||||
|
'glpi_netpoints' => 'id'
|
||||||
|
]
|
||||||
|
]
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
$criteria = [
|
||||||
|
'SELECT' => [
|
||||||
|
'glpi_networkports_networkports.id AS wid',
|
||||||
|
'glpi_networkports.id AS did',
|
||||||
|
"$table.name AS cname",
|
||||||
|
'glpi_networkports.name AS nname',
|
||||||
|
$name_field
|
||||||
|
],
|
||||||
|
'DISTINCT' => true,
|
||||||
|
'FROM' => $table,
|
||||||
|
'LEFT JOIN' => [
|
||||||
|
'glpi_networkports' => [
|
||||||
|
'ON' => [
|
||||||
|
'glpi_networkports' => 'items_id',
|
||||||
|
$table => 'id', [
|
||||||
|
'AND' => [
|
||||||
|
'glpi_networkports.items_id' => $_POST['item'],
|
||||||
|
'glpi_networkports.itemtype' => $_POST["itemtype"],
|
||||||
|
'glpi_networkports.instantiation_type' => $_POST['instantiation_type']
|
||||||
|
]
|
||||||
|
]
|
||||||
|
]
|
||||||
|
],
|
||||||
|
'glpi_networkports_networkports' => [
|
||||||
|
'ON' => [
|
||||||
|
'glpi_networkports_networkports' => 'networkports_id_1',
|
||||||
|
'glpi_networkports' => 'id', [
|
||||||
|
'OR' => [
|
||||||
|
'glpi_networkports_networkports.networkports_id_2' => new QueryExpression($DB->quoteName('glpi_networkports.id'))
|
||||||
|
]
|
||||||
|
]
|
||||||
|
]
|
||||||
|
]
|
||||||
|
] + $joins,
|
||||||
|
'WHERE' => [
|
||||||
|
'glpi_networkports_networkports.id' => null,
|
||||||
|
'NOT' => ['glpi_networkports.id' => null],
|
||||||
|
'glpi_networkports.id' => ['<>', $_POST['networkports_id']],
|
||||||
|
"$table.is_deleted" => 0,
|
||||||
|
"$table.is_template" => 0
|
||||||
|
],
|
||||||
|
'ORDERBY' => 'glpi_networkports.id'
|
||||||
|
];
|
||||||
|
$iterator = $DB->request($criteria);
|
||||||
|
|
||||||
|
echo "<br>";
|
||||||
|
|
||||||
|
$values = [];
|
||||||
|
while ($data = $iterator->next()) {
|
||||||
|
// Device name + port name
|
||||||
|
$output = $output_long = $data['cname'];
|
||||||
|
|
||||||
|
if (!empty($data['nname'])) {
|
||||||
|
$output = sprintf(__('%1$s - %2$s'), $output, $data['nname']);
|
||||||
|
//TRANS: %1$s is device name, %2$s is port name
|
||||||
|
$output_long = sprintf(__('%1$s - The port %2$s'), $output_long, $data['nname']);
|
||||||
|
}
|
||||||
|
|
||||||
|
// display netpoint (which will be copied)
|
||||||
|
if (!empty($data['npname'])) {
|
||||||
|
$output = sprintf(__('%1$s - %2$s'), $output, $data['npname']);
|
||||||
|
//TRANS: %1$s is a string (device name - port name...), %2$s is network outlet name
|
||||||
|
$output_long = sprintf(__('%1$s - Network outlet %2$s'), $output_long, $data['npname']);
|
||||||
|
}
|
||||||
|
$ID = $data['did'];
|
||||||
|
|
||||||
|
if ($_SESSION["glpiis_ids_visible"] || empty($output) || empty($output_long)) {
|
||||||
|
$output = sprintf(__('%1$s (%2$s)'), $output, $ID);
|
||||||
|
$output_long = sprintf(__('%1$s (%2$s)'), $output_long, $ID);
|
||||||
|
}
|
||||||
|
$values[$ID] = $output_long;
|
||||||
|
}
|
||||||
|
Dropdown::showFromArray($_POST['myname'], $values, ['display_emptychoice' => true]);
|
||||||
|
}
|
||||||
81
ajax/dropdownConnectNetworkPortDeviceType.php
Normal file
81
ajax/dropdownConnectNetworkPortDeviceType.php
Normal file
@ -0,0 +1,81 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* ---------------------------------------------------------------------
|
||||||
|
* GLPI - Gestionnaire Libre de Parc Informatique
|
||||||
|
* Copyright (C) 2015-2020 Teclib' and contributors.
|
||||||
|
*
|
||||||
|
* http://glpi-project.org
|
||||||
|
*
|
||||||
|
* based on GLPI - Gestionnaire Libre de Parc Informatique
|
||||||
|
* Copyright (C) 2003-2014 by the INDEPNET Development Team.
|
||||||
|
*
|
||||||
|
* ---------------------------------------------------------------------
|
||||||
|
*
|
||||||
|
* LICENSE
|
||||||
|
*
|
||||||
|
* This file is part of GLPI.
|
||||||
|
*
|
||||||
|
* GLPI 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 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* GLPI 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 GLPI. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
* ---------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @since 0.84
|
||||||
|
*/
|
||||||
|
|
||||||
|
include ('../inc/includes.php');
|
||||||
|
|
||||||
|
header("Content-Type: text/html; charset=UTF-8");
|
||||||
|
Html::header_nocache();
|
||||||
|
|
||||||
|
Session::checkRight("networking", UPDATE);
|
||||||
|
|
||||||
|
// Make a select box
|
||||||
|
if (class_exists($_POST["itemtype"])) {
|
||||||
|
$rand = mt_rand();
|
||||||
|
|
||||||
|
$toupdate = [
|
||||||
|
'value_fieldname' => 'item',
|
||||||
|
'to_update' => "results_item_$rand",
|
||||||
|
'url' => $CFG_GLPI["root_doc"]."/ajax/dropdownConnectNetworkPort.php",
|
||||||
|
'moreparams' => [
|
||||||
|
'networkports_id' => $_POST['networkports_id'],
|
||||||
|
'itemtype' => $_POST['itemtype'],
|
||||||
|
'myname' => $_POST['myname'],
|
||||||
|
'instantiation_type' => $_POST['instantiation_type']
|
||||||
|
]
|
||||||
|
];
|
||||||
|
$params = [
|
||||||
|
'rand' => $rand,
|
||||||
|
'name' => "items",
|
||||||
|
'entity' => $_POST["entity_restrict"],
|
||||||
|
'condition' => [
|
||||||
|
'id' => new \QuerySubQuery([
|
||||||
|
'SELECT' => 'items_id',
|
||||||
|
'FROM' => 'glpi_networkports',
|
||||||
|
'WHERE' => [
|
||||||
|
'itemtype' => $_POST['itemtype'],
|
||||||
|
'instantiation_type' => $_POST['instantiation_type']
|
||||||
|
]
|
||||||
|
])
|
||||||
|
],
|
||||||
|
'toupdate' => $toupdate
|
||||||
|
];
|
||||||
|
|
||||||
|
Dropdown::show($_POST['itemtype'], $params);
|
||||||
|
|
||||||
|
echo "<span id='results_item_$rand'>";
|
||||||
|
echo "</span>\n";
|
||||||
|
|
||||||
|
}
|
||||||
53
ajax/dropdownDelegationUsers.php
Normal file
53
ajax/dropdownDelegationUsers.php
Normal file
@ -0,0 +1,53 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* ---------------------------------------------------------------------
|
||||||
|
* GLPI - Gestionnaire Libre de Parc Informatique
|
||||||
|
* Copyright (C) 2015-2020 Teclib' and contributors.
|
||||||
|
*
|
||||||
|
* http://glpi-project.org
|
||||||
|
*
|
||||||
|
* based on GLPI - Gestionnaire Libre de Parc Informatique
|
||||||
|
* Copyright (C) 2003-2014 by the INDEPNET Development Team.
|
||||||
|
*
|
||||||
|
* ---------------------------------------------------------------------
|
||||||
|
*
|
||||||
|
* LICENSE
|
||||||
|
*
|
||||||
|
* This file is part of GLPI.
|
||||||
|
*
|
||||||
|
* GLPI 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 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* GLPI 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 GLPI. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
* ---------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
|
// Direct access to file
|
||||||
|
if (strpos($_SERVER['PHP_SELF'], "dropdownDelegationUsers.php")) {
|
||||||
|
$AJAX_INCLUDE = 1;
|
||||||
|
include ('../inc/includes.php');
|
||||||
|
header("Content-Type: text/html; charset=UTF-8");
|
||||||
|
Html::header_nocache();
|
||||||
|
} else if (!defined('GLPI_ROOT')) {
|
||||||
|
die("Sorry. You can't access this file directly");
|
||||||
|
}
|
||||||
|
|
||||||
|
Session::checkLoginUser();
|
||||||
|
|
||||||
|
if ($_POST["nodelegate"] == 1) {
|
||||||
|
$_POST['_users_id_requester'] = Session::getLoginUserID();
|
||||||
|
$_POST['_right'] = "id";
|
||||||
|
} else {
|
||||||
|
$_POST['_right'] = "delegate";
|
||||||
|
}
|
||||||
|
|
||||||
|
$ticket = new Ticket();
|
||||||
|
$ticket->showActorAddFormOnCreate(Ticket_User::REQUESTER, $_POST);
|
||||||
48
ajax/dropdownFieldsBlacklist.php
Normal file
48
ajax/dropdownFieldsBlacklist.php
Normal file
@ -0,0 +1,48 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* ---------------------------------------------------------------------
|
||||||
|
* GLPI - Gestionnaire Libre de Parc Informatique
|
||||||
|
* Copyright (C) 2015-2020 Teclib' and contributors.
|
||||||
|
*
|
||||||
|
* http://glpi-project.org
|
||||||
|
*
|
||||||
|
* based on GLPI - Gestionnaire Libre de Parc Informatique
|
||||||
|
* Copyright (C) 2003-2014 by the INDEPNET Development Team.
|
||||||
|
*
|
||||||
|
* ---------------------------------------------------------------------
|
||||||
|
*
|
||||||
|
* LICENSE
|
||||||
|
*
|
||||||
|
* This file is part of GLPI.
|
||||||
|
*
|
||||||
|
* GLPI 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 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* GLPI 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 GLPI. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
* ---------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
|
if (strpos($_SERVER['PHP_SELF'], "dropdownFieldsBlacklist.php")) {
|
||||||
|
include ('../inc/includes.php');
|
||||||
|
header("Content-Type: text/html; charset=UTF-8");
|
||||||
|
Html::header_nocache();
|
||||||
|
}
|
||||||
|
|
||||||
|
Session::checkRight("config", UPDATE);
|
||||||
|
|
||||||
|
$field = new Fieldblacklist();
|
||||||
|
if ($_POST['id'] > 0) {
|
||||||
|
$field->getFromDB($_POST['id']);
|
||||||
|
} else {
|
||||||
|
$field->getEmpty();
|
||||||
|
$field->fields['itemtype'] = $_POST['itemtype'];
|
||||||
|
}
|
||||||
|
$field->selectCriterias();
|
||||||
87
ajax/dropdownInstallVersion.php
Normal file
87
ajax/dropdownInstallVersion.php
Normal file
@ -0,0 +1,87 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* ---------------------------------------------------------------------
|
||||||
|
* GLPI - Gestionnaire Libre de Parc Informatique
|
||||||
|
* Copyright (C) 2015-2020 Teclib' and contributors.
|
||||||
|
*
|
||||||
|
* http://glpi-project.org
|
||||||
|
*
|
||||||
|
* based on GLPI - Gestionnaire Libre de Parc Informatique
|
||||||
|
* Copyright (C) 2003-2014 by the INDEPNET Development Team.
|
||||||
|
*
|
||||||
|
* ---------------------------------------------------------------------
|
||||||
|
*
|
||||||
|
* LICENSE
|
||||||
|
*
|
||||||
|
* This file is part of GLPI.
|
||||||
|
*
|
||||||
|
* GLPI 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 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* GLPI 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 GLPI. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
* ---------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
|
if (strpos($_SERVER['PHP_SELF'], "dropdownInstallVersion.php")) {
|
||||||
|
$AJAX_INCLUDE = 1;
|
||||||
|
include ('../inc/includes.php');
|
||||||
|
header("Content-Type: text/html; charset=UTF-8");
|
||||||
|
Html::header_nocache();
|
||||||
|
}
|
||||||
|
|
||||||
|
Session::checkRight("software", UPDATE);
|
||||||
|
|
||||||
|
if ($_POST['softwares_id'] > 0) {
|
||||||
|
if (!isset($_POST['value'])) {
|
||||||
|
$_POST['value'] = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
$where = [];
|
||||||
|
if (isset($_POST['used'])) {
|
||||||
|
$used = $_POST['used'];
|
||||||
|
if (count($used)) {
|
||||||
|
$where = ['NOT' => ['glpi_softwareversions.id' => $used]];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Make a select box
|
||||||
|
$iterator = $DB->request([
|
||||||
|
'SELECT' => ['glpi_softwareversions.*', 'glpi_states.name AS sname'],
|
||||||
|
'DISTINCT' => true,
|
||||||
|
'FROM' => 'glpi_softwareversions',
|
||||||
|
'LEFT JOIN' => [
|
||||||
|
'glpi_states' => [
|
||||||
|
'ON' => [
|
||||||
|
'glpi_softwareversions' => 'states_id',
|
||||||
|
'glpi_states' => 'id'
|
||||||
|
]
|
||||||
|
]
|
||||||
|
],
|
||||||
|
'WHERE' => ['glpi_softwareversions.softwares_id' => $_POST['softwares_id']] + $where
|
||||||
|
]);
|
||||||
|
$number = count($iterator);
|
||||||
|
|
||||||
|
$values = [];
|
||||||
|
while ($data = $iterator->next()) {
|
||||||
|
$ID = $data['id'];
|
||||||
|
$output = $data['name'];
|
||||||
|
|
||||||
|
if (empty($output) || $_SESSION['glpiis_ids_visible']) {
|
||||||
|
$output = sprintf(__('%1$s (%2$s)'), $output, $ID);
|
||||||
|
}
|
||||||
|
if (!empty($data['sname'])) {
|
||||||
|
$output = sprintf(__('%1$s - %2$s'), $output, $data['sname']);
|
||||||
|
}
|
||||||
|
$values[$ID] = $output;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
Dropdown::showFromArray($_POST['myname'], $values, ['display_emptychoice' => true]);
|
||||||
|
}
|
||||||
216
ajax/dropdownItilActors.php
Normal file
216
ajax/dropdownItilActors.php
Normal file
@ -0,0 +1,216 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* ---------------------------------------------------------------------
|
||||||
|
* GLPI - Gestionnaire Libre de Parc Informatique
|
||||||
|
* Copyright (C) 2015-2020 Teclib' and contributors.
|
||||||
|
*
|
||||||
|
* http://glpi-project.org
|
||||||
|
*
|
||||||
|
* based on GLPI - Gestionnaire Libre de Parc Informatique
|
||||||
|
* Copyright (C) 2003-2014 by the INDEPNET Development Team.
|
||||||
|
*
|
||||||
|
* ---------------------------------------------------------------------
|
||||||
|
*
|
||||||
|
* LICENSE
|
||||||
|
*
|
||||||
|
* This file is part of GLPI.
|
||||||
|
*
|
||||||
|
* GLPI 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 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* GLPI 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 GLPI. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
* ---------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
|
include ('../inc/includes.php');
|
||||||
|
include_once("../functionsophalglpi.php");
|
||||||
|
|
||||||
|
header("Content-Type: text/html; charset=UTF-8");
|
||||||
|
Html::header_nocache();
|
||||||
|
|
||||||
|
|
||||||
|
Session::checkCentralAccess();
|
||||||
|
|
||||||
|
// Make a select box
|
||||||
|
if (isset($_POST["type"])
|
||||||
|
&& isset($_POST["actortype"])
|
||||||
|
&& isset($_POST["itemtype"])) {
|
||||||
|
$rand = mt_rand();
|
||||||
|
if ($item = getItemForItemtype($_POST["itemtype"])) {
|
||||||
|
switch ($_POST["type"]) {
|
||||||
|
case "user" :
|
||||||
|
$right = 'all';
|
||||||
|
// Only steal or own ticket whit empty assign
|
||||||
|
if ($_POST["actortype"] == 'assign') {
|
||||||
|
$right = "own_ticket";
|
||||||
|
if (!$item->canAssign()) {
|
||||||
|
//sophal
|
||||||
|
$CanAttribue = CanAttribue($_SESSION['glpiactiveprofile']['name']);
|
||||||
|
if($CanAttribue == 1){
|
||||||
|
$right = 'all';
|
||||||
|
}else{
|
||||||
|
$right = 'id';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$options = ['name' => '_itil_'.$_POST["actortype"].'[users_id]',
|
||||||
|
'entity' => $_POST['entity_restrict'],
|
||||||
|
'right' => $right,
|
||||||
|
'rand' => $rand,
|
||||||
|
'ldap_import' => true];
|
||||||
|
|
||||||
|
if ($CFG_GLPI["notifications_mailing"]) {
|
||||||
|
$withemail = (isset($_POST["allow_email"]) ? $_POST["allow_email"] : false);
|
||||||
|
$paramscomment = ['value' => '__VALUE__',
|
||||||
|
'allow_email' => $withemail,
|
||||||
|
'field' => "_itil_".$_POST["actortype"],
|
||||||
|
'use_notification' => $_POST["use_notif"]];
|
||||||
|
// Fix rand value
|
||||||
|
$options['rand'] = $rand;
|
||||||
|
$options['toupdate'] = ['value_fieldname' => 'value',
|
||||||
|
'to_update' => "notif_user_$rand",
|
||||||
|
'url' => $CFG_GLPI["root_doc"].
|
||||||
|
"/ajax/uemailUpdate.php",
|
||||||
|
'moreparams' => $paramscomment];
|
||||||
|
}
|
||||||
|
|
||||||
|
if (($_POST["itemtype"] == 'Ticket')
|
||||||
|
&& ($_POST["actortype"] == 'assign')) {
|
||||||
|
$toupdate = [];
|
||||||
|
if (isset($options['toupdate']) && is_array($options['toupdate'])) {
|
||||||
|
$toupdate[] = $options['toupdate'];
|
||||||
|
}
|
||||||
|
$toupdate[] = ['value_fieldname' => 'value',
|
||||||
|
'to_update' => "countassign_$rand",
|
||||||
|
'url' => $CFG_GLPI["root_doc"].
|
||||||
|
"/ajax/ticketassigninformation.php",
|
||||||
|
'moreparams' => ['users_id_assign' => '__VALUE__']];
|
||||||
|
$options['toupdate'] = $toupdate;
|
||||||
|
}
|
||||||
|
|
||||||
|
$rand = User::dropdown($options);
|
||||||
|
|
||||||
|
|
||||||
|
// Display active tickets for a tech
|
||||||
|
// Need to update information on dropdown changes
|
||||||
|
if (($_POST["itemtype"] == 'Ticket')
|
||||||
|
&& ($_POST["actortype"] == 'assign')) {
|
||||||
|
echo "<br><span id='countassign_$rand'>--";
|
||||||
|
echo "</span>";
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($CFG_GLPI["notifications_mailing"]) {
|
||||||
|
echo "<br><span id='notif_user_$rand'>";
|
||||||
|
if ($withemail) {
|
||||||
|
echo __('Email followup').' ';
|
||||||
|
$rand = Dropdown::showYesNo('_itil_'.$_POST["actortype"].'[use_notification]', $_POST["use_notif"]);
|
||||||
|
echo '<br>';
|
||||||
|
printf(__('%1$s: %2$s'), _n('Email', 'Emails', 1),
|
||||||
|
"<input type='text' size='25' name='_itil_".$_POST["actortype"].
|
||||||
|
"[alternative_email]'>");
|
||||||
|
}
|
||||||
|
echo "</span>";
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case "group" :
|
||||||
|
$cond = ['is_requester' => 1];
|
||||||
|
if ($_POST["actortype"] == 'assign') {
|
||||||
|
$cond = ['is_assign' => 1];
|
||||||
|
}
|
||||||
|
if ($_POST["actortype"] == 'observer') {
|
||||||
|
$cond = ['is_watcher' => 1];
|
||||||
|
}
|
||||||
|
|
||||||
|
$param = [
|
||||||
|
'name' => '_itil_'.$_POST["actortype"].'[groups_id]',
|
||||||
|
'entity' => $_POST['entity_restrict'],
|
||||||
|
'condition' => $cond,
|
||||||
|
'rand' => $rand
|
||||||
|
];
|
||||||
|
if (($_POST["itemtype"] == 'Ticket')
|
||||||
|
&& ($_POST["actortype"] == 'assign')) {
|
||||||
|
$param['toupdate'] = ['value_fieldname' => 'value',
|
||||||
|
'to_update' => "countgroupassign_$rand",
|
||||||
|
'url' => $CFG_GLPI["root_doc"].
|
||||||
|
"/ajax/ticketassigninformation.php",
|
||||||
|
'moreparams' => ['groups_id_assign'
|
||||||
|
=> '__VALUE__']];
|
||||||
|
}
|
||||||
|
|
||||||
|
$rand = Group::dropdown($param);
|
||||||
|
|
||||||
|
if (($_POST["itemtype"] == 'Ticket')
|
||||||
|
&& ($_POST["actortype"] == 'assign')) {
|
||||||
|
echo "<br><span id='countgroupassign_$rand'>";
|
||||||
|
echo "</span>";
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
|
||||||
|
case "supplier" :
|
||||||
|
$options = ['name' => '_itil_'.$_POST["actortype"].'[suppliers_id]',
|
||||||
|
'entity' => $_POST['entity_restrict'],
|
||||||
|
'rand' => $rand];
|
||||||
|
if ($CFG_GLPI["notifications_mailing"]) {
|
||||||
|
$withemail = (isset($_POST["allow_email"]) ? $_POST["allow_email"] : false);
|
||||||
|
$paramscomment = ['value' => '__VALUE__',
|
||||||
|
'allow_email' => $withemail,
|
||||||
|
'field' => '_itil_'.$_POST["actortype"],
|
||||||
|
'typefield' => "supplier",
|
||||||
|
'use_notification' => $_POST["use_notif"]];
|
||||||
|
// Fix rand value
|
||||||
|
$options['rand'] = $rand;
|
||||||
|
$options['toupdate'] = ['value_fieldname' => 'value',
|
||||||
|
'to_update' => "notif_supplier_$rand",
|
||||||
|
'url' => $CFG_GLPI["root_doc"].
|
||||||
|
"/ajax/uemailUpdate.php",
|
||||||
|
'moreparams' => $paramscomment];
|
||||||
|
}
|
||||||
|
if ($_POST["itemtype"] == 'Ticket') {
|
||||||
|
$toupdate = [];
|
||||||
|
if (isset($options['toupdate']) && is_array($options['toupdate'])) {
|
||||||
|
$toupdate[] = $options['toupdate'];
|
||||||
|
}
|
||||||
|
$toupdate[] = ['value_fieldname' => 'value',
|
||||||
|
'to_update' => "countassign_$rand",
|
||||||
|
'url' => $CFG_GLPI["root_doc"].
|
||||||
|
"/ajax/ticketassigninformation.php",
|
||||||
|
'moreparams' => ['suppliers_id_assign' => '__VALUE__']];
|
||||||
|
$options['toupdate'] = $toupdate;
|
||||||
|
}
|
||||||
|
|
||||||
|
$rand = Supplier::dropdown($options);
|
||||||
|
// Display active tickets for a supplier
|
||||||
|
// Need to update information on dropdown changes
|
||||||
|
if ($_POST["itemtype"] == 'Ticket') {
|
||||||
|
echo "<span id='countassign_$rand'>";
|
||||||
|
echo "</span>";
|
||||||
|
}
|
||||||
|
if ($CFG_GLPI["notifications_mailing"]) {
|
||||||
|
echo "<br><span id='notif_supplier_$rand'>";
|
||||||
|
if ($withemail) {
|
||||||
|
echo __('Email followup').' ';
|
||||||
|
$rand = Dropdown::showYesNo('_itil_'.$_POST["actortype"].'[use_notification]', $_POST['use_notif']);
|
||||||
|
echo '<br>';
|
||||||
|
printf(__('%1$s: %2$s'), _n('Email', 'Emails', 1),
|
||||||
|
"<input type='text' size='25' name='_itil_".$_POST["actortype"].
|
||||||
|
"[alternative_email]'>");
|
||||||
|
}
|
||||||
|
echo "</span>";
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
65
ajax/dropdownLocation.php
Normal file
65
ajax/dropdownLocation.php
Normal file
@ -0,0 +1,65 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* ---------------------------------------------------------------------
|
||||||
|
* GLPI - Gestionnaire Libre de Parc Informatique
|
||||||
|
* Copyright (C) 2015-2017 Teclib' and contributors.
|
||||||
|
*
|
||||||
|
* http://glpi-project.org
|
||||||
|
*
|
||||||
|
* based on GLPI - Gestionnaire Libre de Parc Informatique
|
||||||
|
* Copyright (C) 2003-2014 by the INDEPNET Development Team.
|
||||||
|
*
|
||||||
|
* ---------------------------------------------------------------------
|
||||||
|
*
|
||||||
|
* LICENSE
|
||||||
|
*
|
||||||
|
* This file is part of GLPI.
|
||||||
|
*
|
||||||
|
* GLPI 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 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* GLPI 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 GLPI. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
* ---------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
|
include ('../inc/includes.php');
|
||||||
|
Html::header_nocache();
|
||||||
|
|
||||||
|
Session::checkLoginUser();
|
||||||
|
|
||||||
|
if (!isset($_REQUEST['itemtype'])
|
||||||
|
&& !is_subclass_of($_REQUEST['itemtype'], 'CommonDBTM')) {
|
||||||
|
throw new \RuntimeException('Required argument missing or incorrect!');
|
||||||
|
}
|
||||||
|
|
||||||
|
$item = new $_REQUEST['itemtype'];
|
||||||
|
$item->getFromDB((int) $_REQUEST['items_id']);
|
||||||
|
|
||||||
|
$locations_id = 0;
|
||||||
|
if (isset($item->fields['locations_id'])) {
|
||||||
|
$locations_id = $item->fields['locations_id'];
|
||||||
|
}
|
||||||
|
|
||||||
|
$entities_id = $_SESSION['glpiactive_entity'];
|
||||||
|
if (isset($item->fields['entities_id'])) {
|
||||||
|
$entities_id = $item->fields['entities_id'];
|
||||||
|
}
|
||||||
|
|
||||||
|
$is_recursive = $_SESSION['glpiactive_entity_recursive'];
|
||||||
|
if (isset($_REQUEST['is_recursive'])) {
|
||||||
|
$is_recursive = (bool) $_REQUEST['is_recursive'];
|
||||||
|
}
|
||||||
|
|
||||||
|
echo Location::dropdown([
|
||||||
|
'value' => $locations_id,
|
||||||
|
'entity' => $entities_id,
|
||||||
|
'entity_sons' => $is_recursive,
|
||||||
|
]);
|
||||||
49
ajax/dropdownMassiveAction.php
Normal file
49
ajax/dropdownMassiveAction.php
Normal file
@ -0,0 +1,49 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* ---------------------------------------------------------------------
|
||||||
|
* GLPI - Gestionnaire Libre de Parc Informatique
|
||||||
|
* Copyright (C) 2015-2020 Teclib' and contributors.
|
||||||
|
*
|
||||||
|
* http://glpi-project.org
|
||||||
|
*
|
||||||
|
* based on GLPI - Gestionnaire Libre de Parc Informatique
|
||||||
|
* Copyright (C) 2003-2014 by the INDEPNET Development Team.
|
||||||
|
*
|
||||||
|
* ---------------------------------------------------------------------
|
||||||
|
*
|
||||||
|
* LICENSE
|
||||||
|
*
|
||||||
|
* This file is part of GLPI.
|
||||||
|
*
|
||||||
|
* GLPI 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 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* GLPI 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 GLPI. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
* ---------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
|
include ('../inc/includes.php');
|
||||||
|
|
||||||
|
header("Content-Type: text/html; charset=UTF-8");
|
||||||
|
Html::header_nocache();
|
||||||
|
|
||||||
|
try {
|
||||||
|
$ma = new MassiveAction($_POST, $_GET, 'specialize');
|
||||||
|
} catch (Exception $e) {
|
||||||
|
echo "<div class='center'><img src='".$CFG_GLPI["root_doc"]."/pics/warning.png' alt='".
|
||||||
|
__s('Warning')."'><br><br>";
|
||||||
|
echo "<span class='b'>".$e->getMessage()."</span><br>";
|
||||||
|
echo "</div>";
|
||||||
|
exit();
|
||||||
|
}
|
||||||
|
|
||||||
|
$ma->showSubForm();
|
||||||
|
|
||||||
47
ajax/dropdownMassiveActionAddActor.php
Normal file
47
ajax/dropdownMassiveActionAddActor.php
Normal file
@ -0,0 +1,47 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* ---------------------------------------------------------------------
|
||||||
|
* GLPI - Gestionnaire Libre de Parc Informatique
|
||||||
|
* Copyright (C) 2015-2020 Teclib' and contributors.
|
||||||
|
*
|
||||||
|
* http://glpi-project.org
|
||||||
|
*
|
||||||
|
* based on GLPI - Gestionnaire Libre de Parc Informatique
|
||||||
|
* Copyright (C) 2003-2014 by the INDEPNET Development Team.
|
||||||
|
*
|
||||||
|
* ---------------------------------------------------------------------
|
||||||
|
*
|
||||||
|
* LICENSE
|
||||||
|
*
|
||||||
|
* This file is part of GLPI.
|
||||||
|
*
|
||||||
|
* GLPI 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 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* GLPI 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 GLPI. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
* ---------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
|
$AJAX_INCLUDE = 1;
|
||||||
|
include ('../inc/includes.php');
|
||||||
|
|
||||||
|
header("Content-Type: text/html; charset=UTF-8");
|
||||||
|
Html::header_nocache();
|
||||||
|
|
||||||
|
Session::checkRight('ticket', UPDATE);
|
||||||
|
|
||||||
|
if ($_POST["actortype"] > 0) {
|
||||||
|
$ticket = new Ticket();
|
||||||
|
$rand = mt_rand();
|
||||||
|
$ticket->showActorAddForm($_POST["actortype"], $rand, $_SESSION['glpiactive_entity'], [],
|
||||||
|
true, false, false);
|
||||||
|
echo " <input type='submit' name='add_actor' class='submit' value=\""._sx('button', 'Add')."\">";
|
||||||
|
}
|
||||||
128
ajax/dropdownMassiveActionAddValidator.php
Normal file
128
ajax/dropdownMassiveActionAddValidator.php
Normal file
@ -0,0 +1,128 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* ---------------------------------------------------------------------
|
||||||
|
* GLPI - Gestionnaire Libre de Parc Informatique
|
||||||
|
* Copyright (C) 2015-2020 Teclib' and contributors.
|
||||||
|
*
|
||||||
|
* http://glpi-project.org
|
||||||
|
*
|
||||||
|
* based on GLPI - Gestionnaire Libre de Parc Informatique
|
||||||
|
* Copyright (C) 2003-2014 by the INDEPNET Development Team.
|
||||||
|
*
|
||||||
|
* ---------------------------------------------------------------------
|
||||||
|
*
|
||||||
|
* LICENSE
|
||||||
|
*
|
||||||
|
* This file is part of GLPI.
|
||||||
|
*
|
||||||
|
* GLPI 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 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* GLPI 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 GLPI. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
* ---------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @since 0.85
|
||||||
|
*/
|
||||||
|
|
||||||
|
$AJAX_INCLUDE = 1;
|
||||||
|
include ('../inc/includes.php');
|
||||||
|
|
||||||
|
header("Content-Type: text/html; charset=UTF-8");
|
||||||
|
Html::header_nocache();
|
||||||
|
|
||||||
|
if (isset($_POST["validatortype"])) {
|
||||||
|
switch ($_POST["validatortype"]) {
|
||||||
|
case 'user' :
|
||||||
|
echo "<input type='hidden' name='groups_id' value=0 />";
|
||||||
|
User::dropdown(['name' => 'users_id_validate',
|
||||||
|
'entity' => $_SESSION["glpiactive_entity"],
|
||||||
|
'right' => ['validate_request', 'validate_incident']]);
|
||||||
|
|
||||||
|
echo "<br><br>".__('Comments')." ";
|
||||||
|
echo "<textarea name='comment_submission' cols='50' rows='6'></textarea> ";
|
||||||
|
|
||||||
|
echo "<input type='submit' name='add' value=\""._sx('button', 'Add')."\" class='submit'>";
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'group' :
|
||||||
|
echo "<input type='hidden' name='users_id_validate' value=0 />";
|
||||||
|
$rand = Group::dropdown(['name' => 'groups_id',
|
||||||
|
'entity' => $_SESSION["glpiactive_entity"]]);
|
||||||
|
|
||||||
|
$param = ['validatortype' => 'group_user',
|
||||||
|
'groups_id' =>'__VALUE__',
|
||||||
|
'right' => ['validate_request', 'validate_incident']];
|
||||||
|
|
||||||
|
Ajax::updateItemOnSelectEvent("dropdown_groups_id$rand", "show_groups_users",
|
||||||
|
$CFG_GLPI["root_doc"]."/ajax/dropdownMassiveActionAddValidator.php",
|
||||||
|
$param);
|
||||||
|
|
||||||
|
echo "<br><span id='show_groups_users'> </span>\n";
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'group_user' :
|
||||||
|
|
||||||
|
$opt = ['groups_id' => $_POST["groups_id"],
|
||||||
|
'right' => $_POST['right'],
|
||||||
|
'entity' => $_SESSION["glpiactive_entity"]];
|
||||||
|
|
||||||
|
$groups_users = TicketValidation::getGroupUserHaveRights($opt);
|
||||||
|
|
||||||
|
$users = [];
|
||||||
|
$param['values'] = [];
|
||||||
|
foreach ($groups_users as $data) {
|
||||||
|
$users[$data['id']] = formatUserName($data['id'], $data['name'], $data['realname'],
|
||||||
|
$data['firstname']);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isset($_POST['all_users'])
|
||||||
|
&& $_POST['all_users']) {
|
||||||
|
$param['values'] = array_keys($users);
|
||||||
|
}
|
||||||
|
|
||||||
|
$param['multiple']= true;
|
||||||
|
$param['display'] = true;
|
||||||
|
$param['size'] = count($users);
|
||||||
|
|
||||||
|
Dropdown::showFromArray("users_id_validate", $users, $param);
|
||||||
|
|
||||||
|
// Display all/none buttons to select all or no users in group
|
||||||
|
if (!empty($_POST['groups_id'])) {
|
||||||
|
echo "<a id='all_users' class='vsubmit'>".__('All')."</a>";
|
||||||
|
$param_button = [
|
||||||
|
'validatortype' => 'group_user',
|
||||||
|
'users_id_validate' => '',
|
||||||
|
'all_users' => 1,
|
||||||
|
'groups_id' => $_POST['groups_id'],
|
||||||
|
'right' => ['validate_request', 'validate_incident'],
|
||||||
|
'entity' => $_SESSION["glpiactive_entity"],
|
||||||
|
];
|
||||||
|
Ajax::updateItemOnEvent('all_users', 'show_groups_users',
|
||||||
|
$CFG_GLPI["root_doc"]."/ajax/dropdownMassiveActionAddValidator.php",
|
||||||
|
$param_button, ['click']);
|
||||||
|
|
||||||
|
echo " <a id='no_users' class='vsubmit'>".__('None')."</a>";
|
||||||
|
$param_button['all_users'] = 0;
|
||||||
|
Ajax::updateItemOnEvent('no_users', 'show_groups_users',
|
||||||
|
$CFG_GLPI["root_doc"]."/ajax/dropdownMassiveActionAddValidator.php",
|
||||||
|
$param_button, ['click']);
|
||||||
|
}
|
||||||
|
|
||||||
|
echo "<br><br>".__('Comments')." ";
|
||||||
|
echo "<textarea name='comment_submission' cols='50' rows='6'></textarea> ";
|
||||||
|
|
||||||
|
echo "<input type='submit' name='add' value=\""._sx('button', 'Add')."\" class='submit'>";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
70
ajax/dropdownMassiveActionAuthMethods.php
Normal file
70
ajax/dropdownMassiveActionAuthMethods.php
Normal file
@ -0,0 +1,70 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* ---------------------------------------------------------------------
|
||||||
|
* GLPI - Gestionnaire Libre de Parc Informatique
|
||||||
|
* Copyright (C) 2015-2020 Teclib' and contributors.
|
||||||
|
*
|
||||||
|
* http://glpi-project.org
|
||||||
|
*
|
||||||
|
* based on GLPI - Gestionnaire Libre de Parc Informatique
|
||||||
|
* Copyright (C) 2003-2014 by the INDEPNET Development Team.
|
||||||
|
*
|
||||||
|
* ---------------------------------------------------------------------
|
||||||
|
*
|
||||||
|
* LICENSE
|
||||||
|
*
|
||||||
|
* This file is part of GLPI.
|
||||||
|
*
|
||||||
|
* GLPI 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 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* GLPI 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 GLPI. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
* ---------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
|
$AJAX_INCLUDE = 1;
|
||||||
|
include ('../inc/includes.php');
|
||||||
|
|
||||||
|
header("Content-Type: text/html; charset=UTF-8");
|
||||||
|
Html::header_nocache();
|
||||||
|
|
||||||
|
Session::checkRight('user', User::UPDATEAUTHENT);
|
||||||
|
|
||||||
|
if ($_POST["authtype"] > 0) {
|
||||||
|
$name = 'massiveaction';
|
||||||
|
|
||||||
|
if (isset($_POST['name'])) {
|
||||||
|
$name = $_POST['name'];
|
||||||
|
}
|
||||||
|
|
||||||
|
switch ($_POST["authtype"]) {
|
||||||
|
case Auth::DB_GLPI :
|
||||||
|
echo "<input type='hidden' name='auths_id' value='0'>";
|
||||||
|
break;
|
||||||
|
|
||||||
|
case Auth::LDAP :
|
||||||
|
case Auth::EXTERNAL :
|
||||||
|
AuthLDAP::dropdown([
|
||||||
|
'name' => "auths_id",
|
||||||
|
'condition' => ['is_active' => 1]
|
||||||
|
]);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case Auth::MAIL :
|
||||||
|
AuthMail::dropdown([
|
||||||
|
'name' => "auths_id",
|
||||||
|
'condition' => ['is_active' => 1]
|
||||||
|
]);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
echo " <input type='submit' name='$name' class='submit' value=\""._sx('button', 'Post')."\">";
|
||||||
|
}
|
||||||
113
ajax/dropdownMassiveActionField.php
Normal file
113
ajax/dropdownMassiveActionField.php
Normal file
@ -0,0 +1,113 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* ---------------------------------------------------------------------
|
||||||
|
* GLPI - Gestionnaire Libre de Parc Informatique
|
||||||
|
* Copyright (C) 2015-2020 Teclib' and contributors.
|
||||||
|
*
|
||||||
|
* http://glpi-project.org
|
||||||
|
*
|
||||||
|
* based on GLPI - Gestionnaire Libre de Parc Informatique
|
||||||
|
* Copyright (C) 2003-2014 by the INDEPNET Development Team.
|
||||||
|
*
|
||||||
|
* ---------------------------------------------------------------------
|
||||||
|
*
|
||||||
|
* LICENSE
|
||||||
|
*
|
||||||
|
* This file is part of GLPI.
|
||||||
|
*
|
||||||
|
* GLPI 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 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* GLPI 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 GLPI. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
* ---------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
|
include ('../inc/includes.php');
|
||||||
|
|
||||||
|
header("Content-Type: text/html; charset=UTF-8");
|
||||||
|
Html::header_nocache();
|
||||||
|
|
||||||
|
if (!isset($_POST["itemtype"]) || !($item = getItemForItemtype($_POST['itemtype']))) {
|
||||||
|
exit();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Infocom::canApplyOn($_POST["itemtype"])) {
|
||||||
|
Session::checkSeveralRightsOr([$_POST["itemtype"] => UPDATE,
|
||||||
|
"infocom" => UPDATE]);
|
||||||
|
} else {
|
||||||
|
$item->checkGlobal(UPDATE);
|
||||||
|
}
|
||||||
|
|
||||||
|
$inline = false;
|
||||||
|
if (isset($_POST['inline']) && $_POST['inline']) {
|
||||||
|
$inline = true;
|
||||||
|
}
|
||||||
|
$submitname = _sx('button', 'Post');
|
||||||
|
if (isset($_POST['submitname']) && $_POST['submitname']) {
|
||||||
|
$submitname= stripslashes($_POST['submitname']);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if (isset($_POST["itemtype"])
|
||||||
|
&& isset($_POST["id_field"]) && $_POST["id_field"]) {
|
||||||
|
$search = Search::getOptions($_POST["itemtype"]);
|
||||||
|
if (!isset($search[$_POST["id_field"]])) {
|
||||||
|
exit();
|
||||||
|
}
|
||||||
|
|
||||||
|
$search = $search[$_POST["id_field"]];
|
||||||
|
|
||||||
|
echo "<table class='tab_glpi' width='100%'><tr><td>";
|
||||||
|
|
||||||
|
$plugdisplay = false;
|
||||||
|
// Specific plugin Type case
|
||||||
|
if (($plug = isPluginItemType($_POST["itemtype"]))
|
||||||
|
// Specific for plugin which add link to core object
|
||||||
|
|| ($plug = isPluginItemType(getItemTypeForTable($search['table'])))) {
|
||||||
|
$plugdisplay = Plugin::doOneHook($plug['plugin'], 'MassiveActionsFieldsDisplay',
|
||||||
|
['itemtype' => $_POST["itemtype"],
|
||||||
|
'options' => $search]);
|
||||||
|
}
|
||||||
|
|
||||||
|
$fieldname = '';
|
||||||
|
|
||||||
|
if (empty($search["linkfield"])
|
||||||
|
||($search['table'] == 'glpi_infocoms')) {
|
||||||
|
$fieldname = $search["field"];
|
||||||
|
} else {
|
||||||
|
$fieldname = $search["linkfield"];
|
||||||
|
}
|
||||||
|
if (!$plugdisplay) {
|
||||||
|
$options = [];
|
||||||
|
$values = [];
|
||||||
|
// For ticket template or aditional options of massive actions
|
||||||
|
if (isset($_POST['options'])) {
|
||||||
|
$options = $_POST['options'];
|
||||||
|
}
|
||||||
|
if (isset($_POST['additionalvalues'])) {
|
||||||
|
$values = $_POST['additionalvalues'];
|
||||||
|
}
|
||||||
|
$values[$search["field"]] = '';
|
||||||
|
echo $item->getValueToSelect($search, $fieldname, $values, $options);
|
||||||
|
}
|
||||||
|
|
||||||
|
echo "<input type='hidden' name='field' value='$fieldname'>";
|
||||||
|
echo "</td>";
|
||||||
|
if ($inline) {
|
||||||
|
echo "<td><input type='submit' name='massiveaction' class='submit' value='$submitname'></td>";
|
||||||
|
}
|
||||||
|
echo "</tr></table>";
|
||||||
|
|
||||||
|
if (!$inline) {
|
||||||
|
echo "<br><input type='submit' name='massiveaction' class='submit' value='$submitname'>";
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
46
ajax/dropdownMassiveActionOs.php
Normal file
46
ajax/dropdownMassiveActionOs.php
Normal file
@ -0,0 +1,46 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* ---------------------------------------------------------------------
|
||||||
|
* GLPI - Gestionnaire Libre de Parc Informatique
|
||||||
|
* Copyright (C) 2015-2020 Teclib' and contributors.
|
||||||
|
*
|
||||||
|
* http://glpi-project.org
|
||||||
|
*
|
||||||
|
* based on GLPI - Gestionnaire Libre de Parc Informatique
|
||||||
|
* Copyright (C) 2003-2014 by the INDEPNET Development Team.
|
||||||
|
*
|
||||||
|
* ---------------------------------------------------------------------
|
||||||
|
*
|
||||||
|
* LICENSE
|
||||||
|
*
|
||||||
|
* This file is part of GLPI.
|
||||||
|
*
|
||||||
|
* GLPI 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 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* GLPI 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 GLPI. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
* ---------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
|
include ('../inc/includes.php');
|
||||||
|
|
||||||
|
header("Content-Type: text/html; charset=UTF-8");
|
||||||
|
Html::header_nocache();
|
||||||
|
|
||||||
|
Session::checkCentralAccess();
|
||||||
|
|
||||||
|
if (!isset($_POST["itemtype"]) || !($item = getItemForItemtype($_POST['itemtype']))) {
|
||||||
|
exit();
|
||||||
|
}
|
||||||
|
|
||||||
|
$item::dropdown();
|
||||||
|
echo "<br/><input type='submit' name='update' value=\""._sx('button', 'Update')."\" class='submit'>";
|
||||||
|
echo "<br/><input type='submit' name='clone' value=\""._sx('button', 'Clone')."\" class='submit'>";
|
||||||
41
ajax/dropdownNotificationEvent.php
Normal file
41
ajax/dropdownNotificationEvent.php
Normal file
@ -0,0 +1,41 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* ---------------------------------------------------------------------
|
||||||
|
* GLPI - Gestionnaire Libre de Parc Informatique
|
||||||
|
* Copyright (C) 2015-2020 Teclib' and contributors.
|
||||||
|
*
|
||||||
|
* http://glpi-project.org
|
||||||
|
*
|
||||||
|
* based on GLPI - Gestionnaire Libre de Parc Informatique
|
||||||
|
* Copyright (C) 2003-2014 by the INDEPNET Development Team.
|
||||||
|
*
|
||||||
|
* ---------------------------------------------------------------------
|
||||||
|
*
|
||||||
|
* LICENSE
|
||||||
|
*
|
||||||
|
* This file is part of GLPI.
|
||||||
|
*
|
||||||
|
* GLPI 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 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* GLPI 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 GLPI. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
* ---------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
|
if (strpos($_SERVER['PHP_SELF'], "dropdownNotificationEvent.php")) {
|
||||||
|
include ('../inc/includes.php');
|
||||||
|
header("Content-Type: text/html; charset=UTF-8");
|
||||||
|
Html::header_nocache();
|
||||||
|
}
|
||||||
|
|
||||||
|
Session::checkRight("notification", UPDATE);
|
||||||
|
|
||||||
|
NotificationEvent::dropdownEvents(Toolbox::stripslashes_deep($_POST['itemtype']));
|
||||||
41
ajax/dropdownNotificationTemplate.php
Normal file
41
ajax/dropdownNotificationTemplate.php
Normal file
@ -0,0 +1,41 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* ---------------------------------------------------------------------
|
||||||
|
* GLPI - Gestionnaire Libre de Parc Informatique
|
||||||
|
* Copyright (C) 2015-2020 Teclib' and contributors.
|
||||||
|
*
|
||||||
|
* http://glpi-project.org
|
||||||
|
*
|
||||||
|
* based on GLPI - Gestionnaire Libre de Parc Informatique
|
||||||
|
* Copyright (C) 2003-2014 by the INDEPNET Development Team.
|
||||||
|
*
|
||||||
|
* ---------------------------------------------------------------------
|
||||||
|
*
|
||||||
|
* LICENSE
|
||||||
|
*
|
||||||
|
* This file is part of GLPI.
|
||||||
|
*
|
||||||
|
* GLPI 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 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* GLPI 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 GLPI. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
* ---------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
|
if (strpos($_SERVER['PHP_SELF'], "dropdownNotificationTemplate.php")) {
|
||||||
|
include ('../inc/includes.php');
|
||||||
|
header("Content-Type: text/html; charset=UTF-8");
|
||||||
|
Html::header_nocache();
|
||||||
|
}
|
||||||
|
|
||||||
|
Session::checkRight("notification", UPDATE);
|
||||||
|
|
||||||
|
NotificationTemplate::dropdownTemplates('notificationtemplates_id', $_POST['itemtype']);
|
||||||
64
ajax/dropdownProjectTaskTicket.php
Normal file
64
ajax/dropdownProjectTaskTicket.php
Normal file
@ -0,0 +1,64 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* ---------------------------------------------------------------------
|
||||||
|
* GLPI - Gestionnaire Libre de Parc Informatique
|
||||||
|
* Copyright (C) 2015-2017 Teclib' and contributors.
|
||||||
|
*
|
||||||
|
* http://glpi-project.org
|
||||||
|
*
|
||||||
|
* based on GLPI - Gestionnaire Libre de Parc Informatique
|
||||||
|
* Copyright (C) 2003-2014 by the INDEPNET Development Team.
|
||||||
|
*
|
||||||
|
* ---------------------------------------------------------------------
|
||||||
|
*
|
||||||
|
* LICENSE
|
||||||
|
*
|
||||||
|
* This file is part of GLPI.
|
||||||
|
*
|
||||||
|
* GLPI 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 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* GLPI 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 GLPI. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
* ---------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
|
/** @file
|
||||||
|
* @brief
|
||||||
|
*/
|
||||||
|
|
||||||
|
include ('../inc/includes.php');
|
||||||
|
header("Content-Type: text/html; charset=UTF-8");
|
||||||
|
Html::header_nocache();
|
||||||
|
|
||||||
|
Session::checkLoginUser();
|
||||||
|
|
||||||
|
if (isset($_POST["projects_id"])) {
|
||||||
|
$condition = ['glpi_projecttasks.projectstates_id' => ['<>', 3]];
|
||||||
|
|
||||||
|
if ($_POST["projects_id"] > 0) {
|
||||||
|
$condition['glpi_projecttasks.projects_id'] = $_POST['projects_id'];
|
||||||
|
}
|
||||||
|
|
||||||
|
$p = ['itemtype' => ProjectTask::getType(),
|
||||||
|
'entity_restrict' => $_POST['entity_restrict'],
|
||||||
|
'myname' => $_POST["myname"],
|
||||||
|
'condition' => $condition,
|
||||||
|
'rand' => $_POST["rand"]];
|
||||||
|
|
||||||
|
if (isset($_POST["used"]) && !empty($_POST["used"])) {
|
||||||
|
if (isset($_POST["used"])) {
|
||||||
|
$p["used"] = $_POST["used"];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ProjectTask::dropdown($p);
|
||||||
|
|
||||||
|
}
|
||||||
80
ajax/dropdownRubDocument.php
Normal file
80
ajax/dropdownRubDocument.php
Normal file
@ -0,0 +1,80 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* ---------------------------------------------------------------------
|
||||||
|
* GLPI - Gestionnaire Libre de Parc Informatique
|
||||||
|
* Copyright (C) 2015-2020 Teclib' and contributors.
|
||||||
|
*
|
||||||
|
* http://glpi-project.org
|
||||||
|
*
|
||||||
|
* based on GLPI - Gestionnaire Libre de Parc Informatique
|
||||||
|
* Copyright (C) 2003-2014 by the INDEPNET Development Team.
|
||||||
|
*
|
||||||
|
* ---------------------------------------------------------------------
|
||||||
|
*
|
||||||
|
* LICENSE
|
||||||
|
*
|
||||||
|
* This file is part of GLPI.
|
||||||
|
*
|
||||||
|
* GLPI 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 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* GLPI 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 GLPI. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
* ---------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
|
if (strpos($_SERVER['PHP_SELF'], "dropdownRubDocument.php")) {
|
||||||
|
$AJAX_INCLUDE = 1;
|
||||||
|
include ('../inc/includes.php');
|
||||||
|
header("Content-Type: text/html; charset=UTF-8");
|
||||||
|
Html::header_nocache();
|
||||||
|
}
|
||||||
|
|
||||||
|
Session::checkCentralAccess();
|
||||||
|
|
||||||
|
// Make a select box
|
||||||
|
if (isset($_POST["rubdoc"])) {
|
||||||
|
$used = [];
|
||||||
|
|
||||||
|
// Clean used array
|
||||||
|
if (isset($_POST['used']) && is_array($_POST['used']) && (count($_POST['used']) > 0)) {
|
||||||
|
$iterator = $DB->request([
|
||||||
|
'SELECT' => ['id'],
|
||||||
|
'FROM' => 'glpi_documents',
|
||||||
|
'WHERE' => [
|
||||||
|
'id' => $_POST['used'],
|
||||||
|
'documentcategories_id' => (int)$_POST['rubdoc']
|
||||||
|
]
|
||||||
|
]);
|
||||||
|
|
||||||
|
while ($data = $iterator->next()) {
|
||||||
|
$used[$data['id']] = $data['id'];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (preg_match('/[^a-z_\-0-9]/i', $_POST['myname'])) {
|
||||||
|
throw new \RuntimeException('Invalid name provided!');
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!isset($_POST['entity']) || $_POST['entity'] === '') {
|
||||||
|
$_POST['entity'] = $_SESSION['glpiactive_entity'];
|
||||||
|
}
|
||||||
|
|
||||||
|
Dropdown::show(
|
||||||
|
'Document', [
|
||||||
|
'name' => $_POST['myname'],
|
||||||
|
'used' => $used,
|
||||||
|
'width' => '50%',
|
||||||
|
'entity' => intval($_POST['entity']),
|
||||||
|
'rand' => intval($_POST['rand']),
|
||||||
|
'condition' => ['glpi_documents.documentcategories_id' => (int)$_POST["rubdoc"]]
|
||||||
|
]
|
||||||
|
);
|
||||||
|
}
|
||||||
60
ajax/dropdownShowIPNetwork.php
Normal file
60
ajax/dropdownShowIPNetwork.php
Normal file
@ -0,0 +1,60 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* ---------------------------------------------------------------------
|
||||||
|
* GLPI - Gestionnaire Libre de Parc Informatique
|
||||||
|
* Copyright (C) 2015-2020 Teclib' and contributors.
|
||||||
|
*
|
||||||
|
* http://glpi-project.org
|
||||||
|
*
|
||||||
|
* based on GLPI - Gestionnaire Libre de Parc Informatique
|
||||||
|
* Copyright (C) 2003-2014 by the INDEPNET Development Team.
|
||||||
|
*
|
||||||
|
* ---------------------------------------------------------------------
|
||||||
|
*
|
||||||
|
* LICENSE
|
||||||
|
*
|
||||||
|
* This file is part of GLPI.
|
||||||
|
*
|
||||||
|
* GLPI 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 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* GLPI 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 GLPI. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
* ---------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
|
include ('../inc/includes.php');
|
||||||
|
|
||||||
|
header("Content-Type: text/html; charset=UTF-8");
|
||||||
|
Html::header_nocache();
|
||||||
|
|
||||||
|
$network = new IPNetwork();
|
||||||
|
|
||||||
|
if ($network->can($_POST['ipnetworks_id'], READ)) {
|
||||||
|
echo "<br>\n";
|
||||||
|
echo "<a href='".$network->getLinkURL()."'>".$network->fields['completename']."</a><br>\n";
|
||||||
|
|
||||||
|
$address = $network->getAddress()->getTextual();
|
||||||
|
$netmask = $network->getNetmask()->getTextual();
|
||||||
|
$gateway = $network->getGateway()->getTextual();
|
||||||
|
|
||||||
|
$start = new IPAddress();
|
||||||
|
$end = new IPAddress();
|
||||||
|
|
||||||
|
$network->computeNetworkRange($start, $end);
|
||||||
|
|
||||||
|
//TRANS: %1$s is address, %2$s is netmask
|
||||||
|
printf(__('IP network: %1$s/%2$s')."<br>\n", $address, $netmask);
|
||||||
|
printf(__('First/last addresses: %1$s/%2$s'), $start->getTextual(), $end->getTextual());
|
||||||
|
if (!empty($gateway)) {
|
||||||
|
echo "<br>\n";
|
||||||
|
printf(__('Gateway: %s')."\n", $gateway);
|
||||||
|
}
|
||||||
|
}
|
||||||
72
ajax/dropdownSoftwareLicense.php
Normal file
72
ajax/dropdownSoftwareLicense.php
Normal file
@ -0,0 +1,72 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* ---------------------------------------------------------------------
|
||||||
|
* GLPI - Gestionnaire Libre de Parc Informatique
|
||||||
|
* Copyright (C) 2015-2020 Teclib' and contributors.
|
||||||
|
*
|
||||||
|
* http://glpi-project.org
|
||||||
|
*
|
||||||
|
* based on GLPI - Gestionnaire Libre de Parc Informatique
|
||||||
|
* Copyright (C) 2003-2014 by the INDEPNET Development Team.
|
||||||
|
*
|
||||||
|
* ---------------------------------------------------------------------
|
||||||
|
*
|
||||||
|
* LICENSE
|
||||||
|
*
|
||||||
|
* This file is part of GLPI.
|
||||||
|
*
|
||||||
|
* GLPI 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 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* GLPI 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 GLPI. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
* ---------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
|
if (strpos($_SERVER['PHP_SELF'], "dropdownSoftwareLicense.php")) {
|
||||||
|
$AJAX_INCLUDE = 1;
|
||||||
|
include ('../inc/includes.php');
|
||||||
|
header("Content-Type: text/html; charset=UTF-8");
|
||||||
|
Html::header_nocache();
|
||||||
|
}
|
||||||
|
|
||||||
|
Session::checkRight("software", UPDATE);
|
||||||
|
|
||||||
|
if ($_POST['softwares_id'] > 0) {
|
||||||
|
if (!isset($_POST['value'])) {
|
||||||
|
$_POST['value'] = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Make a select box
|
||||||
|
$iterator = $DB->request([
|
||||||
|
'DISTINCT' => true,
|
||||||
|
'FROM' => 'glpi_softwarelicenses',
|
||||||
|
'WHERE' => [
|
||||||
|
'glpi_softwarelicenses.softwares_id' => (int)$_POST['softwares_id']
|
||||||
|
] + getEntitiesRestrictCriteria('glpi_softwarelicenses', 'entities_id', $_POST['entity_restrict'], true),
|
||||||
|
'ORDERBY' => 'name'
|
||||||
|
]);
|
||||||
|
$number = count($iterator);
|
||||||
|
|
||||||
|
$values = [];
|
||||||
|
if ($number) {
|
||||||
|
while ($data = $iterator->next()) {
|
||||||
|
$ID = $data['id'];
|
||||||
|
$output = $data['name'];
|
||||||
|
|
||||||
|
if (empty($output) || $_SESSION['glpiis_ids_visible']) {
|
||||||
|
$output = sprintf(__('%1$s (%2$s)'), $output, $ID);
|
||||||
|
}
|
||||||
|
|
||||||
|
$values[$ID] = $output;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Dropdown::showFromArray($_POST['myname'], $values, ['display_emptychoice' => true]);
|
||||||
|
}
|
||||||
70
ajax/dropdownTicketCategories.php
Normal file
70
ajax/dropdownTicketCategories.php
Normal file
@ -0,0 +1,70 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* ---------------------------------------------------------------------
|
||||||
|
* GLPI - Gestionnaire Libre de Parc Informatique
|
||||||
|
* Copyright (C) 2015-2020 Teclib' and contributors.
|
||||||
|
*
|
||||||
|
* http://glpi-project.org
|
||||||
|
*
|
||||||
|
* based on GLPI - Gestionnaire Libre de Parc Informatique
|
||||||
|
* Copyright (C) 2003-2014 by the INDEPNET Development Team.
|
||||||
|
*
|
||||||
|
* ---------------------------------------------------------------------
|
||||||
|
*
|
||||||
|
* LICENSE
|
||||||
|
*
|
||||||
|
* This file is part of GLPI.
|
||||||
|
*
|
||||||
|
* GLPI 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 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* GLPI 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 GLPI. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
* ---------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
|
if (strpos($_SERVER['PHP_SELF'], "dropdownTicketCategories.php")) {
|
||||||
|
include ('../inc/includes.php');
|
||||||
|
header("Content-Type: text/html; charset=UTF-8");
|
||||||
|
Html::header_nocache();
|
||||||
|
} else if (!defined('GLPI_ROOT')) {
|
||||||
|
die("Sorry. You can't access this file directly");
|
||||||
|
}
|
||||||
|
|
||||||
|
$opt = ['entity' => $_POST["entity_restrict"]];
|
||||||
|
$condition =[];
|
||||||
|
|
||||||
|
if (Session::getCurrentInterface() == "helpdesk") {
|
||||||
|
$condition['is_helpdeskvisible'] = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
$currentcateg = new ITILCategory();
|
||||||
|
$currentcateg->getFromDB($_POST['value']);
|
||||||
|
|
||||||
|
if ($_POST["type"]) {
|
||||||
|
switch ($_POST['type']) {
|
||||||
|
case Ticket::INCIDENT_TYPE :
|
||||||
|
$condition['is_incident'] = 1;
|
||||||
|
if ($currentcateg->getField('is_incident') == 1) {
|
||||||
|
$opt['value'] = $_POST['value'];
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case Ticket::DEMAND_TYPE:
|
||||||
|
$condition['is_request'] = 1;
|
||||||
|
if ($currentcateg->getField('is_request') == 1) {
|
||||||
|
$opt['value'] = $_POST['value'];
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$opt['condition'] = $condition;
|
||||||
|
ITILCategory::dropdown($opt);
|
||||||
100
ajax/dropdownTrackingDeviceType.php
Normal file
100
ajax/dropdownTrackingDeviceType.php
Normal file
@ -0,0 +1,100 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* ---------------------------------------------------------------------
|
||||||
|
* GLPI - Gestionnaire Libre de Parc Informatique
|
||||||
|
* Copyright (C) 2015-2020 Teclib' and contributors.
|
||||||
|
*
|
||||||
|
* http://glpi-project.org
|
||||||
|
*
|
||||||
|
* based on GLPI - Gestionnaire Libre de Parc Informatique
|
||||||
|
* Copyright (C) 2003-2014 by the INDEPNET Development Team.
|
||||||
|
*
|
||||||
|
* ---------------------------------------------------------------------
|
||||||
|
*
|
||||||
|
* LICENSE
|
||||||
|
*
|
||||||
|
* This file is part of GLPI.
|
||||||
|
*
|
||||||
|
* GLPI 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 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* GLPI 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 GLPI. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
* ---------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
|
include ('../inc/includes.php');
|
||||||
|
header("Content-Type: text/html; charset=UTF-8");
|
||||||
|
Html::header_nocache();
|
||||||
|
|
||||||
|
Session::checkLoginUser();
|
||||||
|
|
||||||
|
// Read parameters
|
||||||
|
$context = $_POST['context'] ?? '';
|
||||||
|
$itemtype = $_POST["itemtype"] ?? '';
|
||||||
|
|
||||||
|
// Check for required params
|
||||||
|
if (empty($itemtype)) {
|
||||||
|
http_response_code(400);
|
||||||
|
Toolbox::logWarning("Bad request: itemtype cannot be empty");
|
||||||
|
die;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check if itemtype is valid in the given context
|
||||||
|
if ($context == "impact") {
|
||||||
|
$isValidItemtype = Impact::isEnabled($itemtype);
|
||||||
|
} else {
|
||||||
|
$isValidItemtype = CommonITILObject::isPossibleToAssignType($itemtype);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Make a select box
|
||||||
|
if ($isValidItemtype) {
|
||||||
|
$table = getTableForItemType($itemtype);
|
||||||
|
|
||||||
|
$rand = mt_rand();
|
||||||
|
if (isset($_POST["rand"])) {
|
||||||
|
$rand = $_POST["rand"];
|
||||||
|
}
|
||||||
|
|
||||||
|
// Message for post-only
|
||||||
|
if (!isset($_POST["admin"]) || ($_POST["admin"] == 0)) {
|
||||||
|
echo "<br>".__('Enter the first letters (user, item name, serial or asset number)');
|
||||||
|
}
|
||||||
|
echo "<br>";
|
||||||
|
$field_id = Html::cleanId("dropdown_".$_POST['myname'].$rand);
|
||||||
|
$p = ['itemtype' => $itemtype,
|
||||||
|
'entity_restrict' => $_POST['entity_restrict'],
|
||||||
|
'table' => $table,
|
||||||
|
'multiple' => $_POST["multiple"],
|
||||||
|
'myname' => $_POST["myname"],
|
||||||
|
'rand' => $_POST["rand"]];
|
||||||
|
|
||||||
|
if (isset($_POST["used"]) && !empty($_POST["used"])) {
|
||||||
|
if (isset($_POST["used"][$itemtype])) {
|
||||||
|
$p["used"] = $_POST["used"][$itemtype];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Add context if defined
|
||||||
|
if (!empty($context)) {
|
||||||
|
$p["context"] = $context;
|
||||||
|
}
|
||||||
|
|
||||||
|
echo Html::jsAjaxDropdown($_POST['myname'], $field_id,
|
||||||
|
$CFG_GLPI['root_doc']."/ajax/getDropdownFindNum.php",
|
||||||
|
$p);
|
||||||
|
|
||||||
|
// Auto update summary of active or just solved tickets
|
||||||
|
$params = ['items_id' => '__VALUE__',
|
||||||
|
'itemtype' => $_POST['itemtype']];
|
||||||
|
Ajax::updateItemOnSelectEvent($field_id, "item_ticket_selection_information$rand",
|
||||||
|
$CFG_GLPI["root_doc"]."/ajax/ticketiteminformation.php",
|
||||||
|
$params);
|
||||||
|
}
|
||||||
64
ajax/dropdownTypeCertificates.php
Normal file
64
ajax/dropdownTypeCertificates.php
Normal file
@ -0,0 +1,64 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* ---------------------------------------------------------------------
|
||||||
|
* GLPI - Gestionnaire Libre de Parc Informatique
|
||||||
|
* Copyright (C) 2015-2020 Teclib' and contributors.
|
||||||
|
*
|
||||||
|
* http://glpi-project.org
|
||||||
|
*
|
||||||
|
* based on GLPI - Gestionnaire Libre de Parc Informatique
|
||||||
|
* Copyright (C) 2003-2014 by the INDEPNET Development Team.
|
||||||
|
*
|
||||||
|
* ---------------------------------------------------------------------
|
||||||
|
*
|
||||||
|
* LICENSE
|
||||||
|
*
|
||||||
|
* This file is part of GLPI.
|
||||||
|
*
|
||||||
|
* GLPI 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 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* GLPI 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 GLPI. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
* ---------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
|
if (strpos($_SERVER['PHP_SELF'], "dropdownTypeCertificates.php")) {
|
||||||
|
$AJAX_INCLUDE = 1;
|
||||||
|
include('../inc/includes.php');
|
||||||
|
header("Content-Type: text/html; charset=UTF-8");
|
||||||
|
Html::header_nocache();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Session::checkCentralAccess();
|
||||||
|
|
||||||
|
// Make a select box
|
||||||
|
$used = [];
|
||||||
|
|
||||||
|
// Clean used array
|
||||||
|
if (isset($_POST['used'])
|
||||||
|
&& is_array($_POST['used'])
|
||||||
|
&& (count($_POST['used']) > 0)) {
|
||||||
|
foreach ($DB->request('glpi_certificates',
|
||||||
|
['id' => $_POST['used'],
|
||||||
|
'certificatetypes_id' => $_POST['certificatetype']
|
||||||
|
]) as $data) {
|
||||||
|
$used[$data['id']] = $data['id'];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Dropdown::show('Certificate',
|
||||||
|
['name' => $_POST['name'],
|
||||||
|
'used' => $used,
|
||||||
|
'width' => '50%',
|
||||||
|
'entity' => $_POST['entity'],
|
||||||
|
'rand' => $_POST['rand'],
|
||||||
|
]);
|
||||||
48
ajax/dropdownUnicityFields.php
Normal file
48
ajax/dropdownUnicityFields.php
Normal file
@ -0,0 +1,48 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* ---------------------------------------------------------------------
|
||||||
|
* GLPI - Gestionnaire Libre de Parc Informatique
|
||||||
|
* Copyright (C) 2015-2020 Teclib' and contributors.
|
||||||
|
*
|
||||||
|
* http://glpi-project.org
|
||||||
|
*
|
||||||
|
* based on GLPI - Gestionnaire Libre de Parc Informatique
|
||||||
|
* Copyright (C) 2003-2014 by the INDEPNET Development Team.
|
||||||
|
*
|
||||||
|
* ---------------------------------------------------------------------
|
||||||
|
*
|
||||||
|
* LICENSE
|
||||||
|
*
|
||||||
|
* This file is part of GLPI.
|
||||||
|
*
|
||||||
|
* GLPI 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 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* GLPI 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 GLPI. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
* ---------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
|
if (strpos($_SERVER['PHP_SELF'], "dropdownUnicityFields.php")) {
|
||||||
|
include ('../inc/includes.php');
|
||||||
|
header("Content-Type: text/html; charset=UTF-8");
|
||||||
|
Html::header_nocache();
|
||||||
|
}
|
||||||
|
|
||||||
|
Session::checkRight("config", UPDATE);
|
||||||
|
|
||||||
|
$field = new FieldUnicity();
|
||||||
|
if ($_POST['id'] > 0) {
|
||||||
|
$field->getFromDB($_POST['id']);
|
||||||
|
} else {
|
||||||
|
$field->getEmpty();
|
||||||
|
$field->fields['itemtype'] = $_POST['itemtype'];
|
||||||
|
}
|
||||||
|
FieldUnicity::selectCriterias($field);
|
||||||
144
ajax/dropdownValidator.php
Normal file
144
ajax/dropdownValidator.php
Normal file
@ -0,0 +1,144 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* ---------------------------------------------------------------------
|
||||||
|
* GLPI - Gestionnaire Libre de Parc Informatique
|
||||||
|
* Copyright (C) 2015-2020 Teclib' and contributors.
|
||||||
|
*
|
||||||
|
* http://glpi-project.org
|
||||||
|
*
|
||||||
|
* based on GLPI - Gestionnaire Libre de Parc Informatique
|
||||||
|
* Copyright (C) 2003-2014 by the INDEPNET Development Team.
|
||||||
|
*
|
||||||
|
* ---------------------------------------------------------------------
|
||||||
|
*
|
||||||
|
* LICENSE
|
||||||
|
*
|
||||||
|
* This file is part of GLPI.
|
||||||
|
*
|
||||||
|
* GLPI 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 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* GLPI 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 GLPI. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
* ---------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @since 0.85
|
||||||
|
*/
|
||||||
|
|
||||||
|
$AJAX_INCLUDE = 1;
|
||||||
|
include ('../inc/includes.php');
|
||||||
|
|
||||||
|
header("Content-Type: text/html; charset=UTF-8");
|
||||||
|
Html::header_nocache();
|
||||||
|
|
||||||
|
if (isset($_POST["validatortype"])) {
|
||||||
|
switch ($_POST["validatortype"]) {
|
||||||
|
case 'user' :
|
||||||
|
if (isset($_POST['users_id_validate']['groups_id'])) {
|
||||||
|
$_POST['users_id_validate'] = [];
|
||||||
|
}
|
||||||
|
$value = (isset($_POST['users_id_validate'][0]) ? $_POST['users_id_validate'][0] : 0);
|
||||||
|
User::dropdown(['name' => !empty($_POST['name']) ? $_POST['name'].'[]'
|
||||||
|
:'users_id_validate[]',
|
||||||
|
'entity' => $_POST['entity'],
|
||||||
|
'value' => $value,
|
||||||
|
'right' => $_POST['right']]);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'group' :
|
||||||
|
$name = !empty($_POST['name']) ? $_POST['name'].'[groups_id]':'groups_id';
|
||||||
|
$value = (isset($_POST['users_id_validate']['groups_id']) ? $_POST['users_id_validate']['groups_id'] : $_POST['groups_id']);
|
||||||
|
|
||||||
|
$rand = Group::dropdown(['name' => $name,
|
||||||
|
'value' => $value,
|
||||||
|
'entity' => $_POST["entity"]]);
|
||||||
|
|
||||||
|
$param = ['validatortype' => 'list_users'];
|
||||||
|
$param['name'] = !empty($_POST['name']) ? $_POST['name'] : '';
|
||||||
|
$param['users_id_validate'] = isset($_POST['users_id_validate'])
|
||||||
|
? $_POST['users_id_validate'] : '';
|
||||||
|
$param['right'] = $_POST['right'];
|
||||||
|
$param['entity'] = $_POST["entity"];
|
||||||
|
$param['groups_id'] = '__VALUE__';
|
||||||
|
Ajax::updateItemOnSelectEvent("dropdown_$name$rand", "show_list_users",
|
||||||
|
$CFG_GLPI["root_doc"]."/ajax/dropdownValidator.php",
|
||||||
|
$param);
|
||||||
|
if ($value) {
|
||||||
|
$param['validatortype'] = 'list_users';
|
||||||
|
$param['groups_id'] = $value;
|
||||||
|
unset($param['users_id_validate']['groups_id']);
|
||||||
|
Ajax::updateItem('show_list_users', $CFG_GLPI["root_doc"]."/ajax/dropdownValidator.php",
|
||||||
|
$param);
|
||||||
|
}
|
||||||
|
echo "<br><span id='show_list_users'> </span>\n";
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'list_users' :
|
||||||
|
if (isset($_POST['users_id_validate']['groups_id'])) {
|
||||||
|
$_POST['users_id_validate'] = [];
|
||||||
|
}
|
||||||
|
$opt = ['groups_id' => $_POST["groups_id"],
|
||||||
|
'right' => $_POST['right'],
|
||||||
|
'entity' => $_POST["entity"]];
|
||||||
|
$data_users = TicketValidation::getGroupUserHaveRights($opt);
|
||||||
|
$users = [];
|
||||||
|
$param['values'] = [];
|
||||||
|
$values = [];
|
||||||
|
if (isset($_POST['users_id_validate']) && is_array($_POST['users_id_validate'])) {
|
||||||
|
$values = $_POST['users_id_validate'];
|
||||||
|
}
|
||||||
|
foreach ($data_users as $data) {
|
||||||
|
$users[$data['id']] = formatUserName($data['id'], $data['name'], $data['realname'],
|
||||||
|
$data['firstname']);
|
||||||
|
if (in_array($data['id'], $values)) {
|
||||||
|
$param['values'][] = $data['id'];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Display all users
|
||||||
|
if (isset($_POST['all_users'])
|
||||||
|
&& $_POST['all_users']) {
|
||||||
|
$param['values'] = array_keys($users);
|
||||||
|
}
|
||||||
|
$param['multiple']= true;
|
||||||
|
$param['display'] = true;
|
||||||
|
$param['size'] = count($users);
|
||||||
|
|
||||||
|
$users = Toolbox::stripslashes_deep($users);
|
||||||
|
$rand = Dropdown::showFromArray(!empty($_POST['name']) ? $_POST['name']:'users_id_validate',
|
||||||
|
$users, $param);
|
||||||
|
|
||||||
|
// Display all/none buttons to select all or no users in group
|
||||||
|
if (!empty($_POST['groups_id'])) {
|
||||||
|
echo "<br><br><a id='all_users' class='vsubmit'>".__('All')."</a>";
|
||||||
|
$param_button = [
|
||||||
|
'validatortype' => 'list_users',
|
||||||
|
'name' => !empty($_POST['name']) ? $_POST['name']:'',
|
||||||
|
'users_id_validate' => '',
|
||||||
|
'all_users' => 1,
|
||||||
|
'groups_id' => $_POST['groups_id'],
|
||||||
|
'entity' => $_POST['entity'],
|
||||||
|
'right' => $_POST['right'],
|
||||||
|
];
|
||||||
|
Ajax::updateItemOnEvent('all_users', 'show_list_users',
|
||||||
|
$CFG_GLPI["root_doc"]."/ajax/dropdownValidator.php",
|
||||||
|
$param_button, ['click']);
|
||||||
|
|
||||||
|
echo " <a id='no_users' class='vsubmit'>".__('None')."</a>";
|
||||||
|
$param_button['all_users'] = 0;
|
||||||
|
Ajax::updateItemOnEvent('no_users', 'show_list_users',
|
||||||
|
$CFG_GLPI["root_doc"]."/ajax/dropdownValidator.php",
|
||||||
|
$param_button, ['click']);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
52
ajax/dropdownValuesBlacklist.php
Normal file
52
ajax/dropdownValuesBlacklist.php
Normal file
@ -0,0 +1,52 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* ---------------------------------------------------------------------
|
||||||
|
* GLPI - Gestionnaire Libre de Parc Informatique
|
||||||
|
* Copyright (C) 2015-2020 Teclib' and contributors.
|
||||||
|
*
|
||||||
|
* http://glpi-project.org
|
||||||
|
*
|
||||||
|
* based on GLPI - Gestionnaire Libre de Parc Informatique
|
||||||
|
* Copyright (C) 2003-2014 by the INDEPNET Development Team.
|
||||||
|
*
|
||||||
|
* ---------------------------------------------------------------------
|
||||||
|
*
|
||||||
|
* LICENSE
|
||||||
|
*
|
||||||
|
* This file is part of GLPI.
|
||||||
|
*
|
||||||
|
* GLPI 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 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* GLPI 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 GLPI. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
* ---------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
|
if (strpos($_SERVER['PHP_SELF'], "dropdownValuesBlacklist.php")) {
|
||||||
|
include ('../inc/includes.php');
|
||||||
|
header("Content-Type: text/html; charset=UTF-8");
|
||||||
|
Html::header_nocache();
|
||||||
|
}
|
||||||
|
|
||||||
|
Session::checkRight("config", UPDATE);
|
||||||
|
if (isset($_POST['itemtype'])
|
||||||
|
&& isset($_POST['id_field'])) {
|
||||||
|
|
||||||
|
$blacklist = new Fieldblacklist();
|
||||||
|
if (isset($_POST['id']) && ($_POST['id'] > 0)) {
|
||||||
|
$blacklist->getFromDB($_POST['id']);
|
||||||
|
} else {
|
||||||
|
$blacklist->getEmpty();
|
||||||
|
}
|
||||||
|
$blacklist->fields['field'] = $_POST['id_field'];
|
||||||
|
$blacklist->fields['itemtype'] = $_POST['itemtype'];
|
||||||
|
$blacklist->selectValues($_POST['id_field']);
|
||||||
|
}
|
||||||
101
ajax/entityCustomCssCode.php
Normal file
101
ajax/entityCustomCssCode.php
Normal file
@ -0,0 +1,101 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* ---------------------------------------------------------------------
|
||||||
|
* GLPI - Gestionnaire Libre de Parc Informatique
|
||||||
|
* Copyright (C) 2015-2020 Teclib' and contributors.
|
||||||
|
*
|
||||||
|
* http://glpi-project.org
|
||||||
|
*
|
||||||
|
* based on GLPI - Gestionnaire Libre de Parc Informatique
|
||||||
|
* Copyright (C) 2003-2014 by the INDEPNET Development Team.
|
||||||
|
*
|
||||||
|
* ---------------------------------------------------------------------
|
||||||
|
*
|
||||||
|
* LICENSE
|
||||||
|
*
|
||||||
|
* This file is part of GLPI.
|
||||||
|
*
|
||||||
|
* GLPI 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 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* GLPI 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 GLPI. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
* ---------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
|
// Direct access to file
|
||||||
|
if (strpos($_SERVER['PHP_SELF'], 'entityCustomCssCode.php')) {
|
||||||
|
$AJAX_INCLUDE = 1;
|
||||||
|
include ('../inc/includes.php');
|
||||||
|
header("Content-Type: text/html; charset=UTF-8");
|
||||||
|
Html::header_nocache();
|
||||||
|
}
|
||||||
|
|
||||||
|
$entity = new Entity();
|
||||||
|
$entity->getFromDB($_POST['entities_id']);
|
||||||
|
|
||||||
|
if (isset($_POST['enable_custom_css']) && isset($_POST['entities_id'])) {
|
||||||
|
$enable_custom_css = $_POST['enable_custom_css'] == '1';
|
||||||
|
|
||||||
|
if (Entity::CONFIG_PARENT == $_POST['enable_custom_css']) {
|
||||||
|
$custom_css_code = Entity::getUsedConfig(
|
||||||
|
'enable_custom_css',
|
||||||
|
$entity->fields['entities_id'],
|
||||||
|
'custom_css_code',
|
||||||
|
''
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
$custom_css_code = $entity->fields['custom_css_code'];
|
||||||
|
}
|
||||||
|
|
||||||
|
$rand = mt_rand();
|
||||||
|
|
||||||
|
echo '<textarea id="custom_css_code_'. $rand . '" name="custom_css_code" ';
|
||||||
|
if (!$enable_custom_css) {
|
||||||
|
echo 'disabled';
|
||||||
|
}
|
||||||
|
echo '>';
|
||||||
|
echo Html::entities_deep($custom_css_code);
|
||||||
|
echo '</textarea>';
|
||||||
|
|
||||||
|
$editor_options = [
|
||||||
|
'mode' => 'text/css',
|
||||||
|
'lineNumbers' => true,
|
||||||
|
|
||||||
|
// Autocomplete with CTRL+SPACE
|
||||||
|
'extraKeys' => [
|
||||||
|
'Ctrl-Space' => 'autocomplete',
|
||||||
|
],
|
||||||
|
|
||||||
|
// Code folding configuration
|
||||||
|
'foldGutter' => true,
|
||||||
|
'gutters' => [
|
||||||
|
'CodeMirror-linenumbers',
|
||||||
|
'CodeMirror-foldgutter'
|
||||||
|
],
|
||||||
|
];
|
||||||
|
if (!$enable_custom_css) {
|
||||||
|
$editor_options['readOnly'] = 'nocursor'; // readonly and no type cursor if input disabled
|
||||||
|
}
|
||||||
|
|
||||||
|
echo Html::scriptBlock('
|
||||||
|
$(function() {
|
||||||
|
var textarea = document.getElementById("custom_css_code_' . $rand . '");
|
||||||
|
var editor = CodeMirror.fromTextArea(textarea, ' . json_encode($editor_options) . ');
|
||||||
|
|
||||||
|
// Fix bad display of gutter (see https://github.com/codemirror/CodeMirror/issues/3098 )
|
||||||
|
setTimeout(function () {editor.refresh();}, 10);
|
||||||
|
|
||||||
|
if (' . (!$enable_custom_css ? 'true' : 'false') . ') {
|
||||||
|
$(textarea).siblings(".CodeMirror").addClass("input-disabled");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
');
|
||||||
|
}
|
||||||
46
ajax/entitytree.php
Normal file
46
ajax/entitytree.php
Normal file
@ -0,0 +1,46 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* ---------------------------------------------------------------------
|
||||||
|
* GLPI - Gestionnaire Libre de Parc Informatique
|
||||||
|
* Copyright (C) 2015-2020 Teclib' and contributors.
|
||||||
|
*
|
||||||
|
* http://glpi-project.org
|
||||||
|
*
|
||||||
|
* based on GLPI - Gestionnaire Libre de Parc Informatique
|
||||||
|
* Copyright (C) 2003-2014 by the INDEPNET Development Team.
|
||||||
|
*
|
||||||
|
* ---------------------------------------------------------------------
|
||||||
|
*
|
||||||
|
* LICENSE
|
||||||
|
*
|
||||||
|
* This file is part of GLPI.
|
||||||
|
*
|
||||||
|
* GLPI 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 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* GLPI 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 GLPI. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
* ---------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
|
$AJAX_INCLUDE = 1;
|
||||||
|
include ('../inc/includes.php');
|
||||||
|
|
||||||
|
header("Content-Type: text/html; charset=UTF-8");
|
||||||
|
Html::header_nocache();
|
||||||
|
|
||||||
|
Session::checkLoginUser();
|
||||||
|
if (!isset($_POST['target'])) {
|
||||||
|
$_POST['target'] = $CFG_GLPI['root_doc']."/front/central.php";
|
||||||
|
}
|
||||||
|
|
||||||
|
Entity::showSelector($_POST['target'], "activeentity");
|
||||||
|
|
||||||
|
Html::ajaxFooter();
|
||||||
74
ajax/entitytreesearch.php
Normal file
74
ajax/entitytreesearch.php
Normal file
@ -0,0 +1,74 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* ---------------------------------------------------------------------
|
||||||
|
* GLPI - Gestionnaire Libre de Parc Informatique
|
||||||
|
* Copyright (C) 2015-2020 Teclib' and contributors.
|
||||||
|
*
|
||||||
|
* http://glpi-project.org
|
||||||
|
*
|
||||||
|
* based on GLPI - Gestionnaire Libre de Parc Informatique
|
||||||
|
* Copyright (C) 2003-2014 by the INDEPNET Development Team.
|
||||||
|
*
|
||||||
|
* ---------------------------------------------------------------------
|
||||||
|
*
|
||||||
|
* LICENSE
|
||||||
|
*
|
||||||
|
* This file is part of GLPI.
|
||||||
|
*
|
||||||
|
* GLPI 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 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* GLPI 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 GLPI. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
* ---------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @since 0.85
|
||||||
|
*/
|
||||||
|
|
||||||
|
$AJAX_INCLUDE = 1;
|
||||||
|
|
||||||
|
include ("../inc/includes.php");
|
||||||
|
|
||||||
|
header("Content-Type: application/json; charset=UTF-8");
|
||||||
|
Html::header_nocache();
|
||||||
|
|
||||||
|
Session::checkLoginUser();
|
||||||
|
$res = [];
|
||||||
|
|
||||||
|
$root_entities_for_profiles = array_column($_SESSION['glpiactiveprofile']['entities'], 'id');
|
||||||
|
|
||||||
|
if (isset($_POST['str'])) {
|
||||||
|
$iterator = $DB->request([
|
||||||
|
'FROM' => 'glpi_entities',
|
||||||
|
'WHERE' => [
|
||||||
|
'name' => ['LIKE', '%' . $_POST['str'] . '%']
|
||||||
|
],
|
||||||
|
'ORDER' => ['completename']
|
||||||
|
]);
|
||||||
|
|
||||||
|
while ($data = $iterator->next()) {
|
||||||
|
$ancestors = getAncestorsOf('glpi_entities', $data['id']);
|
||||||
|
foreach ($ancestors as $val) {
|
||||||
|
if (!in_array($val, $res)) {
|
||||||
|
// root nodes are suffixed by, id are uniques in jstree.
|
||||||
|
// so, in case of presence of this id in subtree of other nodes,
|
||||||
|
// it will be removed from root nodes
|
||||||
|
if (in_array($val, $root_entities_for_profiles)) {
|
||||||
|
$val.= 'r';
|
||||||
|
}
|
||||||
|
$res[] = $val;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$res = json_encode($res);
|
||||||
|
echo $res;
|
||||||
122
ajax/entitytreesons.php
Normal file
122
ajax/entitytreesons.php
Normal file
@ -0,0 +1,122 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* ---------------------------------------------------------------------
|
||||||
|
* GLPI - Gestionnaire Libre de Parc Informatique
|
||||||
|
* Copyright (C) 2015-2020 Teclib' and contributors.
|
||||||
|
*
|
||||||
|
* http://glpi-project.org
|
||||||
|
*
|
||||||
|
* based on GLPI - Gestionnaire Libre de Parc Informatique
|
||||||
|
* Copyright (C) 2003-2014 by the INDEPNET Development Team.
|
||||||
|
*
|
||||||
|
* ---------------------------------------------------------------------
|
||||||
|
*
|
||||||
|
* LICENSE
|
||||||
|
*
|
||||||
|
* This file is part of GLPI.
|
||||||
|
*
|
||||||
|
* GLPI 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 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* GLPI 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 GLPI. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
* ---------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
|
$AJAX_INCLUDE = 1;
|
||||||
|
|
||||||
|
include ("../inc/includes.php");
|
||||||
|
|
||||||
|
header("Content-Type: application/json; charset=UTF-8");
|
||||||
|
Html::header_nocache();
|
||||||
|
|
||||||
|
Session::checkLoginUser();
|
||||||
|
|
||||||
|
if (isset($_GET['node'])) {
|
||||||
|
$nodes = [];
|
||||||
|
|
||||||
|
// Get ancestors of current entity
|
||||||
|
$ancestors = getAncestorsOf('glpi_entities', $_SESSION['glpiactive_entity']);
|
||||||
|
|
||||||
|
// Root node
|
||||||
|
if ($_GET['node'] == -1) {
|
||||||
|
foreach ($_SESSION['glpiactiveprofile']['entities'] as $entity) {
|
||||||
|
$ID = $entity['id'];
|
||||||
|
$is_recursive = $entity['is_recursive'];
|
||||||
|
|
||||||
|
$path = [
|
||||||
|
// append r for root nodes, id are uniques in jstree.
|
||||||
|
// so, in case of presence of this id in subtree of other nodes,
|
||||||
|
// it will be removed from root nodes
|
||||||
|
'id' => $ID.'r',
|
||||||
|
'text' => Dropdown::getDropdownName("glpi_entities", $ID)
|
||||||
|
];
|
||||||
|
|
||||||
|
if ($is_recursive) {
|
||||||
|
$result2 = $DB->request([
|
||||||
|
'FROM' => 'glpi_entities',
|
||||||
|
'COUNT' => 'cpt',
|
||||||
|
'WHERE' => ['entities_id' => $ID]
|
||||||
|
]);
|
||||||
|
$result2 = $result2->next();
|
||||||
|
if ($result2['cpt'] > 0) {
|
||||||
|
$path['children'] = true;
|
||||||
|
//apend a i tag (one of shortest tags) to have the is_recursive link
|
||||||
|
$path['text'].= '<i/>';
|
||||||
|
if (isset($ancestors[$ID])) {
|
||||||
|
$path['state']['opened'] = 'true';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$nodes[] = $path;
|
||||||
|
}
|
||||||
|
} else { // standard node
|
||||||
|
$node_id = $_GET['node'];
|
||||||
|
$iterator = $DB->request([
|
||||||
|
'SELECT' => [
|
||||||
|
'ent.id',
|
||||||
|
'ent.name',
|
||||||
|
'ent.sons_cache',
|
||||||
|
'COUNT' => 'sub_entities.id AS nb_subs'
|
||||||
|
],
|
||||||
|
'FROM' => 'glpi_entities AS ent',
|
||||||
|
'LEFT JOIN' => [
|
||||||
|
'glpi_entities AS sub_entities' => [
|
||||||
|
'ON' => [
|
||||||
|
'sub_entities' => 'entities_id',
|
||||||
|
'ent' => 'id'
|
||||||
|
]
|
||||||
|
]
|
||||||
|
],
|
||||||
|
'WHERE' => ['ent.entities_id' => $node_id],
|
||||||
|
'GROUPBY' => ['ent.id', 'ent.name', 'ent.sons_cache'],
|
||||||
|
'ORDERBY' => 'name'
|
||||||
|
]);
|
||||||
|
|
||||||
|
while ($row = $iterator->next()) {
|
||||||
|
$path = [
|
||||||
|
'id' => $row['id'],
|
||||||
|
'text' => $row['name']
|
||||||
|
];
|
||||||
|
|
||||||
|
if ($row['nb_subs'] > 0) {
|
||||||
|
//apend a i tag (one of shortest tags) to have the is_recursive link
|
||||||
|
$path['text'].= '<i/>';
|
||||||
|
$path['children'] = true;
|
||||||
|
|
||||||
|
if (isset($ancestors[$row['id']])) {
|
||||||
|
$path['state']['opened'] = 'true';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$nodes[] = $path;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
echo json_encode($nodes);
|
||||||
|
}
|
||||||
7334
ajax/error_log
Normal file
7334
ajax/error_log
Normal file
File diff suppressed because it is too large
Load Diff
40
ajax/fileupload.php
Normal file
40
ajax/fileupload.php
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* ---------------------------------------------------------------------
|
||||||
|
* GLPI - Gestionnaire Libre de Parc Informatique
|
||||||
|
* Copyright (C) 2015-2020 Teclib' and contributors.
|
||||||
|
*
|
||||||
|
* http://glpi-project.org
|
||||||
|
*
|
||||||
|
* based on GLPI - Gestionnaire Libre de Parc Informatique
|
||||||
|
* Copyright (C) 2003-2014 by the INDEPNET Development Team.
|
||||||
|
*
|
||||||
|
* ---------------------------------------------------------------------
|
||||||
|
*
|
||||||
|
* LICENSE
|
||||||
|
*
|
||||||
|
* This file is part of GLPI.
|
||||||
|
*
|
||||||
|
* GLPI 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 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* GLPI 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 GLPI. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
* ---------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @since 9.2
|
||||||
|
*/
|
||||||
|
|
||||||
|
include ('../inc/includes.php');
|
||||||
|
|
||||||
|
Session::checkLoginUser();
|
||||||
|
GLPIUploadHandler::uploadFiles($_REQUEST);
|
||||||
40
ajax/fuzzysearch.php
Normal file
40
ajax/fuzzysearch.php
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* ---------------------------------------------------------------------
|
||||||
|
* GLPI - Gestionnaire Libre de Parc Informatique
|
||||||
|
* Copyright (C) 2015-2020 Teclib' and contributors.
|
||||||
|
*
|
||||||
|
* http://glpi-project.org
|
||||||
|
*
|
||||||
|
* based on GLPI - Gestionnaire Libre de Parc Informatique
|
||||||
|
* Copyright (C) 2003-2014 by the INDEPNET Development Team.
|
||||||
|
*
|
||||||
|
* ---------------------------------------------------------------------
|
||||||
|
*
|
||||||
|
* LICENSE
|
||||||
|
*
|
||||||
|
* This file is part of GLPI.
|
||||||
|
*
|
||||||
|
* GLPI 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 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* GLPI 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 GLPI. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
* ---------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
|
$AJAX_INCLUDE = 1;
|
||||||
|
include ('../inc/includes.php');
|
||||||
|
header("Content-Type: text/html; charset=UTF-8");
|
||||||
|
Html::header_nocache();
|
||||||
|
|
||||||
|
Session::checkLoginUser();
|
||||||
|
|
||||||
|
echo Html::fuzzySearch($_REQUEST['action']);
|
||||||
52
ajax/genericdate.php
Normal file
52
ajax/genericdate.php
Normal file
@ -0,0 +1,52 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* ---------------------------------------------------------------------
|
||||||
|
* GLPI - Gestionnaire Libre de Parc Informatique
|
||||||
|
* Copyright (C) 2015-2020 Teclib' and contributors.
|
||||||
|
*
|
||||||
|
* http://glpi-project.org
|
||||||
|
*
|
||||||
|
* based on GLPI - Gestionnaire Libre de Parc Informatique
|
||||||
|
* Copyright (C) 2003-2014 by the INDEPNET Development Team.
|
||||||
|
*
|
||||||
|
* ---------------------------------------------------------------------
|
||||||
|
*
|
||||||
|
* LICENSE
|
||||||
|
*
|
||||||
|
* This file is part of GLPI.
|
||||||
|
*
|
||||||
|
* GLPI 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 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* GLPI 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 GLPI. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
* ---------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
|
$AJAX_INCLUDE = 1;
|
||||||
|
include ('../inc/includes.php');
|
||||||
|
|
||||||
|
// Send UTF8 Headers
|
||||||
|
header("Content-Type: text/html; charset=UTF-8");
|
||||||
|
Html::header_nocache();
|
||||||
|
|
||||||
|
Session::checkLoginUser();
|
||||||
|
|
||||||
|
if (isset($_POST['value']) && (strcmp($_POST['value'], '0') == 0)) {
|
||||||
|
|
||||||
|
if ($_POST['withtime']) {
|
||||||
|
Html::showDateTimeField($_POST['name'], ['value' => $_POST['specificvalue']]);
|
||||||
|
} else {
|
||||||
|
Html::showDateField($_POST['name'], ['value' => $_POST['specificvalue']]);
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
echo "<input type='hidden' name='".$_POST['name']."' value='".$_POST['value']."'>";
|
||||||
|
}
|
||||||
45
ajax/getDropdownConnect.php
Normal file
45
ajax/getDropdownConnect.php
Normal file
@ -0,0 +1,45 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* ---------------------------------------------------------------------
|
||||||
|
* GLPI - Gestionnaire Libre de Parc Informatique
|
||||||
|
* Copyright (C) 2015-2020 Teclib' and contributors.
|
||||||
|
*
|
||||||
|
* http://glpi-project.org
|
||||||
|
*
|
||||||
|
* based on GLPI - Gestionnaire Libre de Parc Informatique
|
||||||
|
* Copyright (C) 2003-2014 by the INDEPNET Development Team.
|
||||||
|
*
|
||||||
|
* ---------------------------------------------------------------------
|
||||||
|
*
|
||||||
|
* LICENSE
|
||||||
|
*
|
||||||
|
* This file is part of GLPI.
|
||||||
|
*
|
||||||
|
* GLPI 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 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* GLPI 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 GLPI. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
* ---------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @since 0.85
|
||||||
|
*/
|
||||||
|
|
||||||
|
if (strpos($_SERVER['PHP_SELF'], "getDropdownConnect.php")) {
|
||||||
|
include ('../inc/includes.php');
|
||||||
|
header("Content-Type: application/json; charset=UTF-8");
|
||||||
|
Html::header_nocache();
|
||||||
|
} else if (!defined('GLPI_ROOT')) {
|
||||||
|
die("Sorry. You can't access this file directly");
|
||||||
|
}
|
||||||
|
|
||||||
|
echo Dropdown::getDropdownConnect($_POST);
|
||||||
44
ajax/getDropdownFindNum.php
Normal file
44
ajax/getDropdownFindNum.php
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* ---------------------------------------------------------------------
|
||||||
|
* GLPI - Gestionnaire Libre de Parc Informatique
|
||||||
|
* Copyright (C) 2015-2020 Teclib' and contributors.
|
||||||
|
*
|
||||||
|
* http://glpi-project.org
|
||||||
|
*
|
||||||
|
* based on GLPI - Gestionnaire Libre de Parc Informatique
|
||||||
|
* Copyright (C) 2003-2014 by the INDEPNET Development Team.
|
||||||
|
*
|
||||||
|
* ---------------------------------------------------------------------
|
||||||
|
*
|
||||||
|
* LICENSE
|
||||||
|
*
|
||||||
|
* This file is part of GLPI.
|
||||||
|
*
|
||||||
|
* GLPI 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 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* GLPI 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 GLPI. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
* ---------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* List of device for tracking.
|
||||||
|
* @since 0.85
|
||||||
|
*/
|
||||||
|
|
||||||
|
include ('../inc/includes.php');
|
||||||
|
|
||||||
|
header("Content-Type: application/json; charset=UTF-8");
|
||||||
|
Html::header_nocache();
|
||||||
|
|
||||||
|
Session::checkLoginUser();
|
||||||
|
echo Dropdown::getDropdownFindNum($_POST);
|
||||||
48
ajax/getDropdownNetpoint.php
Normal file
48
ajax/getDropdownNetpoint.php
Normal file
@ -0,0 +1,48 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* ---------------------------------------------------------------------
|
||||||
|
* GLPI - Gestionnaire Libre de Parc Informatique
|
||||||
|
* Copyright (C) 2015-2020 Teclib' and contributors.
|
||||||
|
*
|
||||||
|
* http://glpi-project.org
|
||||||
|
*
|
||||||
|
* based on GLPI - Gestionnaire Libre de Parc Informatique
|
||||||
|
* Copyright (C) 2003-2014 by the INDEPNET Development Team.
|
||||||
|
*
|
||||||
|
* ---------------------------------------------------------------------
|
||||||
|
*
|
||||||
|
* LICENSE
|
||||||
|
*
|
||||||
|
* This file is part of GLPI.
|
||||||
|
*
|
||||||
|
* GLPI 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 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* GLPI 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 GLPI. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
* ---------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @since 0.85
|
||||||
|
*/
|
||||||
|
|
||||||
|
// Direct access to file
|
||||||
|
if (strpos($_SERVER['PHP_SELF'], "getDropdownNetpoint.php")) {
|
||||||
|
$AJAX_INCLUDE = 1;
|
||||||
|
include ('../inc/includes.php');
|
||||||
|
header("Content-Type: application/json; charset=UTF-8");
|
||||||
|
Html::header_nocache();
|
||||||
|
} else if (!defined('GLPI_ROOT')) {
|
||||||
|
die("Sorry. You can't access this file directly");
|
||||||
|
}
|
||||||
|
|
||||||
|
Session::checkLoginUser();
|
||||||
|
echo Dropdown::getDropdownNetpoint($_POST);
|
||||||
47
ajax/getDropdownNumber.php
Normal file
47
ajax/getDropdownNumber.php
Normal file
@ -0,0 +1,47 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* ---------------------------------------------------------------------
|
||||||
|
* GLPI - Gestionnaire Libre de Parc Informatique
|
||||||
|
* Copyright (C) 2015-2020 Teclib' and contributors.
|
||||||
|
*
|
||||||
|
* http://glpi-project.org
|
||||||
|
*
|
||||||
|
* based on GLPI - Gestionnaire Libre de Parc Informatique
|
||||||
|
* Copyright (C) 2003-2014 by the INDEPNET Development Team.
|
||||||
|
*
|
||||||
|
* ---------------------------------------------------------------------
|
||||||
|
*
|
||||||
|
* LICENSE
|
||||||
|
*
|
||||||
|
* This file is part of GLPI.
|
||||||
|
*
|
||||||
|
* GLPI 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 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* GLPI 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 GLPI. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
* ---------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @since 0.85
|
||||||
|
*/
|
||||||
|
|
||||||
|
// Direct access to file
|
||||||
|
if (strpos($_SERVER['PHP_SELF'], "getDropdownNumber.php")) {
|
||||||
|
include ('../inc/includes.php');
|
||||||
|
header("Content-Type: application/json; charset=UTF-8");
|
||||||
|
Html::header_nocache();
|
||||||
|
} else if (!defined('GLPI_ROOT')) {
|
||||||
|
die("Sorry. You can't access this file directly");
|
||||||
|
}
|
||||||
|
|
||||||
|
Session::checkLoginUser();
|
||||||
|
echo Dropdown::getDropdownNumber($_POST);
|
||||||
48
ajax/getDropdownUsers.php
Normal file
48
ajax/getDropdownUsers.php
Normal file
@ -0,0 +1,48 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* ---------------------------------------------------------------------
|
||||||
|
* GLPI - Gestionnaire Libre de Parc Informatique
|
||||||
|
* Copyright (C) 2015-2020 Teclib' and contributors.
|
||||||
|
*
|
||||||
|
* http://glpi-project.org
|
||||||
|
*
|
||||||
|
* based on GLPI - Gestionnaire Libre de Parc Informatique
|
||||||
|
* Copyright (C) 2003-2014 by the INDEPNET Development Team.
|
||||||
|
*
|
||||||
|
* ---------------------------------------------------------------------
|
||||||
|
*
|
||||||
|
* LICENSE
|
||||||
|
*
|
||||||
|
* This file is part of GLPI.
|
||||||
|
*
|
||||||
|
* GLPI 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 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* GLPI 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 GLPI. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
* ---------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @since 0.85
|
||||||
|
*/
|
||||||
|
|
||||||
|
// Direct access to file
|
||||||
|
if (strpos($_SERVER['PHP_SELF'], "getDropdownUsers.php")) {
|
||||||
|
$AJAX_INCLUDE = 1;
|
||||||
|
include ('../inc/includes.php');
|
||||||
|
header("Content-Type: application/json; charset=UTF-8");
|
||||||
|
Html::header_nocache();
|
||||||
|
} else if (!defined('GLPI_ROOT')) {
|
||||||
|
die("Sorry. You can't access this file directly");
|
||||||
|
}
|
||||||
|
|
||||||
|
Session::checkLoginUser();
|
||||||
|
echo Dropdown::getDropdownUsers($_POST);
|
||||||
47
ajax/getDropdownValue.php
Normal file
47
ajax/getDropdownValue.php
Normal file
@ -0,0 +1,47 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* ---------------------------------------------------------------------
|
||||||
|
* GLPI - Gestionnaire Libre de Parc Informatique
|
||||||
|
* Copyright (C) 2015-2020 Teclib' and contributors.
|
||||||
|
*
|
||||||
|
* http://glpi-project.org
|
||||||
|
*
|
||||||
|
* based on GLPI - Gestionnaire Libre de Parc Informatique
|
||||||
|
* Copyright (C) 2003-2014 by the INDEPNET Development Team.
|
||||||
|
*
|
||||||
|
* ---------------------------------------------------------------------
|
||||||
|
*
|
||||||
|
* LICENSE
|
||||||
|
*
|
||||||
|
* This file is part of GLPI.
|
||||||
|
*
|
||||||
|
* GLPI 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 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* GLPI 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 GLPI. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
* ---------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @since 0.85
|
||||||
|
*/
|
||||||
|
|
||||||
|
// Direct access to file
|
||||||
|
if (strpos($_SERVER['PHP_SELF'], "getDropdownValue.php")) {
|
||||||
|
include ('../inc/includes.php');
|
||||||
|
header("Content-Type: application/json; charset=UTF-8");
|
||||||
|
Html::header_nocache();
|
||||||
|
} else if (!defined('GLPI_ROOT')) {
|
||||||
|
die("Sorry. You can't access this file directly");
|
||||||
|
}
|
||||||
|
|
||||||
|
Session::checkLoginUser();
|
||||||
|
echo Dropdown::getDropdownValue($_POST);
|
||||||
55
ajax/getFileTag.php
Normal file
55
ajax/getFileTag.php
Normal file
@ -0,0 +1,55 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* ---------------------------------------------------------------------
|
||||||
|
* GLPI - Gestionnaire Libre de Parc Informatique
|
||||||
|
* Copyright (C) 2015-2020 Teclib' and contributors.
|
||||||
|
*
|
||||||
|
* http://glpi-project.org
|
||||||
|
*
|
||||||
|
* based on GLPI - Gestionnaire Libre de Parc Informatique
|
||||||
|
* Copyright (C) 2003-2014 by the INDEPNET Development Team.
|
||||||
|
*
|
||||||
|
* ---------------------------------------------------------------------
|
||||||
|
*
|
||||||
|
* LICENSE
|
||||||
|
*
|
||||||
|
* This file is part of GLPI.
|
||||||
|
*
|
||||||
|
* GLPI 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 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* GLPI 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 GLPI. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
* ---------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @since 0.85
|
||||||
|
*/
|
||||||
|
|
||||||
|
$AJAX_INCLUDE = 1;
|
||||||
|
|
||||||
|
include ('../inc/includes.php');
|
||||||
|
|
||||||
|
header('Content-type: application/json');
|
||||||
|
Html::header_nocache();
|
||||||
|
|
||||||
|
Session::checkLoginUser();
|
||||||
|
|
||||||
|
if (isset($_POST['data'])) {
|
||||||
|
$response = [];
|
||||||
|
|
||||||
|
foreach (array_keys($_POST['data']) as $key) {
|
||||||
|
$unique_name = Rule::getUuid();
|
||||||
|
$response[$key] = ['tag' => Document::getImageTag($unique_name), 'name' => $unique_name];
|
||||||
|
}
|
||||||
|
|
||||||
|
echo json_encode($response);
|
||||||
|
}
|
||||||
59
ajax/getKbComment.php
Normal file
59
ajax/getKbComment.php
Normal file
@ -0,0 +1,59 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* ---------------------------------------------------------------------
|
||||||
|
* GLPI - Gestionnaire Libre de Parc Informatique
|
||||||
|
* Copyright (C) 2015-2020 Teclib' and contributors.
|
||||||
|
*
|
||||||
|
* http://glpi-project.org
|
||||||
|
*
|
||||||
|
* based on GLPI - Gestionnaire Libre de Parc Informatique
|
||||||
|
* Copyright (C) 2003-2014 by the INDEPNET Development Team.
|
||||||
|
*
|
||||||
|
* ---------------------------------------------------------------------
|
||||||
|
*
|
||||||
|
* LICENSE
|
||||||
|
*
|
||||||
|
* This file is part of GLPI.
|
||||||
|
*
|
||||||
|
* GLPI 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 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* GLPI 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 GLPI. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
* ---------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
|
include ('../inc/includes.php');
|
||||||
|
header("Content-Type: text/html; charset=UTF-8");
|
||||||
|
Html::header_nocache();
|
||||||
|
|
||||||
|
Session::checkLoginUser();
|
||||||
|
|
||||||
|
if (!isset($_POST['kbitem_id'])) {
|
||||||
|
throw new \RuntimeException('Required argument missing!');
|
||||||
|
}
|
||||||
|
|
||||||
|
$kbitem_id = $_POST['kbitem_id'];
|
||||||
|
$lang = null;
|
||||||
|
if (isset($_POST['language'])) {
|
||||||
|
$lang = $_POST['language'];
|
||||||
|
}
|
||||||
|
|
||||||
|
$edit = false;
|
||||||
|
if (isset($_POST['edit'])) {
|
||||||
|
$edit = $_POST['edit'];
|
||||||
|
}
|
||||||
|
|
||||||
|
$answer = false;
|
||||||
|
if (isset($_POST['answer'])) {
|
||||||
|
$answer = $_POST['answer'];
|
||||||
|
}
|
||||||
|
|
||||||
|
echo KnowbaseItem_Comment::getCommentForm($kbitem_id, $lang, $edit, $answer);
|
||||||
56
ajax/getKbRevision.php
Normal file
56
ajax/getKbRevision.php
Normal file
@ -0,0 +1,56 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* ---------------------------------------------------------------------
|
||||||
|
* GLPI - Gestionnaire Libre de Parc Informatique
|
||||||
|
* Copyright (C) 2015-2020 Teclib' and contributors.
|
||||||
|
*
|
||||||
|
* http://glpi-project.org
|
||||||
|
*
|
||||||
|
* based on GLPI - Gestionnaire Libre de Parc Informatique
|
||||||
|
* Copyright (C) 2003-2014 by the INDEPNET Development Team.
|
||||||
|
*
|
||||||
|
* ---------------------------------------------------------------------
|
||||||
|
*
|
||||||
|
* LICENSE
|
||||||
|
*
|
||||||
|
* This file is part of GLPI.
|
||||||
|
*
|
||||||
|
* GLPI 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 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* GLPI 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 GLPI. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
* ---------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @since 9.1
|
||||||
|
*/
|
||||||
|
|
||||||
|
include ('../inc/includes.php');
|
||||||
|
header("Content-Type: application/json; charset=UTF-8");
|
||||||
|
Html::header_nocache();
|
||||||
|
|
||||||
|
Session::checkLoginUser();
|
||||||
|
|
||||||
|
if (!isset($_POST['revid'])) {
|
||||||
|
throw new \RuntimeException('Required argument missing!');
|
||||||
|
}
|
||||||
|
|
||||||
|
$revid = $_POST['revid'];
|
||||||
|
|
||||||
|
$revision = new KnowbaseItem_Revision();
|
||||||
|
$revision->getFromDB($revid);
|
||||||
|
$rev = [
|
||||||
|
'name' => $revision->fields['name'],
|
||||||
|
'answer' => html_entity_decode($revision->fields['answer'])
|
||||||
|
];
|
||||||
|
|
||||||
|
echo json_encode($rev);
|
||||||
48
ajax/getKnowbaseItemAnswer.php
Normal file
48
ajax/getKnowbaseItemAnswer.php
Normal file
@ -0,0 +1,48 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* ---------------------------------------------------------------------
|
||||||
|
* GLPI - Gestionnaire Libre de Parc Informatique
|
||||||
|
* Copyright (C) 2015-2020 Teclib' and contributors.
|
||||||
|
*
|
||||||
|
* http://glpi-project.org
|
||||||
|
*
|
||||||
|
* based on GLPI - Gestionnaire Libre de Parc Informatique
|
||||||
|
* Copyright (C) 2003-2014 by the INDEPNET Development Team.
|
||||||
|
*
|
||||||
|
* ---------------------------------------------------------------------
|
||||||
|
*
|
||||||
|
* LICENSE
|
||||||
|
*
|
||||||
|
* This file is part of GLPI.
|
||||||
|
*
|
||||||
|
* GLPI 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 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* GLPI 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 GLPI. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
* ---------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @since 9.2
|
||||||
|
*/
|
||||||
|
|
||||||
|
include ('../inc/includes.php');
|
||||||
|
|
||||||
|
header('Content-type: application/json');
|
||||||
|
Html::header_nocache();
|
||||||
|
|
||||||
|
Session::checkLoginUser();
|
||||||
|
|
||||||
|
if (isset($_POST['knowbaseitems_id'])) {
|
||||||
|
$kbitem = new KnowbaseItem;
|
||||||
|
$kbitem->getFromDB(intval($_POST['knowbaseitems_id']));
|
||||||
|
$kbitem->showFull();
|
||||||
|
}
|
||||||
82
ajax/getMapPoint.php
Normal file
82
ajax/getMapPoint.php
Normal file
@ -0,0 +1,82 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* ---------------------------------------------------------------------
|
||||||
|
* GLPI - Gestionnaire Libre de Parc Informatique
|
||||||
|
* Copyright (C) 2015-2020 Teclib' and contributors.
|
||||||
|
*
|
||||||
|
* http://glpi-project.org
|
||||||
|
*
|
||||||
|
* based on GLPI - Gestionnaire Libre de Parc Informatique
|
||||||
|
* Copyright (C) 2003-2014 by the INDEPNET Development Team.
|
||||||
|
*
|
||||||
|
* ---------------------------------------------------------------------
|
||||||
|
*
|
||||||
|
* LICENSE
|
||||||
|
*
|
||||||
|
* This file is part of GLPI.
|
||||||
|
*
|
||||||
|
* GLPI 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 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* GLPI 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 GLPI. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
* ---------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
|
include ('../inc/includes.php');
|
||||||
|
header("Content-Type: application/json; charset=UTF-8");
|
||||||
|
Html::header_nocache();
|
||||||
|
|
||||||
|
Session::checkLoginUser();
|
||||||
|
|
||||||
|
$result = [];
|
||||||
|
if (!isset($_POST['itemtype']) || !isset($_POST['items_id']) || (int)$_POST['items_id'] < 1) {
|
||||||
|
$result = [
|
||||||
|
'success' => false,
|
||||||
|
'message' => __('Required argument missing!')
|
||||||
|
];
|
||||||
|
} else {
|
||||||
|
$itemtype = $_POST['itemtype'];
|
||||||
|
$items_id = $_POST['items_id'];
|
||||||
|
|
||||||
|
if ($itemtype != Location::getType()) {
|
||||||
|
$item = new $itemtype();
|
||||||
|
$found = $item->getFromDB($items_id);
|
||||||
|
if ($found && isset($item->fields['locations_id']) && (int)$item->fields['locations_id'] > 0) {
|
||||||
|
$itemtype = Location::getType();
|
||||||
|
$items_id = $item->fields['locations_id'];
|
||||||
|
} else {
|
||||||
|
$result = [
|
||||||
|
'success' => false,
|
||||||
|
'message' => __('Element seems not geolocalized or cannot be found')
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!count($result)) {
|
||||||
|
$item = new $itemtype();
|
||||||
|
$item->getFromDB($items_id);
|
||||||
|
if (!empty($item->fields['latitude']) && !empty($item->fields['longitude'])) {
|
||||||
|
$result = [
|
||||||
|
'name' => $item->getName(),
|
||||||
|
'lat' => $item->fields['latitude'],
|
||||||
|
'lng' => $item->fields['longitude']
|
||||||
|
];
|
||||||
|
} else {
|
||||||
|
$result = [
|
||||||
|
'success' => false,
|
||||||
|
'message' => "<h3>".__("Location seems not geolocalized!")."</h3>".
|
||||||
|
"<a href='".$item->getLinkURL()."'>".__("Consider filling latitude and longitude on this location.")."</a>"
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
echo json_encode($result);
|
||||||
90
ajax/getUserPicture.php
Normal file
90
ajax/getUserPicture.php
Normal file
@ -0,0 +1,90 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* ---------------------------------------------------------------------
|
||||||
|
* GLPI - Gestionnaire Libre de Parc Informatique
|
||||||
|
* Copyright (C) 2015-2020 Teclib' and contributors.
|
||||||
|
*
|
||||||
|
* http://glpi-project.org
|
||||||
|
*
|
||||||
|
* based on GLPI - Gestionnaire Libre de Parc Informatique
|
||||||
|
* Copyright (C) 2003-2014 by the INDEPNET Development Team.
|
||||||
|
*
|
||||||
|
* ---------------------------------------------------------------------
|
||||||
|
*
|
||||||
|
* LICENSE
|
||||||
|
*
|
||||||
|
* This file is part of GLPI.
|
||||||
|
*
|
||||||
|
* GLPI 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 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* GLPI 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 GLPI. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
* ---------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
|
$AJAX_INCLUDE = 1;
|
||||||
|
|
||||||
|
include ('../inc/includes.php');
|
||||||
|
|
||||||
|
header("Content-Type: application/json; charset=UTF-8");
|
||||||
|
Html::header_nocache();
|
||||||
|
|
||||||
|
Session::checkLoginUser();
|
||||||
|
|
||||||
|
if (!isset($_GET['users_id'])) {
|
||||||
|
// Bad request
|
||||||
|
Toolbox::logError("Missing users_id parameter");
|
||||||
|
http_response_code(400);
|
||||||
|
return;
|
||||||
|
} else if (!is_array($_GET['users_id'])) {
|
||||||
|
$_GET['users_id'] = [$_GET['users_id']];
|
||||||
|
}
|
||||||
|
|
||||||
|
$_GET['users_id'] = array_unique($_GET['users_id']);
|
||||||
|
|
||||||
|
if (!isset($_GET['size'])) {
|
||||||
|
$_GET['size'] = '100%';
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!isset($_GET['allow_blank'])) {
|
||||||
|
$_GET['allow_blank'] = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
$user = new User();
|
||||||
|
$imgs = [];
|
||||||
|
|
||||||
|
foreach ($_GET['users_id'] as $user_id) {
|
||||||
|
if ($user->getFromDB($user_id)) {
|
||||||
|
if (!empty($user->fields['picture']) || $_GET['allow_blank']) {
|
||||||
|
if (isset($_GET['type']) && $_GET['type'] == 'thumbnail') {
|
||||||
|
$path = User::getThumbnailURLForPicture($user->fields['picture']);
|
||||||
|
} else {
|
||||||
|
$path = User::getURLForPicture($user->fields['picture']);
|
||||||
|
}
|
||||||
|
$img = Html::image($path, [
|
||||||
|
'title' => getUserName($user_id),
|
||||||
|
'width' => $_GET['size'],
|
||||||
|
'height' => $_GET['size'],
|
||||||
|
'class' => isset($_GET['class']) ? $_GET['class'] : ''
|
||||||
|
]);
|
||||||
|
if (isset($_GET['link']) && $_GET['link']) {
|
||||||
|
$imgs[$user_id] = Html::link($img, User::getFormURLWithID($user_id));
|
||||||
|
} else {
|
||||||
|
$imgs[$user_id] = $img;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// No picture and default image is not allowed.
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
echo json_encode($imgs, JSON_FORCE_OBJECT);
|
||||||
42
ajax/helpdesk_observer.php
Normal file
42
ajax/helpdesk_observer.php
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* ---------------------------------------------------------------------
|
||||||
|
* GLPI - Gestionnaire Libre de Parc Informatique
|
||||||
|
* Copyright (C) 2015-2020 Teclib' and contributors.
|
||||||
|
*
|
||||||
|
* http://glpi-project.org
|
||||||
|
*
|
||||||
|
* based on GLPI - Gestionnaire Libre de Parc Informatique
|
||||||
|
* Copyright (C) 2003-2014 by the INDEPNET Development Team.
|
||||||
|
*
|
||||||
|
* ---------------------------------------------------------------------
|
||||||
|
*
|
||||||
|
* LICENSE
|
||||||
|
*
|
||||||
|
* This file is part of GLPI.
|
||||||
|
*
|
||||||
|
* GLPI 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 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* GLPI 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 GLPI. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
* ---------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
|
$AJAX_INCLUDE = 1;
|
||||||
|
include ("../inc/includes.php");
|
||||||
|
|
||||||
|
// Send UTF8 Headers
|
||||||
|
header("Content-Type: text/html; charset=UTF-8");
|
||||||
|
Html::header_nocache();
|
||||||
|
|
||||||
|
Session::checkLoginUser();
|
||||||
|
|
||||||
|
Ticket::showFormHelpdeskObserver($_REQUEST);
|
||||||
253
ajax/impact.php
Normal file
253
ajax/impact.php
Normal file
@ -0,0 +1,253 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ---------------------------------------------------------------------
|
||||||
|
* GLPI - Gestionnaire Libre de Parc Informatique
|
||||||
|
* Copyright (C) 2015-2020 Teclib' and contributors.
|
||||||
|
*
|
||||||
|
* http://glpi-project.org
|
||||||
|
*
|
||||||
|
* based on GLPI - Gestionnaire Libre de Parc Informatique
|
||||||
|
* Copyright (C) 2003-2014 by the INDEPNET Development Team.
|
||||||
|
*
|
||||||
|
* ---------------------------------------------------------------------
|
||||||
|
*
|
||||||
|
* LICENSE
|
||||||
|
*
|
||||||
|
* This file is part of GLPI.
|
||||||
|
*
|
||||||
|
* GLPI 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 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* GLPI 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 GLPI. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
* ---------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
|
const DELTA_ACTION_ADD = 1;
|
||||||
|
const DELTA_ACTION_UPDATE = 2;
|
||||||
|
const DELTA_ACTION_DELETE = 3;
|
||||||
|
|
||||||
|
$AJAX_INCLUDE = 1;
|
||||||
|
include ('../inc/includes.php');
|
||||||
|
|
||||||
|
// Send UTF8 Headers
|
||||||
|
header("Content-Type: application/json; charset=UTF-8");
|
||||||
|
Html::header_nocache();
|
||||||
|
|
||||||
|
Session::checkLoginUser();
|
||||||
|
|
||||||
|
switch ($_SERVER['REQUEST_METHOD']) {
|
||||||
|
// GET request: build the impact graph for a given asset
|
||||||
|
case 'GET':
|
||||||
|
$action = $_GET["action"] ?? "";
|
||||||
|
|
||||||
|
switch ($action) {
|
||||||
|
case "search":
|
||||||
|
$itemtype = $_GET["itemtype"] ?? "";
|
||||||
|
$used = $_GET["used"] ?? "[]";
|
||||||
|
$filter = $_GET["filter"] ?? "";
|
||||||
|
$page = $_GET["page"] ?? 0;
|
||||||
|
|
||||||
|
// Check required params
|
||||||
|
if (empty($itemtype)) {
|
||||||
|
Toolbox::throwError(400, "Missing itemtype");
|
||||||
|
}
|
||||||
|
|
||||||
|
// Execute search
|
||||||
|
$assets = Impact::searchAsset($itemtype, json_decode($used), $filter, $page);
|
||||||
|
header('Content-Type: application/json');
|
||||||
|
echo json_encode($assets);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'load':
|
||||||
|
$itemtype = $_GET["itemtype"] ?? "";
|
||||||
|
$items_id = $_GET["items_id"] ?? "";
|
||||||
|
$view = $_GET["view"] ?? "graph";
|
||||||
|
|
||||||
|
// Check required params
|
||||||
|
if (empty($itemtype) || empty($items_id)) {
|
||||||
|
Toolbox::throwError(400, "Missing itemtype or items_id");
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check that the the target asset exist
|
||||||
|
if (!Impact::assetExist($itemtype, $items_id)) {
|
||||||
|
Toolbox::throwError(400, "Object[class=$itemtype, id=$items_id] doesn't exist");
|
||||||
|
}
|
||||||
|
|
||||||
|
// Prepare graph
|
||||||
|
$item = new $itemtype;
|
||||||
|
$item->getFromDB($items_id);
|
||||||
|
$graph = Impact::buildGraph($item);
|
||||||
|
$params = Impact::prepareParams($item);
|
||||||
|
$readonly = $item->can($items_id, UPDATE);
|
||||||
|
|
||||||
|
if ($view == "graph") {
|
||||||
|
// Output graph as json
|
||||||
|
header('Content-Type: application/json');
|
||||||
|
echo json_encode([
|
||||||
|
'graph' => Impact::makeDataForCytoscape($graph),
|
||||||
|
'params' => $params,
|
||||||
|
'readonly' => $readonly,
|
||||||
|
]);
|
||||||
|
} else if ($view == "list") {
|
||||||
|
// Output list as HTML
|
||||||
|
header('Content-Type: text/html');
|
||||||
|
Impact::displayListView($item, $graph);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
Toolbox::throwError(400, "Missing or invalid 'action' parameter");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
// Post request: update the store impact dependencies, compounds or items
|
||||||
|
case 'POST':
|
||||||
|
// Check required params
|
||||||
|
if (!isset($_POST['impacts'])) {
|
||||||
|
Toolbox::throwError(400, "Missing 'impacts' payload");
|
||||||
|
}
|
||||||
|
|
||||||
|
// Decode data (should be json)
|
||||||
|
$data = Toolbox::jsonDecode($_UPOST['impacts'], true);
|
||||||
|
if (!is_array($data)) {
|
||||||
|
Toolbox::throwError(400, "Payload should be an array");
|
||||||
|
}
|
||||||
|
$data = Toolbox::addslashes_deep($data);
|
||||||
|
|
||||||
|
$readonly = true;
|
||||||
|
|
||||||
|
// Handle context for the starting node
|
||||||
|
$context_em = new \ImpactContext();
|
||||||
|
$context_data = $data['context'];
|
||||||
|
|
||||||
|
// Get id and type from node_id (e.g. Computer::4 -> [Computer, 4])
|
||||||
|
$start_node_details = explode(Impact::NODE_ID_DELIMITER, $context_data['node_id']);
|
||||||
|
|
||||||
|
// Get impact_item for this node
|
||||||
|
$item = new $start_node_details[0];
|
||||||
|
$item->getFromDB($start_node_details[1]);
|
||||||
|
$impact_item = \ImpactItem::findForItem($item);
|
||||||
|
$start_node_impact_item_id = $impact_item->fields['id'];
|
||||||
|
$readonly = !$item->can($item->fields['id'], UPDATE);
|
||||||
|
|
||||||
|
// Stop here if readonly graph
|
||||||
|
if ($readonly) {
|
||||||
|
Toolbox::throwError(403, "Missing rights");
|
||||||
|
}
|
||||||
|
|
||||||
|
$context_id = 0;
|
||||||
|
if ($impact_item->fields["impactcontexts_id"] == 0
|
||||||
|
|| $impact_item->fields["is_slave"] == 1) {
|
||||||
|
// There is no context OR we are slave to another context -> let's
|
||||||
|
// create a new one
|
||||||
|
$context_id = $context_em->add($context_data);
|
||||||
|
|
||||||
|
// Set the context_id to be updated
|
||||||
|
$data['items'][$start_node_impact_item_id]['impactcontexts_id'] = $context_id;
|
||||||
|
$data['items'][$start_node_impact_item_id]['is_slave'] = 0;
|
||||||
|
} else {
|
||||||
|
// Update existing context
|
||||||
|
$context_id = $impact_item->fields["impactcontexts_id"];
|
||||||
|
$context_em->getFromDB($context_id);
|
||||||
|
$context_data['id'] = $context_id;
|
||||||
|
$context_em->update($context_data);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Save impact relation delta
|
||||||
|
$em = new ImpactRelation();
|
||||||
|
foreach ($data['edges'] as $impact) {
|
||||||
|
// Extract action
|
||||||
|
$action = $impact['action'];
|
||||||
|
unset($impact['action']);
|
||||||
|
|
||||||
|
switch ($action) {
|
||||||
|
case DELTA_ACTION_ADD:
|
||||||
|
$em->add($impact);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case DELTA_ACTION_DELETE:
|
||||||
|
$impact['id'] = ImpactRelation::getIDFromInput($impact);
|
||||||
|
$em->delete($impact);
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Save impact compound delta
|
||||||
|
$em = new ImpactCompound();
|
||||||
|
foreach ($data['compounds'] as $id => $compound) {
|
||||||
|
// Extract action
|
||||||
|
$action = $compound['action'];
|
||||||
|
unset($compound['action']);
|
||||||
|
|
||||||
|
switch ($action) {
|
||||||
|
case DELTA_ACTION_ADD:
|
||||||
|
$newCompoundID = $em->add($compound);
|
||||||
|
|
||||||
|
// Update id reference in impactitem
|
||||||
|
// This is needed because some nodes might have this compound
|
||||||
|
// temporary id as their parent id
|
||||||
|
foreach ($data['items'] as $nodeID => $node) {
|
||||||
|
if ($node['parent_id'] === $id) {
|
||||||
|
$data['items'][$nodeID]['parent_id'] = $newCompoundID;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case DELTA_ACTION_UPDATE:
|
||||||
|
$compound['id'] = $id;
|
||||||
|
$em->update($compound);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case DELTA_ACTION_DELETE:
|
||||||
|
$em->delete(['id' => $id]);
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Save impact item delta
|
||||||
|
$em = new ImpactItem();
|
||||||
|
foreach ($data['items'] as $id => $impactItem) {
|
||||||
|
// Extract action
|
||||||
|
$action = $impactItem['action'];
|
||||||
|
unset($impactItem['action']);
|
||||||
|
|
||||||
|
switch ($action) {
|
||||||
|
case DELTA_ACTION_UPDATE:
|
||||||
|
$impactItem['id'] = $id;
|
||||||
|
|
||||||
|
// If this is not the starting node, check for context update
|
||||||
|
if ($id !== $start_node_impact_item_id) {
|
||||||
|
$em->getFromDB($id);
|
||||||
|
|
||||||
|
// If this node has no context -> make it a slave
|
||||||
|
if ($em->fields['impactcontexts_id'] == 0) {
|
||||||
|
$impactItem['impactcontexts_id'] = $context_id;
|
||||||
|
$impactItem['is_slave'] = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$em->update($impactItem);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
header('Content-Type: application/javascript');
|
||||||
|
http_response_code(200);
|
||||||
|
break;
|
||||||
|
}
|
||||||
31
ajax/index.php
Normal file
31
ajax/index.php
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* ---------------------------------------------------------------------
|
||||||
|
* GLPI - Gestionnaire Libre de Parc Informatique
|
||||||
|
* Copyright (C) 2015-2020 Teclib' and contributors.
|
||||||
|
*
|
||||||
|
* http://glpi-project.org
|
||||||
|
*
|
||||||
|
* based on GLPI - Gestionnaire Libre de Parc Informatique
|
||||||
|
* Copyright (C) 2003-2014 by the INDEPNET Development Team.
|
||||||
|
*
|
||||||
|
* ---------------------------------------------------------------------
|
||||||
|
*
|
||||||
|
* LICENSE
|
||||||
|
*
|
||||||
|
* This file is part of GLPI.
|
||||||
|
*
|
||||||
|
* GLPI 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 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* GLPI 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 GLPI. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
* ---------------------------------------------------------------------
|
||||||
|
*/
|
||||||
48
ajax/inputtext.php
Normal file
48
ajax/inputtext.php
Normal file
@ -0,0 +1,48 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* ---------------------------------------------------------------------
|
||||||
|
* GLPI - Gestionnaire Libre de Parc Informatique
|
||||||
|
* Copyright (C) 2015-2020 Teclib' and contributors.
|
||||||
|
*
|
||||||
|
* http://glpi-project.org
|
||||||
|
*
|
||||||
|
* based on GLPI - Gestionnaire Libre de Parc Informatique
|
||||||
|
* Copyright (C) 2003-2014 by the INDEPNET Development Team.
|
||||||
|
*
|
||||||
|
* ---------------------------------------------------------------------
|
||||||
|
*
|
||||||
|
* LICENSE
|
||||||
|
*
|
||||||
|
* This file is part of GLPI.
|
||||||
|
*
|
||||||
|
* GLPI 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 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* GLPI 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 GLPI. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
* ---------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
|
$AJAX_INCLUDE = 1;
|
||||||
|
|
||||||
|
include ('../inc/includes.php');
|
||||||
|
|
||||||
|
header("Content-Type: text/html; charset=UTF-8");
|
||||||
|
Html::header_nocache();
|
||||||
|
|
||||||
|
Session::checkLoginUser();
|
||||||
|
|
||||||
|
if (isset($_POST['name'])) {
|
||||||
|
echo "<input type='text' ".(isset($_POST["size"])?" size='".$_POST["size"]."' ":"")." ".
|
||||||
|
(isset($_POST["maxlength"])?"maxlength='".$_POST["maxlength"]."' ":"")." name='".
|
||||||
|
$_POST['name']."' value=\"".
|
||||||
|
Html::cleanInputText(Toolbox::clean_cross_side_scripting_deep(rawurldecode(stripslashes($_POST["data"])))).
|
||||||
|
"\">";
|
||||||
|
}
|
||||||
67
ajax/itemTicket.php
Normal file
67
ajax/itemTicket.php
Normal file
@ -0,0 +1,67 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* ---------------------------------------------------------------------
|
||||||
|
* GLPI - Gestionnaire Libre de Parc Informatique
|
||||||
|
* Copyright (C) 2015-2020 Teclib' and contributors.
|
||||||
|
*
|
||||||
|
* http://glpi-project.org
|
||||||
|
*
|
||||||
|
* based on GLPI - Gestionnaire Libre de Parc Informatique
|
||||||
|
* Copyright (C) 2003-2014 by the INDEPNET Development Team.
|
||||||
|
*
|
||||||
|
* ---------------------------------------------------------------------
|
||||||
|
*
|
||||||
|
* LICENSE
|
||||||
|
*
|
||||||
|
* This file is part of GLPI.
|
||||||
|
*
|
||||||
|
* GLPI 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 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* GLPI 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 GLPI. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
* ---------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
|
include ('../inc/includes.php');
|
||||||
|
|
||||||
|
header("Content-Type: text/html; charset=UTF-8");
|
||||||
|
Html::header_nocache();
|
||||||
|
|
||||||
|
Session::checkLoginUser();
|
||||||
|
$item_ticket = new Item_Ticket();
|
||||||
|
|
||||||
|
switch ($_GET['action']) {
|
||||||
|
case 'add':
|
||||||
|
if (isset($_GET['my_items']) && !empty($_GET['my_items'])) {
|
||||||
|
list($_GET['itemtype'], $_GET['items_id']) = explode('_', $_GET['my_items']);
|
||||||
|
}
|
||||||
|
if (isset($_GET['items_id']) && isset($_GET['itemtype']) && !empty($_GET['items_id'])) {
|
||||||
|
$_GET['params']['items_id'][$_GET['itemtype']][$_GET['items_id']] = $_GET['items_id'];
|
||||||
|
}
|
||||||
|
Item_Ticket::itemAddForm(new Ticket(), $_GET['params']);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'delete':
|
||||||
|
if (isset($_GET['items_id']) && isset($_GET['itemtype']) && !empty($_GET['items_id'])) {
|
||||||
|
$deleted = true;
|
||||||
|
if ($_GET['params']['id'] > 0) {
|
||||||
|
$deleted = $item_ticket->deleteByCriteria(['tickets_id' => $_GET['params']['id'],
|
||||||
|
'items_id' => $_GET['items_id'],
|
||||||
|
'itemtype' => $_GET['itemtype']]);
|
||||||
|
}
|
||||||
|
if ($deleted) {
|
||||||
|
unset($_GET['params']['items_id'][$_GET['itemtype']][array_search($_GET['items_id'], $_GET['params']['items_id'][$_GET['itemtype']])]);
|
||||||
|
}
|
||||||
|
Item_Ticket::itemAddForm(new Ticket(), $_GET['params']);
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
56
ajax/item_rack.php
Normal file
56
ajax/item_rack.php
Normal file
@ -0,0 +1,56 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* ---------------------------------------------------------------------
|
||||||
|
* GLPI - Gestionnaire Libre de Parc Informatique
|
||||||
|
* Copyright (C) 2015-2020 Teclib' and contributors.
|
||||||
|
*
|
||||||
|
* http://glpi-project.org
|
||||||
|
*
|
||||||
|
* based on GLPI - Gestionnaire Libre de Parc Informatique
|
||||||
|
* Copyright (C) 2003-2014 by the INDEPNET Development Team.
|
||||||
|
*
|
||||||
|
* ---------------------------------------------------------------------
|
||||||
|
*
|
||||||
|
* LICENSE
|
||||||
|
*
|
||||||
|
* This file is part of GLPI.
|
||||||
|
*
|
||||||
|
* GLPI 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 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* GLPI 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 GLPI. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
* ---------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
|
$AJAX_INCLUDE = 1;
|
||||||
|
include ('../inc/includes.php');
|
||||||
|
header("Content-Type: text/html; charset=UTF-8");
|
||||||
|
Html::header_nocache();
|
||||||
|
|
||||||
|
Session::checkLoginUser();
|
||||||
|
|
||||||
|
if (isset($_POST['action'])) {
|
||||||
|
$item_rack = new Item_Rack;
|
||||||
|
$item_rack->getFromDB((int) $_POST['id']);
|
||||||
|
$answer = [];
|
||||||
|
|
||||||
|
switch ($_POST['action']) {
|
||||||
|
case 'move_item':
|
||||||
|
$answer['status'] = $item_rack->update([
|
||||||
|
'id' => (int) $_POST['id'],
|
||||||
|
'position' => (int) $_POST['position'],
|
||||||
|
'hpos' => (int) $_POST['hpos'],
|
||||||
|
]);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
echo json_encode($answer);
|
||||||
|
}
|
||||||
52
ajax/itilfollowup.php
Normal file
52
ajax/itilfollowup.php
Normal file
@ -0,0 +1,52 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* ---------------------------------------------------------------------
|
||||||
|
* GLPI - Gestionnaire Libre de Parc Informatique
|
||||||
|
* Copyright (C) 2015-2020 Teclib' and contributors.
|
||||||
|
*
|
||||||
|
* http://glpi-project.org
|
||||||
|
*
|
||||||
|
* based on GLPI - Gestionnaire Libre de Parc Informatique
|
||||||
|
* Copyright (C) 2003-2014 by the INDEPNET Development Team.
|
||||||
|
*
|
||||||
|
* ---------------------------------------------------------------------
|
||||||
|
*
|
||||||
|
* LICENSE
|
||||||
|
*
|
||||||
|
* This file is part of GLPI.
|
||||||
|
*
|
||||||
|
* GLPI 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 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* GLPI 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 GLPI. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
* ---------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @since 9.5
|
||||||
|
*/
|
||||||
|
|
||||||
|
$AJAX_INCLUDE = 1;
|
||||||
|
|
||||||
|
include ('../inc/includes.php');
|
||||||
|
header("Content-Type: application/json; charset=UTF-8");
|
||||||
|
Html::header_nocache();
|
||||||
|
|
||||||
|
Session::checkLoginUser();
|
||||||
|
|
||||||
|
if (isset($_POST['itilfollowuptemplates_id'])
|
||||||
|
&& $_POST['itilfollowuptemplates_id'] > 0) {
|
||||||
|
$template = new ITILFollowupTemplate();
|
||||||
|
$template->getFromDB($_POST['itilfollowuptemplates_id']);
|
||||||
|
|
||||||
|
$template->fields = array_map('html_entity_decode', $template->fields);
|
||||||
|
echo json_encode($template->fields);
|
||||||
|
}
|
||||||
228
ajax/kanban.php
Normal file
228
ajax/kanban.php
Normal file
@ -0,0 +1,228 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* ---------------------------------------------------------------------
|
||||||
|
* GLPI - Gestionnaire Libre de Parc Informatique
|
||||||
|
* Copyright (C) 2015-2020 Teclib' and contributors.
|
||||||
|
*
|
||||||
|
* http://glpi-project.org
|
||||||
|
*
|
||||||
|
* based on GLPI - Gestionnaire Libre de Parc Informatique
|
||||||
|
* Copyright (C) 2003-2014 by the INDEPNET Development Team.
|
||||||
|
*
|
||||||
|
* ---------------------------------------------------------------------
|
||||||
|
*
|
||||||
|
* LICENSE
|
||||||
|
*
|
||||||
|
* This file is part of GLPI.
|
||||||
|
*
|
||||||
|
* GLPI 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 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* GLPI 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 GLPI. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
* ---------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
|
use Glpi\Features\Kanban;
|
||||||
|
|
||||||
|
$AJAX_INCLUDE = 1;
|
||||||
|
|
||||||
|
include ('../inc/includes.php');
|
||||||
|
|
||||||
|
header("Content-Type: text/html; charset=UTF-8");
|
||||||
|
Html::header_nocache();
|
||||||
|
|
||||||
|
Session::checkLoginUser();
|
||||||
|
|
||||||
|
if ($_SERVER['REQUEST_METHOD'] !== 'GET') {
|
||||||
|
// Get AJAX input and load it into $_REQUEST
|
||||||
|
$input = file_get_contents('php://input');
|
||||||
|
parse_str($input, $_REQUEST);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!isset($_REQUEST['action'])) {
|
||||||
|
Toolbox::logError("Missing action parameter");
|
||||||
|
http_response_code(400);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
$action = $_REQUEST['action'];
|
||||||
|
|
||||||
|
$nonkanban_actions = ['update', 'bulk_add_item', 'add_item', 'move_item'];
|
||||||
|
if (isset($_REQUEST['itemtype'])) {
|
||||||
|
$traits = class_uses($_REQUEST['itemtype'], true);
|
||||||
|
if (!in_array($_REQUEST['action'], $nonkanban_actions) && (!$traits || !in_array(Kanban::class, $traits, true))) {
|
||||||
|
// Bad request
|
||||||
|
// For all actions, except those in $nonkanban_actions, we expect to be manipulating the Kanban itself.
|
||||||
|
Toolbox::logError("Invalid itemtype parameter");
|
||||||
|
http_response_code(400);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
/** @var CommonDBTM $item */
|
||||||
|
$itemtype = $_REQUEST['itemtype'];
|
||||||
|
$item = new $itemtype();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Rights Checks
|
||||||
|
if (isset($itemtype)) {
|
||||||
|
if (in_array($action, ['refresh', 'get_switcher_dropdown', 'get_column'])) {
|
||||||
|
if (!$item->canView()) {
|
||||||
|
// Missing rights
|
||||||
|
http_response_code(403);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (in_array($action, ['update'])) {
|
||||||
|
$item->getFromDB($_REQUEST['items_id']);
|
||||||
|
if (!$item->canUpdateItem()) {
|
||||||
|
// Missing rights
|
||||||
|
http_response_code(403);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (in_array($action, ['bulk_add_item', 'add_item'])) {
|
||||||
|
if (!$item->canCreate()) {
|
||||||
|
// Missing rights
|
||||||
|
http_response_code(403);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Helper to check required parameters
|
||||||
|
$checkParams = function($required) {
|
||||||
|
foreach ($required as $param) {
|
||||||
|
if (!isset($_REQUEST[$param])) {
|
||||||
|
Toolbox::logError("Missing $param parameter");
|
||||||
|
http_response_code(400);
|
||||||
|
die();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
// Action Processing
|
||||||
|
if ($_REQUEST['action'] == 'update') {
|
||||||
|
$checkParams(['column_field', 'column_value']);
|
||||||
|
// Update project or task based on changes made in the Kanban
|
||||||
|
$item->update([
|
||||||
|
'id' => $_REQUEST['items_id'],
|
||||||
|
$_REQUEST['column_field'] => $_REQUEST['column_value']
|
||||||
|
]);
|
||||||
|
} else if ($_REQUEST['action'] == 'add_item') {
|
||||||
|
$checkParams(['inputs']);
|
||||||
|
$item = new $itemtype();
|
||||||
|
$inputs = [];
|
||||||
|
parse_str($_REQUEST['inputs'], $inputs);
|
||||||
|
$item->add($inputs);
|
||||||
|
} else if ($_REQUEST['action'] == 'bulk_add_item') {
|
||||||
|
$checkParams(['inputs']);
|
||||||
|
$item = new $itemtype();
|
||||||
|
$inputs = [];
|
||||||
|
parse_str($_REQUEST['inputs'], $inputs);
|
||||||
|
|
||||||
|
$bulk_item_list = preg_split('/\r\n|[\r\n]/', $inputs['bulk_item_list']);
|
||||||
|
if (!empty($bulk_item_list)) {
|
||||||
|
unset($inputs['bulk_item_list']);
|
||||||
|
foreach ($bulk_item_list as $item_entry) {
|
||||||
|
$item_entry = trim($item_entry);
|
||||||
|
if (!empty($item_entry)) {
|
||||||
|
$item->add($inputs + ['name' => $item_entry]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else if ($_REQUEST['action'] == 'move_item') {
|
||||||
|
$checkParams(['card', 'column', 'position', 'kanban']);
|
||||||
|
/** @var Kanban|CommonDBTM $kanban */
|
||||||
|
$kanban = new $_REQUEST['kanban']['itemtype'];
|
||||||
|
$can_move = $kanban->canOrderKanbanCard($_REQUEST['kanban']['items_id']);
|
||||||
|
if ($can_move) {
|
||||||
|
Item_Kanban::moveCard($_REQUEST['kanban']['itemtype'], $_REQUEST['kanban']['items_id'],
|
||||||
|
$_REQUEST['card'], $_REQUEST['column'], $_REQUEST['position']);
|
||||||
|
}
|
||||||
|
} else if ($_REQUEST['action'] == 'show_column') {
|
||||||
|
$checkParams(['column', 'kanban']);
|
||||||
|
Item_Kanban::showColumn($_REQUEST['kanban']['itemtype'], $_REQUEST['kanban']['items_id'], $_REQUEST['column']);
|
||||||
|
} else if ($_REQUEST['action'] == 'hide_column') {
|
||||||
|
$checkParams(['column', 'kanban']);
|
||||||
|
Item_Kanban::hideColumn($_REQUEST['kanban']['itemtype'], $_REQUEST['kanban']['items_id'], $_REQUEST['column']);
|
||||||
|
} else if ($_REQUEST['action'] == 'collapse_column') {
|
||||||
|
$checkParams(['column', 'kanban']);
|
||||||
|
Item_Kanban::collapseColumn($_REQUEST['kanban']['itemtype'], $_REQUEST['kanban']['items_id'], $_REQUEST['column']);
|
||||||
|
} else if ($_REQUEST['action'] == 'expand_column') {
|
||||||
|
$checkParams(['column', 'kanban']);
|
||||||
|
Item_Kanban::expandColumn($_REQUEST['kanban']['itemtype'], $_REQUEST['kanban']['items_id'], $_REQUEST['column']);
|
||||||
|
} else if ($_REQUEST['action'] == 'move_column') {
|
||||||
|
$checkParams(['column', 'kanban', 'position']);
|
||||||
|
Item_Kanban::moveColumn($_REQUEST['kanban']['itemtype'], $_REQUEST['kanban']['items_id'],
|
||||||
|
$_REQUEST['column'], $_REQUEST['position']);
|
||||||
|
} else if ($_REQUEST['action'] == 'refresh') {
|
||||||
|
$checkParams(['column_field']);
|
||||||
|
// Get all columns to refresh the kanban
|
||||||
|
header("Content-Type: application/json; charset=UTF-8", true);
|
||||||
|
$force_columns = Item_Kanban::getAllShownColumns($itemtype, $_REQUEST['items_id']);
|
||||||
|
$columns = $itemtype::getKanbanColumns($_REQUEST['items_id'], $_REQUEST['column_field'], $force_columns, true);
|
||||||
|
echo json_encode($columns, JSON_FORCE_OBJECT);
|
||||||
|
} else if ($_REQUEST['action'] == 'get_switcher_dropdown') {
|
||||||
|
$values = $itemtype::getAllForKanban();
|
||||||
|
Dropdown::showFromArray('kanban-board-switcher', $values, [
|
||||||
|
'value' => isset($_REQUEST['items_id']) ? $_REQUEST['items_id'] : ''
|
||||||
|
]);
|
||||||
|
} else if ($_REQUEST['action'] == 'get_url') {
|
||||||
|
$checkParams(['items_id']);
|
||||||
|
if ($_REQUEST['items_id'] == -1) {
|
||||||
|
echo $itemtype::getFormURL(true).'?showglobalkanban=1';
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
$item->getFromDB($_REQUEST['items_id']);
|
||||||
|
$tabs = $item->defineTabs();
|
||||||
|
$tab_id = array_search(__('Kanban'), $tabs);
|
||||||
|
if (is_null($tab_id) || false === $tab_id) {
|
||||||
|
Toolbox::logError("Itemtype does not have a Kanban tab!");
|
||||||
|
http_response_code(400);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
echo $itemtype::getFormURLWithID($_REQUEST['items_id'], true)."&forcetab={$tab_id}";
|
||||||
|
} else if ($_REQUEST['action'] == 'create_column') {
|
||||||
|
$checkParams(['column_field', 'items_id', 'column_name']);
|
||||||
|
$column_field = $_REQUEST['column_field'];
|
||||||
|
$column_itemtype = getItemtypeForForeignKeyField($column_field);
|
||||||
|
if (!$column_itemtype::canCreate() || !$column_itemtype::canView()) {
|
||||||
|
// Missing rights
|
||||||
|
http_response_code(403);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
$params = $_REQUEST['params'] ?? [];
|
||||||
|
$column_item = new $column_itemtype();
|
||||||
|
$column_id = $column_item->add([
|
||||||
|
'name' => $_REQUEST['column_name']
|
||||||
|
] + $params);
|
||||||
|
header("Content-Type: application/json; charset=UTF-8", true);
|
||||||
|
$column = $itemtype::getKanbanColumns($_REQUEST['items_id'], $column_field, [$column_id]);
|
||||||
|
echo json_encode($column);
|
||||||
|
} else if ($_REQUEST['action'] == 'save_column_state') {
|
||||||
|
$checkParams(['items_id', 'state']);
|
||||||
|
Item_Kanban::saveStateForItem($_REQUEST['itemtype'], $_REQUEST['items_id'], $_REQUEST['state']);
|
||||||
|
} else if ($_REQUEST['action'] == 'load_column_state') {
|
||||||
|
$checkParams(['items_id', 'last_load']);
|
||||||
|
header("Content-Type: application/json; charset=UTF-8", true);
|
||||||
|
$response = [
|
||||||
|
'state' => Item_Kanban::loadStateForItem($_REQUEST['itemtype'], $_REQUEST['items_id'], $_REQUEST['last_load']),
|
||||||
|
'timestamp' => $_SESSION['glpi_currenttime']
|
||||||
|
];
|
||||||
|
echo json_encode($response, JSON_FORCE_OBJECT);
|
||||||
|
} else if ($_REQUEST['action'] == 'list_columns') {
|
||||||
|
$checkParams(['column_field']);
|
||||||
|
header("Content-Type: application/json; charset=UTF-8", true);
|
||||||
|
echo json_encode($itemtype::getAllKanbanColumns($_REQUEST['column_field']));
|
||||||
|
} else if ($_REQUEST['action'] == 'get_column') {
|
||||||
|
$checkParams(['column_id', 'column_field', 'items_id']);
|
||||||
|
header("Content-Type: application/json; charset=UTF-8", true);
|
||||||
|
$column = $itemtype::getKanbanColumns($_REQUEST['items_id'], $_REQUEST['column_field'], [$_REQUEST['column_id']]);
|
||||||
|
echo json_encode($column, JSON_FORCE_OBJECT);
|
||||||
|
}
|
||||||
59
ajax/kblink.php
Normal file
59
ajax/kblink.php
Normal file
@ -0,0 +1,59 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* ---------------------------------------------------------------------
|
||||||
|
* GLPI - Gestionnaire Libre de Parc Informatique
|
||||||
|
* Copyright (C) 2015-2020 Teclib' and contributors.
|
||||||
|
*
|
||||||
|
* http://glpi-project.org
|
||||||
|
*
|
||||||
|
* based on GLPI - Gestionnaire Libre de Parc Informatique
|
||||||
|
* Copyright (C) 2003-2014 by the INDEPNET Development Team.
|
||||||
|
*
|
||||||
|
* ---------------------------------------------------------------------
|
||||||
|
*
|
||||||
|
* LICENSE
|
||||||
|
*
|
||||||
|
* This file is part of GLPI.
|
||||||
|
*
|
||||||
|
* GLPI 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 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* GLPI 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 GLPI. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
* ---------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retrieve the knowledgebase links associated to a category
|
||||||
|
* @since 9.2
|
||||||
|
*/
|
||||||
|
|
||||||
|
include ('../inc/includes.php');
|
||||||
|
|
||||||
|
// Send UTF8 Headers
|
||||||
|
header("Content-Type: text/html; charset=UTF-8");
|
||||||
|
Html::header_nocache();
|
||||||
|
|
||||||
|
Session::checkLoginUser();
|
||||||
|
|
||||||
|
if (isset($_POST["table"])
|
||||||
|
&& isset($_POST["value"])) {
|
||||||
|
// Security
|
||||||
|
if (!$DB->tableExists($_POST['table'])) {
|
||||||
|
exit();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isset($_POST['withlink'])) {
|
||||||
|
$itemtype = getItemTypeForTable($_POST["table"]);
|
||||||
|
$item = new $itemtype;
|
||||||
|
$item->getFromDB(intval($_POST["value"]));
|
||||||
|
echo ' '.$item->getLinks();
|
||||||
|
}
|
||||||
|
}
|
||||||
49
ajax/knowbase.php
Normal file
49
ajax/knowbase.php
Normal file
@ -0,0 +1,49 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* ---------------------------------------------------------------------
|
||||||
|
* GLPI - Gestionnaire Libre de Parc Informatique
|
||||||
|
* Copyright (C) 2015-2020 Teclib' and contributors.
|
||||||
|
*
|
||||||
|
* http://glpi-project.org
|
||||||
|
*
|
||||||
|
* based on GLPI - Gestionnaire Libre de Parc Informatique
|
||||||
|
* Copyright (C) 2003-2014 by the INDEPNET Development Team.
|
||||||
|
*
|
||||||
|
* ---------------------------------------------------------------------
|
||||||
|
*
|
||||||
|
* LICENSE
|
||||||
|
*
|
||||||
|
* This file is part of GLPI.
|
||||||
|
*
|
||||||
|
* GLPI 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 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* GLPI 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 GLPI. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
* ---------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
|
include ('../inc/includes.php');
|
||||||
|
Html::header_nocache();
|
||||||
|
|
||||||
|
if (!$CFG_GLPI["use_public_faq"]
|
||||||
|
&& !Session::haveRightsOr('knowbase', [KnowbaseItem::READFAQ, READ])) {
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
switch ($_REQUEST['action']) {
|
||||||
|
case "getItemslist";
|
||||||
|
header("Content-Type: application/json; charset=UTF-8");
|
||||||
|
KnowbaseItem::showList([
|
||||||
|
'knowbaseitemcategories_id' => (int) $_REQUEST['cat_id'],
|
||||||
|
'start' => (int) $_REQUEST['start'],
|
||||||
|
], 'browse');
|
||||||
|
break;
|
||||||
|
}
|
||||||
42
ajax/ldapdaterestriction.php
Normal file
42
ajax/ldapdaterestriction.php
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* ---------------------------------------------------------------------
|
||||||
|
* GLPI - Gestionnaire Libre de Parc Informatique
|
||||||
|
* Copyright (C) 2015-2020 Teclib' and contributors.
|
||||||
|
*
|
||||||
|
* http://glpi-project.org
|
||||||
|
*
|
||||||
|
* based on GLPI - Gestionnaire Libre de Parc Informatique
|
||||||
|
* Copyright (C) 2003-2014 by the INDEPNET Development Team.
|
||||||
|
*
|
||||||
|
* ---------------------------------------------------------------------
|
||||||
|
*
|
||||||
|
* LICENSE
|
||||||
|
*
|
||||||
|
* This file is part of GLPI.
|
||||||
|
*
|
||||||
|
* GLPI 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 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* GLPI 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 GLPI. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
* ---------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
|
if (strpos($_SERVER['PHP_SELF'], "ldapdaterestriction.php")) {
|
||||||
|
include ('../inc/includes.php');
|
||||||
|
header("Content-Type: text/html; charset=UTF-8");
|
||||||
|
Html::header_nocache();
|
||||||
|
} else if (!defined('GLPI_ROOT')) {
|
||||||
|
die("Sorry. You can't access this file directly");
|
||||||
|
}
|
||||||
|
|
||||||
|
Session::checkLoginUser();
|
||||||
|
AuthLDAP::showDateRestrictionForm($_POST);
|
||||||
77
ajax/mailcollector.php
Normal file
77
ajax/mailcollector.php
Normal file
@ -0,0 +1,77 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* ---------------------------------------------------------------------
|
||||||
|
* GLPI - Gestionnaire Libre de Parc Informatique
|
||||||
|
* Copyright (C) 2015-2020 Teclib' and contributors.
|
||||||
|
*
|
||||||
|
* http://glpi-project.org
|
||||||
|
*
|
||||||
|
* based on GLPI - Gestionnaire Libre de Parc Informatique
|
||||||
|
* Copyright (C) 2003-2014 by the INDEPNET Development Team.
|
||||||
|
*
|
||||||
|
* ---------------------------------------------------------------------
|
||||||
|
*
|
||||||
|
* LICENSE
|
||||||
|
*
|
||||||
|
* This file is part of GLPI.
|
||||||
|
*
|
||||||
|
* GLPI 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 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* GLPI 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 GLPI. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
* ---------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
|
$AJAX_INCLUDE = 1;
|
||||||
|
include ('../inc/includes.php');
|
||||||
|
|
||||||
|
// Send UTF8 Headers
|
||||||
|
header("Content-Type: text/html; charset=UTF-8");
|
||||||
|
Html::header_nocache();
|
||||||
|
|
||||||
|
Session::checkLoginUser();
|
||||||
|
|
||||||
|
$mailcollector = new MailCollector;
|
||||||
|
|
||||||
|
if (isset($_REQUEST['action'])) {
|
||||||
|
switch ($_REQUEST['action']) {
|
||||||
|
case "getFoldersList":
|
||||||
|
// Load config if already exists
|
||||||
|
// Necessary if password is not updated
|
||||||
|
if (array_key_exists('id', $_REQUEST)) {
|
||||||
|
$mailcollector->getFromDB($_REQUEST['id']);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Update fields with input values
|
||||||
|
$input = $_REQUEST;
|
||||||
|
$input['login'] = stripslashes($input['login']);
|
||||||
|
|
||||||
|
if (isset($input["passwd"])) {
|
||||||
|
if (empty($input["passwd"])) {
|
||||||
|
unset($input["passwd"]);
|
||||||
|
} else {
|
||||||
|
$input["passwd"] = Toolbox::sodiumEncrypt(stripslashes($input["passwd"]));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isset($input['mail_server']) && !empty($input['mail_server'])) {
|
||||||
|
$input["host"] = Toolbox::constructMailServerConfig($input);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!isset($input['errors'])) {
|
||||||
|
$input['errors'] = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
$mailcollector->fields = array_merge($mailcollector->fields, $input);
|
||||||
|
echo $mailcollector->displayFoldersList($_REQUEST['input_id']);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
113
ajax/map.php
Normal file
113
ajax/map.php
Normal file
@ -0,0 +1,113 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* ---------------------------------------------------------------------
|
||||||
|
* GLPI - Gestionnaire Libre de Parc Informatique
|
||||||
|
* Copyright (C) 2015-2020 Teclib' and contributors.
|
||||||
|
*
|
||||||
|
* http://glpi-project.org
|
||||||
|
*
|
||||||
|
* based on GLPI - Gestionnaire Libre de Parc Informatique
|
||||||
|
* Copyright (C) 2003-2014 by the INDEPNET Development Team.
|
||||||
|
*
|
||||||
|
* ---------------------------------------------------------------------
|
||||||
|
*
|
||||||
|
* LICENSE
|
||||||
|
*
|
||||||
|
* This file is part of GLPI.
|
||||||
|
*
|
||||||
|
* GLPI 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 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* GLPI 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 GLPI. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
* ---------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
|
include ('../inc/includes.php');
|
||||||
|
header("Content-Type: application/json; charset=UTF-8");
|
||||||
|
Html::header_nocache();
|
||||||
|
|
||||||
|
Session::checkLoginUser();
|
||||||
|
|
||||||
|
$result = [];
|
||||||
|
if (!isset($_POST['itemtype']) || !isset($_POST['params'])) {
|
||||||
|
http_response_code (500);
|
||||||
|
$result = [
|
||||||
|
'success' => false,
|
||||||
|
'message' => __('Required argument missing!')
|
||||||
|
];
|
||||||
|
} else {
|
||||||
|
$itemtype = $_POST['itemtype'];
|
||||||
|
$params = $_POST['params'];
|
||||||
|
|
||||||
|
$data = Search::prepareDatasForSearch($itemtype, $params);
|
||||||
|
Search::constructSQL($data);
|
||||||
|
Search::constructData($data);
|
||||||
|
|
||||||
|
if ($itemtype == 'Location') {
|
||||||
|
$lat_field = $itemtype . '_21';
|
||||||
|
$lng_field = $itemtype . '_20';
|
||||||
|
$name_field = $itemtype . '_1';
|
||||||
|
} else if ($itemtype == 'Entity') {
|
||||||
|
$lat_field = $itemtype . '_67';
|
||||||
|
$lng_field = $itemtype . '_68';
|
||||||
|
$name_field = $itemtype . '_1';
|
||||||
|
} else {
|
||||||
|
$lat_field = $itemtype . '_998';
|
||||||
|
$lng_field = $itemtype . '_999';
|
||||||
|
$name_field = $itemtype . '_3';
|
||||||
|
}
|
||||||
|
if ($itemtype == 'Ticket') {
|
||||||
|
//duplicate search options... again!
|
||||||
|
$name_field = $itemtype . '_83';
|
||||||
|
}
|
||||||
|
|
||||||
|
$rows = $data['data']['rows'];
|
||||||
|
$points = [];
|
||||||
|
foreach ($rows as $row) {
|
||||||
|
$idx = $row['raw']["ITEM_$lat_field"] . ',' . $row['raw']["ITEM_$lng_field"];
|
||||||
|
if (isset($points[$idx])) {
|
||||||
|
$points[$idx]['count'] += 1;
|
||||||
|
} else {
|
||||||
|
if ($itemtype == 'Entity') {
|
||||||
|
$points[$idx] = [
|
||||||
|
'lat' => $row['raw']["ITEM_$lat_field"],
|
||||||
|
'lng' => $row['raw']["ITEM_$lng_field"],
|
||||||
|
'title' => $row['raw']["ITEM_$name_field"],
|
||||||
|
'count' => 1
|
||||||
|
];
|
||||||
|
} else {
|
||||||
|
$points[$idx] = [
|
||||||
|
'lat' => $row['raw']["ITEM_$lat_field"],
|
||||||
|
'lng' => $row['raw']["ITEM_$lng_field"],
|
||||||
|
'title' => $row['raw']["ITEM_$name_field"],
|
||||||
|
'loc_id' => $row['raw']['loc_id'],
|
||||||
|
'count' => 1
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($itemtype == 'AllAssets') {
|
||||||
|
$curtype = $row['TYPE'];
|
||||||
|
if (isset($points[$idx]['types'][$curtype])) {
|
||||||
|
$points[$idx]['types'][$curtype]['count']++;
|
||||||
|
$points[$idx]['types'][$curtype]['name'] = strtolower($curtype::getTypeName(Session::getPluralNumber()));
|
||||||
|
} else {
|
||||||
|
$points[$idx]['types'][$curtype] = [
|
||||||
|
'name' => strtolower($curtype::getTypeName(1)),
|
||||||
|
'count' => 1
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$result['points'] = $points;
|
||||||
|
}
|
||||||
|
|
||||||
|
echo json_encode($result);
|
||||||
117
ajax/marketplace.php
Normal file
117
ajax/marketplace.php
Normal file
@ -0,0 +1,117 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* ---------------------------------------------------------------------
|
||||||
|
* GLPI - Gestionnaire Libre de Parc Informatique
|
||||||
|
* Copyright (C) 2015-2020 Teclib' and contributors.
|
||||||
|
*
|
||||||
|
* http://glpi-project.org
|
||||||
|
*
|
||||||
|
* based on GLPI - Gestionnaire Libre de Parc Informatique
|
||||||
|
* Copyright (C) 2003-2014 by the INDEPNET Development Team.
|
||||||
|
*
|
||||||
|
* ---------------------------------------------------------------------
|
||||||
|
*
|
||||||
|
* LICENSE
|
||||||
|
*
|
||||||
|
* This file is part of GLPI.
|
||||||
|
*
|
||||||
|
* GLPI 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 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* GLPI 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 GLPI. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
* ---------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
|
global $PLUGINS_EXCLUDED;
|
||||||
|
|
||||||
|
// follow download progress of a plugin with a minimal loading of files
|
||||||
|
// So we get a ajax answer in 5ms instead 100ms
|
||||||
|
if (isset($_REQUEST["action"]) && $_REQUEST["action"] == "get_dl_progress") {
|
||||||
|
if (!defined('GLPI_ROOT')) {
|
||||||
|
define('GLPI_ROOT', dirname(__DIR__));
|
||||||
|
}
|
||||||
|
|
||||||
|
include_once GLPI_ROOT . '/inc/based_config.php';
|
||||||
|
Session::setPath();
|
||||||
|
Session::start();
|
||||||
|
|
||||||
|
echo $_SESSION['marketplace_dl_progress'][$_REQUEST['key']] ?? 0;
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($_REQUEST["action"] == "download_plugin" || $_REQUEST["action"] == "update_plugin") {
|
||||||
|
// Do not load plugin that will be updated, to be able to load its new informations
|
||||||
|
// by redefining its plugin_version_ function after files replacement.
|
||||||
|
$PLUGINS_EXCLUDED = [$_REQUEST['key']];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// get common marketplace action, load GLPI framework
|
||||||
|
include ("../inc/includes.php");
|
||||||
|
|
||||||
|
Session::checkRight("config", UPDATE);
|
||||||
|
|
||||||
|
use Glpi\Marketplace\Controller as MarketplaceController;
|
||||||
|
use Glpi\Marketplace\View as MarketplaceView;
|
||||||
|
|
||||||
|
if (isset($_REQUEST['key'])) {
|
||||||
|
$marketplace_ctrl = new MarketplaceController($_REQUEST['key']);
|
||||||
|
if ($_REQUEST["action"] == "download_plugin"
|
||||||
|
|| $_REQUEST["action"] == "update_plugin") {
|
||||||
|
$marketplace_ctrl->downloadPlugin();
|
||||||
|
}
|
||||||
|
if ($_REQUEST["action"] == "clean_plugin") {
|
||||||
|
if ($marketplace_ctrl->cleanPlugin()) {
|
||||||
|
echo "cleaned";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ($_REQUEST["action"] == "install_plugin") {
|
||||||
|
$marketplace_ctrl->installPlugin();
|
||||||
|
}
|
||||||
|
if ($_REQUEST["action"] == "uninstall_plugin") {
|
||||||
|
$marketplace_ctrl->uninstallPlugin();
|
||||||
|
}
|
||||||
|
if ($_REQUEST["action"] == "enable_plugin") {
|
||||||
|
$marketplace_ctrl->enablePlugin();
|
||||||
|
}
|
||||||
|
if ($_REQUEST["action"] == "disable_plugin") {
|
||||||
|
$marketplace_ctrl->disablePlugin();
|
||||||
|
}
|
||||||
|
|
||||||
|
echo MarketplaceView::getButtons($_REQUEST['key']);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($_REQUEST["action"] == "refresh_plugin_list") {
|
||||||
|
switch ($_REQUEST['tab']) {
|
||||||
|
default:
|
||||||
|
case 'discover':
|
||||||
|
echo MarketplaceView::discover(
|
||||||
|
$_REQUEST['force'] ?? false,
|
||||||
|
true,
|
||||||
|
$_REQUEST['tag'] ?? "",
|
||||||
|
$_REQUEST['filter'] ?? "",
|
||||||
|
$_REQUEST['page'] ?? 1,
|
||||||
|
$_REQUEST['sort'] ?? "sort-alpha-asc"
|
||||||
|
);
|
||||||
|
break;
|
||||||
|
case 'installed':
|
||||||
|
echo MarketplaceView::installed(true, true, $_REQUEST['filter'] ?? "");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($_REQUEST["action"] == "getPagination") {
|
||||||
|
echo MarketplaceView::getPaginationHtml(
|
||||||
|
$_REQUEST['page'] ?? 1,
|
||||||
|
$_REQUEST['total'] ?? 1,
|
||||||
|
true
|
||||||
|
);
|
||||||
|
}
|
||||||
90
ajax/massiveaction.php
Normal file
90
ajax/massiveaction.php
Normal file
@ -0,0 +1,90 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* ---------------------------------------------------------------------
|
||||||
|
* GLPI - Gestionnaire Libre de Parc Informatique
|
||||||
|
* Copyright (C) 2015-2020 Teclib' and contributors.
|
||||||
|
*
|
||||||
|
* http://glpi-project.org
|
||||||
|
*
|
||||||
|
* based on GLPI - Gestionnaire Libre de Parc Informatique
|
||||||
|
* Copyright (C) 2003-2014 by the INDEPNET Development Team.
|
||||||
|
*
|
||||||
|
* ---------------------------------------------------------------------
|
||||||
|
*
|
||||||
|
* LICENSE
|
||||||
|
*
|
||||||
|
* This file is part of GLPI.
|
||||||
|
*
|
||||||
|
* GLPI 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 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* GLPI 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 GLPI. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
* ---------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @since 0.84
|
||||||
|
*/
|
||||||
|
|
||||||
|
include ('../inc/includes.php');
|
||||||
|
|
||||||
|
header("Content-Type: text/html; charset=UTF-8");
|
||||||
|
Html::header_nocache();
|
||||||
|
|
||||||
|
Session::checkLoginUser();
|
||||||
|
|
||||||
|
try {
|
||||||
|
$ma = new MassiveAction($_POST, $_GET, 'initial');
|
||||||
|
} catch (Exception $e) {
|
||||||
|
|
||||||
|
echo "<div class='center'><img src='".$CFG_GLPI["root_doc"]."/pics/warning.png' alt='".
|
||||||
|
__s('Warning')."'><br><br>";
|
||||||
|
echo "<span class='b'>".$e->getMessage()."</span><br>";
|
||||||
|
echo "</div>";
|
||||||
|
exit();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
echo "<div class='center massiveactions'>";
|
||||||
|
Html::openMassiveActionsForm();
|
||||||
|
$params = ['action' => '__VALUE__'];
|
||||||
|
$input = $ma->getInput();
|
||||||
|
foreach ($input as $key => $val) {
|
||||||
|
$params[$key] = $val;
|
||||||
|
}
|
||||||
|
|
||||||
|
$actions = $params['actions'];
|
||||||
|
|
||||||
|
if (count($actions)) {
|
||||||
|
if (isset($params['hidden']) && is_array($params['hidden'])) {
|
||||||
|
foreach ($params['hidden'] as $key => $val) {
|
||||||
|
echo Html::hidden($key, ['value' => $val]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
echo _n('Action', 'Actions', 1);
|
||||||
|
echo " ";
|
||||||
|
|
||||||
|
$actions = ['-1' => Dropdown::EMPTY_VALUE] + $actions;
|
||||||
|
$rand = Dropdown::showFromArray('massiveaction', $actions);
|
||||||
|
|
||||||
|
echo "<br><br>";
|
||||||
|
|
||||||
|
Ajax::updateItemOnSelectEvent("dropdown_massiveaction$rand", "show_massiveaction$rand",
|
||||||
|
$CFG_GLPI["root_doc"]."/ajax/dropdownMassiveAction.php",
|
||||||
|
$params);
|
||||||
|
|
||||||
|
echo "<span id='show_massiveaction$rand'> </span>\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
// Force 'checkbox-zero-on-empty', because some massive actions can use checkboxes
|
||||||
|
$CFG_GLPI['checkbox-zero-on-empty'] = true;
|
||||||
|
Html::closeForm();
|
||||||
|
echo "</div>";
|
||||||
45
ajax/notifications_ajax.php
Normal file
45
ajax/notifications_ajax.php
Normal file
@ -0,0 +1,45 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* ---------------------------------------------------------------------
|
||||||
|
* GLPI - Gestionnaire Libre de Parc Informatique
|
||||||
|
* Copyright (C) 2015-2020 Teclib' and contributors.
|
||||||
|
*
|
||||||
|
* http://glpi-project.org
|
||||||
|
*
|
||||||
|
* based on GLPI - Gestionnaire Libre de Parc Informatique
|
||||||
|
* Copyright (C) 2003-2014 by the INDEPNET Development Team.
|
||||||
|
*
|
||||||
|
* ---------------------------------------------------------------------
|
||||||
|
*
|
||||||
|
* LICENSE
|
||||||
|
*
|
||||||
|
* This file is part of GLPI.
|
||||||
|
*
|
||||||
|
* GLPI 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 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* GLPI 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 GLPI. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
* ---------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
|
include ("../inc/includes.php");
|
||||||
|
|
||||||
|
Session::checkLoginUser();
|
||||||
|
|
||||||
|
header('Content-Type: application/json; charset=utf-8');
|
||||||
|
|
||||||
|
if (isset($_GET['delete'])) {
|
||||||
|
NotificationAjax::raisedNotification($_GET['delete']);
|
||||||
|
echo json_encode(true);
|
||||||
|
} else {
|
||||||
|
$return = NotificationAjax::getMyNotifications();
|
||||||
|
echo json_encode($return, JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE);
|
||||||
|
}
|
||||||
234
ajax/payroll.period.php
Normal file
234
ajax/payroll.period.php
Normal file
@ -0,0 +1,234 @@
|
|||||||
|
<?php
|
||||||
|
if (!defined('GLPI_ROOT')) {
|
||||||
|
define('GLPI_ROOT', dirname(__DIR__));
|
||||||
|
}
|
||||||
|
|
||||||
|
include_once GLPI_ROOT . '/inc/based_config.php';
|
||||||
|
// Init Timer to compute time of display
|
||||||
|
$TIMER_DEBUG = new Timer();
|
||||||
|
$TIMER_DEBUG->start();
|
||||||
|
|
||||||
|
// TODO try to remove them if possible
|
||||||
|
include_once(GLPI_ROOT . "/inc/db.function.php");
|
||||||
|
// Standard includes
|
||||||
|
include_once(GLPI_ROOT . "/inc/config.php");
|
||||||
|
// Disabled errors => pour le variable res (Ajax)
|
||||||
|
ini_set('display_errors', 0);
|
||||||
|
|
||||||
|
Session::checkLoginUser();
|
||||||
|
global $DB;
|
||||||
|
|
||||||
|
function add(array $request) {
|
||||||
|
global $DB;
|
||||||
|
|
||||||
|
// Validate input data
|
||||||
|
if (isset($request["month"], $request["year"], $request["start_date"], $request["end_date"]) &&
|
||||||
|
!empty($request["month"]) && !empty($request["year"]) && !empty($request["start_date"]) && !empty($request["end_date"])) {
|
||||||
|
|
||||||
|
// Validate the year
|
||||||
|
if (!is_numeric($request["year"]) || strlen($request["year"]) !== 4) {
|
||||||
|
echo json_encode(["status" => "error", "message" => "Format de l'année invalide ! Veuillez entrer une année valide (par exemple, 2025)."]);
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Validate the month (numeric or string month name)
|
||||||
|
if (is_numeric($request["month"])) {
|
||||||
|
$month = (int) $request["month"];
|
||||||
|
if ($month < 1 || $month > 12) {
|
||||||
|
echo json_encode(["status" => "error", "message" => "Mois invalide ! Veuillez entrer un numéro de mois valide (1-12)."]);
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Validate that start_date is before end_date
|
||||||
|
$start_date = strtotime($request["start_date"]);
|
||||||
|
$end_date = strtotime($request["end_date"]);
|
||||||
|
|
||||||
|
if ($start_date === false || $end_date === false) {
|
||||||
|
echo json_encode(["status" => "error", "message" => "Format de date invalide ! Veuillez fournir des dates de début et de fin valides."]);
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($start_date > $end_date) {
|
||||||
|
echo json_encode(["status" => "error", "message" => "La date de début doit être antérieure à la date de fin."]);
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check if there's already an existing record for the same year and month
|
||||||
|
$query = $DB->prepare("SELECT COUNT(*) FROM payroll_period WHERE year = ? AND month = ? AND is_deleted = FALSE");
|
||||||
|
$query->bind_param("ii", $request["year"], $request["month"]);
|
||||||
|
$query->execute();
|
||||||
|
$query->bind_result($count);
|
||||||
|
$query->fetch();
|
||||||
|
$query->close();
|
||||||
|
|
||||||
|
if ($count > 0) {
|
||||||
|
echo json_encode(["status" => "error", "message" => "Un période de paie pour ce mois et cette année existe déjà."]);
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Prepare the SQL statement
|
||||||
|
$stmt = $DB->prepare("
|
||||||
|
INSERT INTO payroll_period (month, year, start_date, end_date, created_on, created_by)
|
||||||
|
VALUES (?, ?, ?, ?, NOW(), ?)
|
||||||
|
");
|
||||||
|
|
||||||
|
// Bind the parameters
|
||||||
|
$stmt->bind_param(
|
||||||
|
"iissi",
|
||||||
|
$request["month"],
|
||||||
|
$request["year"],
|
||||||
|
$request["start_date"],
|
||||||
|
$request["end_date"],
|
||||||
|
$_SESSION["glpiID"]
|
||||||
|
);
|
||||||
|
|
||||||
|
// Execute the statement
|
||||||
|
if ($stmt->execute()) {
|
||||||
|
echo json_encode(["status" => "success", "message" => "Période de paie ajoutée avec succès."]);
|
||||||
|
} else {
|
||||||
|
echo json_encode(["status" => "error", "message" => "Échec de l'ajout de la période de paie."]);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Close the statement
|
||||||
|
$stmt->close();
|
||||||
|
exit;
|
||||||
|
|
||||||
|
} else {
|
||||||
|
// Handle validation errors
|
||||||
|
echo json_encode(["status" => "error", "message" => "Tous les champs (Mois, Année, Date de début, Date de fin) sont requis !"]);
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function update(array $request) {
|
||||||
|
global $DB;
|
||||||
|
|
||||||
|
// Validate input data
|
||||||
|
if (isset($request["id"], $request["month"], $request["year"], $request["start_date"], $request["end_date"]) &&
|
||||||
|
!empty($request["id"]) && !empty($request["month"]) && !empty($request["year"]) && !empty($request["start_date"]) && !empty($request["end_date"])) {
|
||||||
|
|
||||||
|
// Validate the year
|
||||||
|
if (!is_numeric($request["year"]) || strlen($request["year"]) !== 4) {
|
||||||
|
echo json_encode(["status" => "error", "message" => "Format de l'année invalide ! Veuillez entrer une année valide."]);
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Validate the month
|
||||||
|
$month = (int) $request["month"];
|
||||||
|
if ($month < 1 || $month > 12) {
|
||||||
|
echo json_encode(["status" => "error", "message" => "Mois invalide ! Veuillez entrer un numéro de mois valide."]);
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Validate date range
|
||||||
|
$start_date = strtotime($request["start_date"]);
|
||||||
|
$end_date = strtotime($request["end_date"]);
|
||||||
|
|
||||||
|
if ($start_date === false || $end_date === false) {
|
||||||
|
echo json_encode(["status" => "error", "message" => "Format de date invalide ! Veuillez fournir des dates valides."]);
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($start_date > $end_date) {
|
||||||
|
echo json_encode(["status" => "error", "message" => "La date de début doit être antérieure à la date de fin."]);
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check if the record exists
|
||||||
|
$query = $DB->prepare("SELECT id FROM payroll_period WHERE id = ? AND is_deleted = FALSE");
|
||||||
|
$query->bind_param("i", $request["id"]);
|
||||||
|
$query->execute();
|
||||||
|
$query->store_result();
|
||||||
|
|
||||||
|
if ($query->num_rows === 0) {
|
||||||
|
echo json_encode(["status" => "error", "message" => "Période de paie non trouvée."]);
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Prepare the update SQL statement
|
||||||
|
$stmt = $DB->prepare("
|
||||||
|
UPDATE payroll_period
|
||||||
|
SET month = ?, year = ?, start_date = ?, end_date = ?, updated_on = NOW(), updated_by = ?
|
||||||
|
WHERE id = ?
|
||||||
|
");
|
||||||
|
|
||||||
|
// Bind the parameters
|
||||||
|
$stmt->bind_param(
|
||||||
|
"iissii",
|
||||||
|
$request["month"],
|
||||||
|
$request["year"],
|
||||||
|
$request["start_date"],
|
||||||
|
$request["end_date"],
|
||||||
|
$_SESSION["glpiID"],
|
||||||
|
$request["id"]
|
||||||
|
);
|
||||||
|
|
||||||
|
// Execute the statement
|
||||||
|
if ($stmt->execute()) {
|
||||||
|
echo json_encode(["status" => "success", "message" => "Période de paie mise à jour avec succès."]);
|
||||||
|
} else {
|
||||||
|
echo json_encode(["status" => "error", "message" => "Échec de la mise à jour de la période de paie."]);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Close the statement
|
||||||
|
$stmt->close();
|
||||||
|
exit;
|
||||||
|
} else {
|
||||||
|
// Handle validation errors
|
||||||
|
echo json_encode(["status" => "error", "message" => "Tous les champs (ID, Mois, Année, Date de début, Date de fin) sont requis."]);
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function delete(array $request) {
|
||||||
|
global $DB;
|
||||||
|
|
||||||
|
if (!isset($_POST['id']) || empty($_POST['id'])) {
|
||||||
|
echo json_encode(['status' => 'error', 'message' => 'ID invalide.']);
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
$id = intval($_POST['id']);
|
||||||
|
$deleted_by = $_SESSION["glpiID"];
|
||||||
|
|
||||||
|
$stmt = $DB->prepare("
|
||||||
|
UPDATE payroll_period
|
||||||
|
SET is_deleted = TRUE,
|
||||||
|
deleted_on = NOW(),
|
||||||
|
deleted_by = ?
|
||||||
|
WHERE id = ?
|
||||||
|
");
|
||||||
|
|
||||||
|
$stmt->bind_param('ii', $deleted_by, $id);
|
||||||
|
|
||||||
|
if ($stmt->execute()) {
|
||||||
|
echo json_encode(["status" => "success", "message" => "Période de paie supprimée avec succès."]);
|
||||||
|
} else {
|
||||||
|
echo json_encode(["status" => "error", "message" => "Échec de la suppression de la période de paie."]);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Close the statement
|
||||||
|
$stmt->close();
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if (isset($_POST)) {
|
||||||
|
switch ($_GET['action']) {
|
||||||
|
case "add":
|
||||||
|
return add($_POST);
|
||||||
|
break;
|
||||||
|
case "delete":
|
||||||
|
return delete($_POST);
|
||||||
|
break;
|
||||||
|
case "update":
|
||||||
|
return update($_POST);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
echo json_encode(["status" => "error", "message" => "Action non reconnue."]);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
?>
|
||||||
143
ajax/picklist.php
Normal file
143
ajax/picklist.php
Normal file
@ -0,0 +1,143 @@
|
|||||||
|
<?php
|
||||||
|
if (!defined('GLPI_ROOT')) {
|
||||||
|
define('GLPI_ROOT', dirname(__DIR__));
|
||||||
|
}
|
||||||
|
|
||||||
|
include_once GLPI_ROOT . '/inc/based_config.php';
|
||||||
|
// Init Timer to compute time of display
|
||||||
|
$TIMER_DEBUG = new Timer();
|
||||||
|
$TIMER_DEBUG->start();
|
||||||
|
/// TODO try to remove them if possible
|
||||||
|
include_once (GLPI_ROOT . "/inc/db.function.php");
|
||||||
|
// Standard includes
|
||||||
|
include_once (GLPI_ROOT . "/inc/config.php");
|
||||||
|
//disbled errors =>pour le variable res (Ajax)
|
||||||
|
ini_set('display_errors', 0);
|
||||||
|
|
||||||
|
Session::checkLoginUser();
|
||||||
|
global $DB;
|
||||||
|
|
||||||
|
// === Add picklist item ===
|
||||||
|
function add($data) {
|
||||||
|
global $DB;
|
||||||
|
|
||||||
|
$name = $data['type'] ?? '';
|
||||||
|
$value = $data['value'] ?? '';
|
||||||
|
$created_by = Session::getLoginUserID();
|
||||||
|
|
||||||
|
if (empty($name) || empty($value)) {
|
||||||
|
echo json_encode(['status' => 'error', 'message' => 'Type et valeur sont requis.']);
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
$stmt = $DB->prepare("INSERT INTO picklist (name, value, created_on, created_by) VALUES (?, ?, NOW(), ?)");
|
||||||
|
$stmt->bind_param("ssi", $name, $value, $created_by);
|
||||||
|
|
||||||
|
if ($stmt->execute()) {
|
||||||
|
echo json_encode(['status' => 'success']);
|
||||||
|
} else {
|
||||||
|
echo json_encode(['status' => 'error', 'message' => 'Erreur lors de l’insertion.']);
|
||||||
|
}
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
// === Update picklist item ===
|
||||||
|
function update($data) {
|
||||||
|
global $DB;
|
||||||
|
|
||||||
|
$id = intval($data['id'] ?? 0);
|
||||||
|
$name = htmlentities($data['type'] ?? '');
|
||||||
|
$value = htmlentities($data['value'] ?? '');
|
||||||
|
|
||||||
|
if (!$id || empty($name) || empty($value)) {
|
||||||
|
echo json_encode(['status' => 'error', 'message' => 'ID, type et valeur sont requis.']);
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
$stmt = $DB->prepare("UPDATE picklist SET name = ?, value = ? WHERE id = ?");
|
||||||
|
$stmt->bind_param("ssi", $name, $value, $id);
|
||||||
|
|
||||||
|
if ($stmt->execute()) {
|
||||||
|
echo json_encode(['status' => 'success']);
|
||||||
|
} else {
|
||||||
|
echo json_encode(['status' => 'error', 'message' => 'Erreur lors de la mise à jour.']);
|
||||||
|
}
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
// === Filter list ===
|
||||||
|
function filtre($type) {
|
||||||
|
global $DB;
|
||||||
|
|
||||||
|
$filters = [];
|
||||||
|
|
||||||
|
if ($type && $type != 'all') {
|
||||||
|
$filters[] = "en.name = '" . $DB->escape($type) . "'";
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!empty($_GET['valeur'])) {
|
||||||
|
$valeur = $DB->escape($_GET['valeur']);
|
||||||
|
$filters[] = "en.value LIKE '%$valeur%'";
|
||||||
|
}
|
||||||
|
|
||||||
|
$sql = count($filters) > 0 ? " WHERE " . implode(" AND ", $filters) : "";
|
||||||
|
|
||||||
|
$query = "SELECT en.id, en.name, en.value, en.created_on,
|
||||||
|
CONCAT(glpi_users.realname, ' ', glpi_users.firstname) as created_by
|
||||||
|
FROM picklist AS en
|
||||||
|
LEFT JOIN glpi_users ON en.created_by = glpi_users.id $sql";
|
||||||
|
|
||||||
|
$result = $DB->query($query);
|
||||||
|
$res = [];
|
||||||
|
|
||||||
|
if ($result && $result->num_rows > 0) {
|
||||||
|
while ($row = $result->fetch_assoc()) {
|
||||||
|
$res[] = $row;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
echo json_encode($res, JSON_UNESCAPED_UNICODE);
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
// === Delete picklist item ===
|
||||||
|
function delete_picklist($id) {
|
||||||
|
global $DB;
|
||||||
|
|
||||||
|
$id = intval($id);
|
||||||
|
$stmt = $DB->prepare("DELETE FROM picklist WHERE id = ?");
|
||||||
|
$stmt->bind_param("i", $id);
|
||||||
|
|
||||||
|
if ($stmt->execute()) {
|
||||||
|
echo json_encode(['status' => 'success', 'message' => 'Élément supprimé.']);
|
||||||
|
} else {
|
||||||
|
echo json_encode(['status' => 'error', 'message' => 'Erreur lors de la suppression.']);
|
||||||
|
}
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(isset($_POST)){
|
||||||
|
|
||||||
|
switch ($_GET['action']) {
|
||||||
|
|
||||||
|
case "add":
|
||||||
|
add($_POST);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case "update":
|
||||||
|
update($_POST);
|
||||||
|
break;
|
||||||
|
case "delete":
|
||||||
|
$id = $_POST['id'] ?? 0;
|
||||||
|
delete_picklist($id);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case "filtre":
|
||||||
|
header('Content-type: application/json; charset=utf-8');
|
||||||
|
$res = filtre($_GET['type']);
|
||||||
|
echo json_encode($res,JSON_UNESCAPED_UNICODE);
|
||||||
|
break;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
137
ajax/planning.php
Normal file
137
ajax/planning.php
Normal file
@ -0,0 +1,137 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* ---------------------------------------------------------------------
|
||||||
|
* GLPI - Gestionnaire Libre de Parc Informatique
|
||||||
|
* Copyright (C) 2015-2020 Teclib' and contributors.
|
||||||
|
*
|
||||||
|
* http://glpi-project.org
|
||||||
|
*
|
||||||
|
* based on GLPI - Gestionnaire Libre de Parc Informatique
|
||||||
|
* Copyright (C) 2003-2014 by the INDEPNET Development Team.
|
||||||
|
*
|
||||||
|
* ---------------------------------------------------------------------
|
||||||
|
*
|
||||||
|
* LICENSE
|
||||||
|
*
|
||||||
|
* This file is part of GLPI.
|
||||||
|
*
|
||||||
|
* GLPI 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 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* GLPI 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 GLPI. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
* ---------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
|
include ('../inc/includes.php');
|
||||||
|
|
||||||
|
Session::checkCentralAccess();
|
||||||
|
|
||||||
|
if (!isset($_REQUEST["action"])) {
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($_REQUEST["action"] == "get_events") {
|
||||||
|
header("Content-Type: application/json; charset=UTF-8");
|
||||||
|
echo json_encode(Planning::constructEventsArray($_REQUEST));
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($_REQUEST["action"] == "update_event_times") {
|
||||||
|
echo Planning::updateEventTimes($_REQUEST);
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($_REQUEST["action"] == "view_changed") {
|
||||||
|
echo Planning::viewChanged($_REQUEST['view']);
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($_REQUEST["action"] == "clone_event") {
|
||||||
|
echo Planning::cloneEvent($_REQUEST['event']);
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($_REQUEST["action"] == "delete_event") {
|
||||||
|
echo Planning::deleteEvent($_REQUEST['event']);
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($_REQUEST["action"] == "get_externalevent_template") {
|
||||||
|
$key = 'planningexternaleventtemplates_id';
|
||||||
|
if (isset($_POST[$key])
|
||||||
|
&& $_POST[$key] > 0) {
|
||||||
|
$template = new PlanningExternalEventTemplate();
|
||||||
|
$template->getFromDB($_POST[$key]);
|
||||||
|
|
||||||
|
$template->fields = array_map('html_entity_decode', $template->fields);
|
||||||
|
$template->fields['rrule'] = json_decode($template->fields['rrule'], true);
|
||||||
|
header("Content-Type: application/json; charset=UTF-8");
|
||||||
|
echo json_encode($template->fields, JSON_NUMERIC_CHECK);
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Html::header_nocache();
|
||||||
|
header("Content-Type: text/html; charset=UTF-8");
|
||||||
|
|
||||||
|
if ($_REQUEST["action"] == "add_event_fromselect") {
|
||||||
|
Planning::showAddEventForm($_REQUEST);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($_REQUEST["action"] == "add_event_sub_form") {
|
||||||
|
Planning::showAddEventSubForm($_REQUEST);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($_REQUEST["action"] == "add_planning_form") {
|
||||||
|
Planning::showAddPlanningForm();
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($_REQUEST["action"] == "add_user_form") {
|
||||||
|
Planning::showAddUserForm();
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($_REQUEST["action"] == "add_group_users_form") {
|
||||||
|
Planning::showAddGroupUsersForm();
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($_REQUEST["action"] == "add_group_form") {
|
||||||
|
Planning::showAddGroupForm();
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($_REQUEST["action"] == "add_external_form") {
|
||||||
|
Planning::showAddExternalForm();
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($_REQUEST["action"] == "add_event_classic_form") {
|
||||||
|
Planning::showAddEventClassicForm($_REQUEST);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($_REQUEST["action"] == "edit_event_form") {
|
||||||
|
Planning::editEventForm($_REQUEST);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($_REQUEST["action"] == "get_filters_form") {
|
||||||
|
Planning::showPlanningFilter();
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($_REQUEST["action"] == "toggle_filter") {
|
||||||
|
Planning::toggleFilter($_REQUEST);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($_REQUEST["action"] == "color_filter") {
|
||||||
|
Planning::colorFilter($_REQUEST);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($_REQUEST["action"] == "delete_filter") {
|
||||||
|
Planning::deleteFilter($_REQUEST);
|
||||||
|
}
|
||||||
|
|
||||||
|
Html::ajaxFooter();
|
||||||
58
ajax/planningcheck.php
Normal file
58
ajax/planningcheck.php
Normal file
@ -0,0 +1,58 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* ---------------------------------------------------------------------
|
||||||
|
* GLPI - Gestionnaire Libre de Parc Informatique
|
||||||
|
* Copyright (C) 2015-2020 Teclib' and contributors.
|
||||||
|
*
|
||||||
|
* http://glpi-project.org
|
||||||
|
*
|
||||||
|
* based on GLPI - Gestionnaire Libre de Parc Informatique
|
||||||
|
* Copyright (C) 2003-2014 by the INDEPNET Development Team.
|
||||||
|
*
|
||||||
|
* ---------------------------------------------------------------------
|
||||||
|
*
|
||||||
|
* LICENSE
|
||||||
|
*
|
||||||
|
* This file is part of GLPI.
|
||||||
|
*
|
||||||
|
* GLPI 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 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* GLPI 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 GLPI. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
* ---------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @since 0.83
|
||||||
|
*/
|
||||||
|
|
||||||
|
// Direct access to file
|
||||||
|
if (strpos($_SERVER['PHP_SELF'], "planningcheck.php")) {
|
||||||
|
$AJAX_INCLUDE = 1;
|
||||||
|
include ('../inc/includes.php');
|
||||||
|
header("Content-Type: text/html; charset=UTF-8");
|
||||||
|
Html::header_nocache();
|
||||||
|
}
|
||||||
|
|
||||||
|
Session::checkLoginUser();
|
||||||
|
|
||||||
|
if (isset($_POST['users_id']) && ($_POST['users_id'] > 0)) {
|
||||||
|
$rand = mt_rand();
|
||||||
|
echo "<a href='#' title=\"".__s('Availability')."\" onClick=\"".Html::jsGetElementbyID('planningcheck'.$rand).".dialog('open'); return false;\">";
|
||||||
|
echo "<i class='far fa-calendar-alt'></i>";
|
||||||
|
echo "<span class='sr-only'>".__('Availability')."</span>";
|
||||||
|
echo "</a>";
|
||||||
|
Ajax::createIframeModalWindow('planningcheck'.$rand,
|
||||||
|
$CFG_GLPI["root_doc"].
|
||||||
|
"/front/planning.php?checkavailability=checkavailability".
|
||||||
|
"&itemtype=User&users_id=".$_POST['users_id'],
|
||||||
|
['title' => __('Availability')]);
|
||||||
|
}
|
||||||
58
ajax/planningend.php
Normal file
58
ajax/planningend.php
Normal file
@ -0,0 +1,58 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* ---------------------------------------------------------------------
|
||||||
|
* GLPI - Gestionnaire Libre de Parc Informatique
|
||||||
|
* Copyright (C) 2015-2020 Teclib' and contributors.
|
||||||
|
*
|
||||||
|
* http://glpi-project.org
|
||||||
|
*
|
||||||
|
* based on GLPI - Gestionnaire Libre de Parc Informatique
|
||||||
|
* Copyright (C) 2003-2014 by the INDEPNET Development Team.
|
||||||
|
*
|
||||||
|
* ---------------------------------------------------------------------
|
||||||
|
*
|
||||||
|
* LICENSE
|
||||||
|
*
|
||||||
|
* This file is part of GLPI.
|
||||||
|
*
|
||||||
|
* GLPI 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 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* GLPI 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 GLPI. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
* ---------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
|
$AJAX_INCLUDE = 1;
|
||||||
|
include ('../inc/includes.php');
|
||||||
|
|
||||||
|
// Send UTF8 Headers
|
||||||
|
header("Content-Type: text/html; charset=UTF-8");
|
||||||
|
Html::header_nocache();
|
||||||
|
|
||||||
|
Session::checkLoginUser();
|
||||||
|
|
||||||
|
if (isset($_POST['duration']) && ($_POST['duration'] == 0)
|
||||||
|
&& isset($_POST['name'])) {
|
||||||
|
if (!isset($_POST['global_begin'])) {
|
||||||
|
$_POST['global_begin'] = '';
|
||||||
|
}
|
||||||
|
if (!isset($_POST['global_end'])) {
|
||||||
|
$_POST['global_end'] = '';
|
||||||
|
}
|
||||||
|
Html::showDateTimeField($_POST['name'], ['value' => $_POST['end'],
|
||||||
|
'timestep' => -1,
|
||||||
|
'maybeempty' => false,
|
||||||
|
'canedit' => true,
|
||||||
|
'mindate' => '',
|
||||||
|
'maxdate' => '',
|
||||||
|
'mintime' => $_POST['global_begin'],
|
||||||
|
'maxtime' => $_POST['global_end']]);
|
||||||
|
}
|
||||||
55
ajax/priority.php
Normal file
55
ajax/priority.php
Normal file
@ -0,0 +1,55 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* ---------------------------------------------------------------------
|
||||||
|
* GLPI - Gestionnaire Libre de Parc Informatique
|
||||||
|
* Copyright (C) 2015-2020 Teclib' and contributors.
|
||||||
|
*
|
||||||
|
* http://glpi-project.org
|
||||||
|
*
|
||||||
|
* based on GLPI - Gestionnaire Libre de Parc Informatique
|
||||||
|
* Copyright (C) 2003-2014 by the INDEPNET Development Team.
|
||||||
|
*
|
||||||
|
* ---------------------------------------------------------------------
|
||||||
|
*
|
||||||
|
* LICENSE
|
||||||
|
*
|
||||||
|
* This file is part of GLPI.
|
||||||
|
*
|
||||||
|
* GLPI 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 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* GLPI 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 GLPI. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
* ---------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
|
include ('../inc/includes.php');
|
||||||
|
|
||||||
|
// Send UTF8 Headers
|
||||||
|
header("Content-Type: text/html; charset=UTF-8");
|
||||||
|
Html::header_nocache();
|
||||||
|
|
||||||
|
Session::checkLoginUser();
|
||||||
|
|
||||||
|
if (isset($_POST["urgency"])
|
||||||
|
&& isset($_POST["impact"])
|
||||||
|
&& isset($_POST["priority"])) {
|
||||||
|
|
||||||
|
$priority = Ticket::computePriority($_POST["urgency"], $_POST["impact"]);
|
||||||
|
|
||||||
|
if ($_POST["priority"]) {
|
||||||
|
echo "<script type='text/javascript' >\n";
|
||||||
|
echo Html::jsSetDropdownValue($_POST["priority"], $priority);
|
||||||
|
echo "\n</script>";
|
||||||
|
|
||||||
|
} else {
|
||||||
|
echo Ticket::getPriorityName($priority);
|
||||||
|
}
|
||||||
|
}
|
||||||
74
ajax/private_public.php
Normal file
74
ajax/private_public.php
Normal file
@ -0,0 +1,74 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* ---------------------------------------------------------------------
|
||||||
|
* GLPI - Gestionnaire Libre de Parc Informatique
|
||||||
|
* Copyright (C) 2015-2020 Teclib' and contributors.
|
||||||
|
*
|
||||||
|
* http://glpi-project.org
|
||||||
|
*
|
||||||
|
* based on GLPI - Gestionnaire Libre de Parc Informatique
|
||||||
|
* Copyright (C) 2003-2014 by the INDEPNET Development Team.
|
||||||
|
*
|
||||||
|
* ---------------------------------------------------------------------
|
||||||
|
*
|
||||||
|
* LICENSE
|
||||||
|
*
|
||||||
|
* This file is part of GLPI.
|
||||||
|
*
|
||||||
|
* GLPI 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 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* GLPI 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 GLPI. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
* ---------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
|
if (strpos($_SERVER['PHP_SELF'], "private_public.php")) {
|
||||||
|
include ('../inc/includes.php');
|
||||||
|
header("Content-Type: text/html; charset=UTF-8");
|
||||||
|
Html::header_nocache();
|
||||||
|
} else if (!defined('GLPI_ROOT')) {
|
||||||
|
die("Sorry. You can't access this file directly");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isset($_POST['is_private'])) {
|
||||||
|
Session::checkLoginUser();
|
||||||
|
|
||||||
|
switch ($_POST['is_private']) {
|
||||||
|
case true :
|
||||||
|
echo "<input type='hidden' name='is_private' value='1'>\n";
|
||||||
|
echo "<input type='hidden' name='entities_id' value='0'>\n";
|
||||||
|
echo "<input type='hidden' name='is_recursive' value='0'>\n";
|
||||||
|
$private = __('Personal');
|
||||||
|
$link = "<a href='#' onClick='setPublic".$_POST['rand']."();return false;'>".__('Set public')."</a>";
|
||||||
|
printf(__('%1$s - %2$s'), $private, $link);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case false :
|
||||||
|
if (isset($_POST['entities_id'])
|
||||||
|
&& in_array($_POST['entities_id'], $_SESSION['glpiactiveentities'])) {
|
||||||
|
$val = $_POST['entities_id'];
|
||||||
|
} else {
|
||||||
|
$val = $_SESSION['glpiactive_entity'];
|
||||||
|
}
|
||||||
|
echo "<table width='100%'>";
|
||||||
|
echo "<tr><td>";
|
||||||
|
echo "<input type='hidden' name='is_private' value='0'>\n";
|
||||||
|
echo __('Public');
|
||||||
|
echo "</td><td>";
|
||||||
|
Entity::dropdown(['value' => $val]);
|
||||||
|
echo "</td><td>". __('Child entities')."</td><td>";
|
||||||
|
Dropdown::showYesNo('is_recursive', $_POST["is_recursive"]);
|
||||||
|
echo "</td><td>";
|
||||||
|
echo "<a href='#' onClick='setPrivate".$_POST['rand']."();return false'>".__('Set personal')."</a>";
|
||||||
|
echo "</td></tr></table>";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
51
ajax/projecttask.php
Normal file
51
ajax/projecttask.php
Normal file
@ -0,0 +1,51 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* ---------------------------------------------------------------------
|
||||||
|
* GLPI - Gestionnaire Libre de Parc Informatique
|
||||||
|
* Copyright (C) 2015-2020 Teclib' and contributors.
|
||||||
|
*
|
||||||
|
* http://glpi-project.org
|
||||||
|
*
|
||||||
|
* based on GLPI - Gestionnaire Libre de Parc Informatique
|
||||||
|
* Copyright (C) 2003-2014 by the INDEPNET Development Team.
|
||||||
|
*
|
||||||
|
* ---------------------------------------------------------------------
|
||||||
|
*
|
||||||
|
* LICENSE
|
||||||
|
*
|
||||||
|
* This file is part of GLPI.
|
||||||
|
*
|
||||||
|
* GLPI 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 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* GLPI 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 GLPI. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
* ---------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @since 9.2
|
||||||
|
*/
|
||||||
|
|
||||||
|
$AJAX_INCLUDE = 1;
|
||||||
|
|
||||||
|
include ('../inc/includes.php');
|
||||||
|
header("Content-Type: application/json; charset=UTF-8");
|
||||||
|
Html::header_nocache();
|
||||||
|
|
||||||
|
Session::checkLoginUser();
|
||||||
|
|
||||||
|
if (isset($_POST['projecttasktemplates_id']) && ($_POST['projecttasktemplates_id'] > 0)) {
|
||||||
|
$template = new ProjectTaskTemplate();
|
||||||
|
$template->getFromDB($_POST['projecttasktemplates_id']);
|
||||||
|
|
||||||
|
$template->fields = array_map('html_entity_decode', $template->fields);
|
||||||
|
echo json_encode($template->fields);
|
||||||
|
}
|
||||||
74
ajax/publication.php
Normal file
74
ajax/publication.php
Normal file
@ -0,0 +1,74 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
|
||||||
|
if (!defined('GLPI_ROOT')) {
|
||||||
|
define('GLPI_ROOT', dirname(__DIR__));
|
||||||
|
}
|
||||||
|
|
||||||
|
include_once GLPI_ROOT . '/inc/based_config.php';
|
||||||
|
|
||||||
|
include ('../front/publications_fonctions.php');
|
||||||
|
// Init Timer to compute time of display
|
||||||
|
$TIMER_DEBUG = new Timer();
|
||||||
|
$TIMER_DEBUG->start();
|
||||||
|
/// TODO try to remove them if possible
|
||||||
|
include_once (GLPI_ROOT . "/inc/db.function.php");
|
||||||
|
// Standard includes
|
||||||
|
include_once (GLPI_ROOT . "/inc/config.php");
|
||||||
|
//disbled errors =>pour le variable res (Ajax)
|
||||||
|
ini_set('display_errors', 0);
|
||||||
|
|
||||||
|
Session::checkLoginUser();
|
||||||
|
global $DB;
|
||||||
|
|
||||||
|
|
||||||
|
// print("<pre>".print_r($_POST,true)."</pre>");
|
||||||
|
//print("<pre>".print_r($_FILES,true)."</pre>");
|
||||||
|
|
||||||
|
if(isset($_POST)){
|
||||||
|
|
||||||
|
switch ($_POST['function']) {
|
||||||
|
|
||||||
|
case "publication":
|
||||||
|
if( $_POST["action"] == 'add'){
|
||||||
|
addPublication($_POST , $_FILES);
|
||||||
|
Html::redirect($CFG_GLPI["root_doc"]."/front/publications.php");
|
||||||
|
}else if($_POST["action"] == 'update'){
|
||||||
|
updatePublication($_POST , $_FILES);
|
||||||
|
Html::redirect($CFG_GLPI["root_doc"]."/front/publications.php");
|
||||||
|
}else if($_POST["action"] == 'delete'){
|
||||||
|
deletePublication($_POST);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case "jaime":
|
||||||
|
if( $_POST["value"] != 'deleted'){
|
||||||
|
$isJaime = isJaime($_POST["id_publication"] , $_SESSION["glpiID"]);
|
||||||
|
if($isJaime == false){
|
||||||
|
$stmt = $DB->prepare("INSERT INTO publication_reactions( id_publication , id_user , type , reaction) VALUES ( ? , ? , 'jaime' , ? )");
|
||||||
|
$stmt->bind_param("iis",$_POST["id_publication"], $_SESSION["glpiID"] , $_POST["value"]);
|
||||||
|
$stmt->execute();
|
||||||
|
}else{
|
||||||
|
$stmt = $DB->prepare("UPDATE publication_reactions SET reaction = ? where id_publication = ? and id_user = ? and type ='jaime' ");
|
||||||
|
$stmt->bind_param("sii", $_POST["value"] , $_POST["id_publication"] , $_SESSION["glpiID"]);
|
||||||
|
$stmt->execute();
|
||||||
|
}
|
||||||
|
}else if( $_POST["value"] == 'deleted'){
|
||||||
|
//$DB->query("DELETE FROM publication_reactions WHERE id_publication='".(int)$_POST["id_publication"]."' and id_user = '".$_SESSION["glpiID"]."' and type = 'jaime' ");
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case "commentaire":
|
||||||
|
if( $_POST["action"] == 'add'){
|
||||||
|
addCommentaire($_POST);
|
||||||
|
}elseif( $_POST["action"] == 'update'){
|
||||||
|
//updateCommentaire($_POST);
|
||||||
|
}elseif( $_POST["action"] == 'delete'){
|
||||||
|
//deleteCommentaire($_POST);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
79
ajax/rack.php
Normal file
79
ajax/rack.php
Normal file
@ -0,0 +1,79 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* ---------------------------------------------------------------------
|
||||||
|
* GLPI - Gestionnaire Libre de Parc Informatique
|
||||||
|
* Copyright (C) 2015-2020 Teclib' and contributors.
|
||||||
|
*
|
||||||
|
* http://glpi-project.org
|
||||||
|
*
|
||||||
|
* based on GLPI - Gestionnaire Libre de Parc Informatique
|
||||||
|
* Copyright (C) 2003-2014 by the INDEPNET Development Team.
|
||||||
|
*
|
||||||
|
* ---------------------------------------------------------------------
|
||||||
|
*
|
||||||
|
* LICENSE
|
||||||
|
*
|
||||||
|
* This file is part of GLPI.
|
||||||
|
*
|
||||||
|
* GLPI 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 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* GLPI 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 GLPI. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
* ---------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
|
$AJAX_INCLUDE = 1;
|
||||||
|
include ('../inc/includes.php');
|
||||||
|
header("Content-Type: text/html; charset=UTF-8");
|
||||||
|
Html::header_nocache();
|
||||||
|
|
||||||
|
Session::checkLoginUser();
|
||||||
|
|
||||||
|
if (isset($_REQUEST['action'])) {
|
||||||
|
$answer = [];
|
||||||
|
|
||||||
|
switch ($_REQUEST['action']) {
|
||||||
|
case 'move_item':
|
||||||
|
$item_rack = new Item_Rack;
|
||||||
|
$item_rack->getFromDB((int) $_POST['id']);
|
||||||
|
$answer['status'] = $item_rack->update([
|
||||||
|
'id' => (int) $_POST['id'],
|
||||||
|
'position' => (int) $_POST['position'],
|
||||||
|
'hpos' => (int) $_POST['hpos'],
|
||||||
|
]);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'move_pdu':
|
||||||
|
$pdu_rack = new PDU_Rack;
|
||||||
|
$pdu_rack->getFromDB((int) $_POST['id']);
|
||||||
|
$answer['status'] = $pdu_rack->update([
|
||||||
|
'id' => (int) $_POST['id'],
|
||||||
|
'position' => (int) $_POST['position']
|
||||||
|
]);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'move_rack':
|
||||||
|
$rack = new Rack;
|
||||||
|
$rack->getFromDB((int) $_POST['id']);
|
||||||
|
$answer['status'] = $rack->update([
|
||||||
|
'id' => (int) $_POST['id'],
|
||||||
|
'dcrooms_id' => (int) $_POST['dcrooms_id'],
|
||||||
|
'position' => (int) $_POST['x'].",".(int) $_POST['y'],
|
||||||
|
]);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'show_pdu_form':
|
||||||
|
PDU_Rack::showFirstForm((int) $_REQUEST['racks_id']);
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
echo json_encode($answer);
|
||||||
|
}
|
||||||
86
ajax/resaperiod.php
Normal file
86
ajax/resaperiod.php
Normal file
@ -0,0 +1,86 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* ---------------------------------------------------------------------
|
||||||
|
* GLPI - Gestionnaire Libre de Parc Informatique
|
||||||
|
* Copyright (C) 2015-2020 Teclib' and contributors.
|
||||||
|
*
|
||||||
|
* http://glpi-project.org
|
||||||
|
*
|
||||||
|
* based on GLPI - Gestionnaire Libre de Parc Informatique
|
||||||
|
* Copyright (C) 2003-2014 by the INDEPNET Development Team.
|
||||||
|
*
|
||||||
|
* ---------------------------------------------------------------------
|
||||||
|
*
|
||||||
|
* LICENSE
|
||||||
|
*
|
||||||
|
* This file is part of GLPI.
|
||||||
|
*
|
||||||
|
* GLPI 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 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* GLPI 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 GLPI. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
* ---------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @since 0.84
|
||||||
|
*/
|
||||||
|
|
||||||
|
$AJAX_INCLUDE = 1;
|
||||||
|
include ('../inc/includes.php');
|
||||||
|
|
||||||
|
// Send UTF8 Headers
|
||||||
|
header("Content-Type: text/html; charset=UTF-8");
|
||||||
|
Html::header_nocache();
|
||||||
|
|
||||||
|
Session::checkLoginUser();
|
||||||
|
|
||||||
|
if (isset($_POST['type']) && isset($_POST['end'])) {
|
||||||
|
|
||||||
|
echo "<table width='90%'>";
|
||||||
|
switch ($_POST['type']) {
|
||||||
|
case 'day' :
|
||||||
|
echo "<tr><td>".__('End date').'</td><td>';
|
||||||
|
Html::showDateField('periodicity[end]', ['value' => $_POST['end']]);
|
||||||
|
echo "</td></tr>";
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'week' :
|
||||||
|
echo "<tr><td>".__('End date').'</td><td>';
|
||||||
|
Html::showDateField('periodicity[end]', ['value' => $_POST['end']]);
|
||||||
|
echo "</td></tr></table>";
|
||||||
|
echo "<table class='tab_glpi'>";
|
||||||
|
echo "<tr class='center'><td> </td>";
|
||||||
|
$days = ['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday'];
|
||||||
|
foreach ($days as $day) {
|
||||||
|
echo "<th>".__($day)."</th>";
|
||||||
|
}
|
||||||
|
echo "</tr><tr class='center'><td>".__('By day').'</td>';
|
||||||
|
|
||||||
|
foreach ($days as $day) {
|
||||||
|
echo "<td><input type='checkbox' name='periodicity[days][$day]'></td>";
|
||||||
|
}
|
||||||
|
echo "</tr>";
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'month' :
|
||||||
|
echo "<tr><td colspan='2'>";
|
||||||
|
$values = ['date' => __('Each month, same date'),
|
||||||
|
'day' => __('Each month, same day of week')];
|
||||||
|
Dropdown::showFromArray('periodicity[subtype]', $values);
|
||||||
|
echo "</td></tr>";
|
||||||
|
echo "<tr><td>".__('End date').'</td><td>';
|
||||||
|
Html::showDateField('periodicity[end]', ['value' => $_POST['end']]);
|
||||||
|
echo "</td></tr>";
|
||||||
|
|
||||||
|
}
|
||||||
|
echo '</table>';
|
||||||
|
}
|
||||||
90
ajax/responsable.php
Normal file
90
ajax/responsable.php
Normal file
@ -0,0 +1,90 @@
|
|||||||
|
<?php
|
||||||
|
if (!defined('GLPI_ROOT')) {
|
||||||
|
define('GLPI_ROOT', dirname(__DIR__));
|
||||||
|
}
|
||||||
|
|
||||||
|
include_once GLPI_ROOT . '/inc/based_config.php';
|
||||||
|
include_once GLPI_ROOT . "/inc/db.function.php";
|
||||||
|
include_once GLPI_ROOT . "/inc/config.php";
|
||||||
|
ini_set('display_errors', 0);
|
||||||
|
|
||||||
|
Session::checkLoginUser();
|
||||||
|
global $DB;
|
||||||
|
|
||||||
|
function get_users_with_supervisor($old_supervisor_id) {
|
||||||
|
global $DB;
|
||||||
|
$users = [];
|
||||||
|
|
||||||
|
$query = "SELECT id FROM glpi_users WHERE users_id_supervisor = ?";
|
||||||
|
$stmt = $DB->prepare($query);
|
||||||
|
$stmt->bind_param("i", $old_supervisor_id);
|
||||||
|
$stmt->execute();
|
||||||
|
$result = $stmt->get_result();
|
||||||
|
|
||||||
|
while ($row = $result->fetch_assoc()) {
|
||||||
|
$users[] = $row['id'];
|
||||||
|
}
|
||||||
|
|
||||||
|
return $users;
|
||||||
|
}
|
||||||
|
|
||||||
|
function update_supervisor($users_ids, $new_id) {
|
||||||
|
global $DB;
|
||||||
|
|
||||||
|
if (empty($users_ids)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
$ids_placeholders = implode(',', array_fill(0, count($users_ids), '?'));
|
||||||
|
$types = str_repeat('i', count($users_ids) + 1);
|
||||||
|
$params = array_merge([$new_id], $users_ids);
|
||||||
|
|
||||||
|
$query = "UPDATE glpi_users SET users_id_supervisor = ? WHERE id IN ($ids_placeholders)";
|
||||||
|
$stmt = $DB->prepare($query);
|
||||||
|
|
||||||
|
$stmt->bind_param($types, ...$params);
|
||||||
|
return $stmt->execute();
|
||||||
|
}
|
||||||
|
|
||||||
|
function add_tracking($users_ids, $old_id, $new_id) {
|
||||||
|
global $DB;
|
||||||
|
|
||||||
|
$current_user_id = $_SESSION['glpiID'] ?? 0;
|
||||||
|
$current_user_name = 'Script';
|
||||||
|
|
||||||
|
if ($current_user_id > 0) {
|
||||||
|
$query_user = "SELECT CONCAT(firstname, ' ', realname) AS fullname FROM glpi_users WHERE id = ?";
|
||||||
|
$stmt_user = $DB->prepare($query_user);
|
||||||
|
$stmt_user->bind_param("i", $current_user_id);
|
||||||
|
$stmt_user->execute();
|
||||||
|
$result_user = $stmt_user->get_result();
|
||||||
|
|
||||||
|
if ($row_user = $result_user->fetch_assoc()) {
|
||||||
|
$current_user_name = $row_user['fullname'];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach ($users_ids as $user_id) {
|
||||||
|
$query_log = "INSERT INTO glpi_logs (itemtype, items_id, date_mod, user_name, id_search_option, old_value, new_value)
|
||||||
|
VALUES ('User', ?, NOW(), ?, 99, ?, ?)";
|
||||||
|
|
||||||
|
$stmt_log = $DB->prepare($query_log);
|
||||||
|
$stmt_log->bind_param("isss", $user_id, $current_user_name, $old_id, $new_id);
|
||||||
|
$stmt_log->execute();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isset($_POST) && $_GET['action'] === "update") {
|
||||||
|
$old_supervisor_id = (int)$_GET['oldsupervisor'];
|
||||||
|
$new_supervisor_id = (int)$_GET['newsupervisor'];
|
||||||
|
|
||||||
|
$users_to_update = get_users_with_supervisor($old_supervisor_id);
|
||||||
|
|
||||||
|
if (!empty($users_to_update)) {
|
||||||
|
$update_success = update_supervisor($users_to_update, $new_supervisor_id);
|
||||||
|
add_tracking($users_to_update, $old_supervisor_id, $new_supervisor_id);
|
||||||
|
echo json_encode(['success' => $update_success], JSON_UNESCAPED_UNICODE);
|
||||||
|
} else {
|
||||||
|
echo json_encode(['success' => false, 'message' => 'Aucun utilisateur trouvé.'], JSON_UNESCAPED_UNICODE);
|
||||||
|
}
|
||||||
|
}
|
||||||
98
ajax/ruleaction.php
Normal file
98
ajax/ruleaction.php
Normal file
@ -0,0 +1,98 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* ---------------------------------------------------------------------
|
||||||
|
* GLPI - Gestionnaire Libre de Parc Informatique
|
||||||
|
* Copyright (C) 2015-2020 Teclib' and contributors.
|
||||||
|
*
|
||||||
|
* http://glpi-project.org
|
||||||
|
*
|
||||||
|
* based on GLPI - Gestionnaire Libre de Parc Informatique
|
||||||
|
* Copyright (C) 2003-2014 by the INDEPNET Development Team.
|
||||||
|
*
|
||||||
|
* ---------------------------------------------------------------------
|
||||||
|
*
|
||||||
|
* LICENSE
|
||||||
|
*
|
||||||
|
* This file is part of GLPI.
|
||||||
|
*
|
||||||
|
* GLPI 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 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* GLPI 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 GLPI. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
* ---------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
|
// Direct access to file
|
||||||
|
if (strpos($_SERVER['PHP_SELF'], "ruleaction.php")) {
|
||||||
|
include ('../inc/includes.php');
|
||||||
|
header("Content-Type: text/html; charset=UTF-8");
|
||||||
|
Html::header_nocache();
|
||||||
|
} else if (!defined('GLPI_ROOT')) {
|
||||||
|
die("Sorry. You can't access this file directly");
|
||||||
|
}
|
||||||
|
|
||||||
|
Session::checkLoginUser();
|
||||||
|
|
||||||
|
// Non define case
|
||||||
|
if (isset($_POST["sub_type"]) && class_exists($_POST["sub_type"])) {
|
||||||
|
if (!isset($_POST["field"])) {
|
||||||
|
$_POST["field"] = key(Rule::getActionsByType($_POST["sub_type"]));
|
||||||
|
}
|
||||||
|
if (!($item = getItemForItemtype($_POST["sub_type"]))) {
|
||||||
|
exit();
|
||||||
|
}
|
||||||
|
if (!isset($_POST[$item->getRuleIdField()])) {
|
||||||
|
exit();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Existing action
|
||||||
|
if ($_POST['ruleactions_id'] > 0) {
|
||||||
|
$already_used = false;
|
||||||
|
} else { // New action
|
||||||
|
$ra = getItemForItemtype($item->getRuleActionClass());
|
||||||
|
$used = $ra->getAlreadyUsedForRuleID($_POST[$item->getRuleIdField()],
|
||||||
|
$item->getType());
|
||||||
|
$already_used = in_array($_POST["field"], $used);
|
||||||
|
}
|
||||||
|
|
||||||
|
echo "<table width='100%'><tr><td width='30%'>";
|
||||||
|
|
||||||
|
$action_type = '';
|
||||||
|
if (isset($_POST["action_type"])) {
|
||||||
|
$action_type = $_POST["action_type"];
|
||||||
|
}
|
||||||
|
|
||||||
|
$randaction = RuleAction::dropdownActions(['subtype' => $_POST["sub_type"],
|
||||||
|
'name' => "action_type",
|
||||||
|
'field' => $_POST["field"],
|
||||||
|
'value' => $action_type,
|
||||||
|
'alreadyused' => $already_used]);
|
||||||
|
|
||||||
|
echo "</td><td>";
|
||||||
|
echo "<span id='action_type_span$randaction'>\n";
|
||||||
|
echo "</span>\n";
|
||||||
|
|
||||||
|
$paramsaction = ['action_type' => '__VALUE__',
|
||||||
|
'field' => $_POST["field"],
|
||||||
|
'sub_type' => $_POST["sub_type"],
|
||||||
|
$item->getForeignKeyField() => $_POST[$item->getForeignKeyField()]];
|
||||||
|
|
||||||
|
Ajax::updateItemOnSelectEvent("dropdown_action_type$randaction", "action_type_span$randaction",
|
||||||
|
$CFG_GLPI["root_doc"]."/ajax/ruleactionvalue.php", $paramsaction);
|
||||||
|
|
||||||
|
if (isset($_POST['value'])) {
|
||||||
|
$paramsaction['value'] = stripslashes($_POST['value']);
|
||||||
|
}
|
||||||
|
|
||||||
|
Ajax::updateItem("action_type_span$randaction", $CFG_GLPI["root_doc"]."/ajax/ruleactionvalue.php",
|
||||||
|
$paramsaction, "dropdown_action_type$randaction");
|
||||||
|
echo "</td></tr></table>";
|
||||||
|
}
|
||||||
46
ajax/ruleactionvalue.php
Normal file
46
ajax/ruleactionvalue.php
Normal file
@ -0,0 +1,46 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* ---------------------------------------------------------------------
|
||||||
|
* GLPI - Gestionnaire Libre de Parc Informatique
|
||||||
|
* Copyright (C) 2015-2020 Teclib' and contributors.
|
||||||
|
*
|
||||||
|
* http://glpi-project.org
|
||||||
|
*
|
||||||
|
* based on GLPI - Gestionnaire Libre de Parc Informatique
|
||||||
|
* Copyright (C) 2003-2014 by the INDEPNET Development Team.
|
||||||
|
*
|
||||||
|
* ---------------------------------------------------------------------
|
||||||
|
*
|
||||||
|
* LICENSE
|
||||||
|
*
|
||||||
|
* This file is part of GLPI.
|
||||||
|
*
|
||||||
|
* GLPI 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 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* GLPI 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 GLPI. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
* ---------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
|
// Direct access to file
|
||||||
|
if (strpos($_SERVER['PHP_SELF'], "ruleactionvalue.php")) {
|
||||||
|
include ('../inc/includes.php');
|
||||||
|
header("Content-Type: text/html; charset=UTF-8");
|
||||||
|
Html::header_nocache();
|
||||||
|
} else if (!defined('GLPI_ROOT')) {
|
||||||
|
die("Sorry. You can't access this file directly");
|
||||||
|
}
|
||||||
|
|
||||||
|
Session::checkLoginUser();
|
||||||
|
|
||||||
|
$ra = new RuleAction();
|
||||||
|
|
||||||
|
$ra->displayActionSelectPattern(Toolbox::stripslashes_deep($_POST));
|
||||||
87
ajax/rulecriteria.php
Normal file
87
ajax/rulecriteria.php
Normal file
@ -0,0 +1,87 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* ---------------------------------------------------------------------
|
||||||
|
* GLPI - Gestionnaire Libre de Parc Informatique
|
||||||
|
* Copyright (C) 2015-2020 Teclib' and contributors.
|
||||||
|
*
|
||||||
|
* http://glpi-project.org
|
||||||
|
*
|
||||||
|
* based on GLPI - Gestionnaire Libre de Parc Informatique
|
||||||
|
* Copyright (C) 2003-2014 by the INDEPNET Development Team.
|
||||||
|
*
|
||||||
|
* ---------------------------------------------------------------------
|
||||||
|
*
|
||||||
|
* LICENSE
|
||||||
|
*
|
||||||
|
* This file is part of GLPI.
|
||||||
|
*
|
||||||
|
* GLPI 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 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* GLPI 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 GLPI. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
* ---------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
|
// Direct access to file
|
||||||
|
if (strpos($_SERVER['PHP_SELF'], "rulecriteria.php")) {
|
||||||
|
include ('../inc/includes.php');
|
||||||
|
header("Content-Type: text/html; charset=UTF-8");
|
||||||
|
Html::header_nocache();
|
||||||
|
} else if (!defined('GLPI_ROOT')) {
|
||||||
|
die("Sorry. You can't access this file directly");
|
||||||
|
}
|
||||||
|
|
||||||
|
Session::checkLoginUser();
|
||||||
|
|
||||||
|
if (isset($_POST["sub_type"]) && ($rule = getItemForItemtype($_POST["sub_type"]))) {
|
||||||
|
$criterias = $rule->getAllCriteria();
|
||||||
|
|
||||||
|
if (count($criterias)) {
|
||||||
|
// First include -> first of the predefined array
|
||||||
|
if (!isset($_POST["criteria"])) {
|
||||||
|
$_POST["criteria"] = key($criterias);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isset($criterias[$_POST["criteria"]]['allow_condition'])) {
|
||||||
|
$allow_condition = $criterias[$_POST["criteria"]]['allow_condition'];
|
||||||
|
} else {
|
||||||
|
$allow_condition = [];
|
||||||
|
}
|
||||||
|
|
||||||
|
$condparam = ['criterion' => $_POST["criteria"],
|
||||||
|
'allow_conditions' => $allow_condition];
|
||||||
|
if (isset($_POST['condition'])) {
|
||||||
|
$condparam['value'] = $_POST['condition'];
|
||||||
|
}
|
||||||
|
echo "<table width='100%'><tr><td width='30%'>";
|
||||||
|
$randcrit = RuleCriteria::dropdownConditions($_POST["sub_type"], $condparam);
|
||||||
|
echo "</td><td>";
|
||||||
|
echo "<span id='condition_span$randcrit'>\n";
|
||||||
|
echo "</span>\n";
|
||||||
|
|
||||||
|
$paramscriteria = ['condition' => '__VALUE__',
|
||||||
|
'criteria' => $_POST["criteria"],
|
||||||
|
'sub_type' => $_POST["sub_type"]];
|
||||||
|
|
||||||
|
Ajax::updateItemOnSelectEvent("dropdown_condition$randcrit", "condition_span$randcrit",
|
||||||
|
$CFG_GLPI["root_doc"]."/ajax/rulecriteriavalue.php",
|
||||||
|
$paramscriteria);
|
||||||
|
|
||||||
|
if (isset($_POST['pattern'])) {
|
||||||
|
$paramscriteria['value'] = stripslashes($_POST['pattern']);
|
||||||
|
}
|
||||||
|
|
||||||
|
Ajax::updateItem("condition_span$randcrit",
|
||||||
|
$CFG_GLPI["root_doc"]."/ajax/rulecriteriavalue.php", $paramscriteria,
|
||||||
|
"dropdown_condition$randcrit");
|
||||||
|
echo "</td></tr></table>";
|
||||||
|
}
|
||||||
|
}
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user