Compare commits

..

2092 Commits

Author SHA1 Message Date
denis.flaven@combodo.com
affed69999 Version number bump. 2025-02-07 10:09:48 +01:00
denis.flaven@combodo.com
d5754fc568 N°8135 - Bump datamodel version. 2025-01-31 17:04:56 +01:00
jf-cbd
44290db312 N°8134 - Portal user profile is broken, regression from 7776 2025-01-28 10:23:44 +01:00
jf-cbd
c49ceae75e Fix HandleForm call 2025-01-21 16:46:15 +01:00
jf-cbd
8980f627e9 Fix format 2025-01-21 12:09:06 +01:00
jf-cbd
160bfd714b N°7776 remove twig from ajax calls 2025-01-20 15:41:22 +01:00
jf-cbd
8d58372074 Update unattended installation script documentation 2025-01-16 17:13:26 +01:00
Eric Espie
37fc1a5723 N°7810 - security hardening 2024-12-27 09:04:28 +01:00
jf-cbd
95aa444ee6 Security hardening 2024-12-13 16:48:13 +01:00
jf-cbd
f5de808c7c Security hardening (#685)
* security hardening
2024-12-13 15:09:18 +01:00
Benjamin Dalsass
e03033ce52 N°7219 - Fatal error following dashboard modification when dashboard title contains an é 2024-11-27 09:40:22 +01:00
jf-cbd
374b35f78a 🚀 Fix GitHub action 2024-11-07 14:50:46 +01:00
jf-cbd
04bd8cc5ce 🚀 Update GitHub actions to improve PR classification 2024-10-22 16:07:47 +02:00
denis.flaven@combodo.com
8cb701bda3 🔖 Prepare 2.7.11 version 2024-09-26 16:53:24 +02:00
jf-cbd
1b29746806 Rename github token 2024-09-23 17:14:41 +02:00
jf-cbd
fb9c317256 Add an action in the workflow to automatically add pull requests to the Combodo PRs dashboard 2024-09-23 14:43:33 +02:00
Eric Espie
0904a21e3f Cleanup ItopTestCase 2024-06-24 11:50:37 +02:00
Molkobain
82d11eeb47 N°7127 - Upgrade handlebars.js to v4.7.8 2024-06-21 11:19:39 +02:00
Eric Espie
142d6c8993 N°7533 - Detect and warns on Galera clusters 2024-06-20 11:06:57 +02:00
Timothee
320922a13d N°7545 Correctly display error message 2024-06-17 16:49:33 +02:00
Eric Espie
f03d731b1d N°7533 - Prevent installation of iTop on Galera clusters 2024-06-12 16:14:23 +02:00
Eric Espie
8be7628668 N°7548 - Code hardening 2024-05-29 18:11:36 +02:00
Eric Espie
62caf16153 N°7364 - Code hardening 2024-05-21 14:20:30 +02:00
odain
163a3afc0f N°7426 - no session created - replace php_sapi_name() by PHP_SAPI in unattended 2024-05-16 15:31:08 +02:00
odain
f8b54be896 N°7426 - no session created - replace php_sapi_name() by PHP_SAPI 2024-05-16 14:10:54 +02:00
Romain Quetiez
53dc452d61 Avoid unnecessary custom test environment compilations (base compilation of file modification time) 2024-05-16 09:53:04 +02:00
Romain Quetiez
ccaf2dc5b7 Make the tests compatible with windows (and linux) 2024-05-16 09:53:04 +02:00
Molkobain
5d5df5ad1a N°7255 - Fix misc. stylesheets not working in portal since N°7047 2024-05-07 10:37:39 +02:00
Molkobain
32140b360f Cherry pick fixes from 59a955f4 2024-04-29 11:45:09 +02:00
jf-cbd
d85767a838 Update test to run only on commmunity builds 2024-04-24 11:14:40 +02:00
jf-cbd
eeec57536b Security hardening 2024-04-23 11:55:39 +02:00
Molkobain
16ff6341d0 N°7455 - Fix regression from 4c784886, wrong class tested 2024-04-19 09:14:53 +02:00
Molkobain
9dab8679d6 N°7448 - Update dictionary entry 2024-04-18 18:44:20 +02:00
Molkobain
4c78488644 N°7455 - Ensure form renderer class extends FormRenderer 2024-04-18 18:15:02 +02:00
odain
b65e931c4c N°7439 - setup wizard broken on essential targets after fresh install via unattended CLI 2024-04-15 09:57:54 +02:00
odain
6cb3519308 N°7407 - test readability 2024-04-12 16:59:56 +02:00
odain
cfb9fae648 N°7407 - fix previous commit 2024-04-12 16:49:11 +02:00
odain
f4e791734f N°7407 - remove phpunit annotation 2024-04-12 14:49:20 +02:00
odain
6653ab0668 N°7407 - fix missing extension installation via unattended from production-modules or extension folder 2024-04-12 13:25:40 +02:00
odain
7ab258ba03 N°7439 - setup wizard broken on essential targets 2024-04-12 11:32:04 +02:00
odain
b5af30a93f N°7407 - refactor unattended tests to make work anywhere 2024-04-12 11:32:04 +02:00
Molkobain
bbfa601ab1 N°7446 - Add temporary workaround to fix an issue due to DB views creation. 2024-04-12 09:59:14 +02:00
odain
172b1cb1ff N°7407 - add phpunit annotation to exclude tests on top of targets 2024-04-11 18:54:43 +02:00
Molkobain
ca356859a3 N°7446 - Add comment for better understanding 2024-04-11 16:55:48 +02:00
Molkobain
5efe294895 N°7446 - Fix custom datamodel test class not creating DB tables correctly 2024-04-11 16:50:27 +02:00
odain
e0170ccc7e N°7407 - InstallationFileServiceTest relies on local installation.xml to reduce maintenance 2024-04-10 14:05:39 +02:00
odain
3b78885f38 N°7407 - unattended test cleanup for PHP 8.x deprecations 2024-04-09 11:06:03 +02:00
odain
ed562c9f73 N°7407 - fix unattended test enhancement 2024-04-09 10:02:06 +02:00
odain-cbd
85c576a986 N°7407 - N°7306 - Ease iTop installation via unattended CLI by using installation.xml choices (#641)
* N°7306 - Use iTop configuration settings to run unattended installation (instead of XML file settings)

* 7306 - fix infinite loop with db_tls.ca null

* 7306 - complete fields to use from itop configuration instead of XML setup

* fix using default language from conf

* 6365 - temp work

* 6365 - add option to select modules from installation.xml

* 6365-select modules option in unattended install

* 6365 - pass env to service + debug failed test

* 6365 - debug ci again + separate process annotation

* 6365 - fix test + cleanup

* 6365 - ci using use_installation_xml mode

* 6365 - ci using use_installation_xml mode

* 6365 - pass selected_modules to unattended

* N°6365 - Compute selected modules based on selected extensions coming from XML setup

* switch constr parameters and fix call from unattended cli

* 6365 - use use_installation_xml for unattended install only when no selected modules already provided

* test ci XML setup including selected extensions but no modules

* test ci installing iTop without selected modules/extenesions: guess via installation.xml

* same but without even providing XML setup - comment it in ci_description.ini

* 7306 - cleanup requires

* use infra master

* N°6365 - make current unattended CLI work with any iTop version (CLIPage compatibility)

* N°6365 - log which modules will be installed during setup

* N°6365 - unattended documentation + bash helper

* 6365- fix warning due to copies index access

* 6365 - enhance traces feedback to understant which and how modules are computes

* 6365 - enhance bash CLI + doc

* 6365 - fix require clipage compatibility

* 6365 - add return for better cli ouput

* 6365 - enhance ouput messages

* Document the usage and harmonize argument names (still not perfect)

* 6365 - fix use of new param param-file

* 6365 - fix test + vardump cleanup

* N°6365 - use underscore for unattended install options as advices in the PR

* 6365 -enhance test by using PHP_BINARY

---------

Co-authored-by: Romain Quetiez <romain.quetiez@combodo.com>
2024-04-09 10:00:58 +02:00
odain-cbd
5a34c76cc4 N°5120 - Unattended install : use cty toolkit version (#624)
* N°5120 - Unattended install : use cty toolkit version

* N°5120 - CLI mode validation

* 5120 - bring CI enhancements

* 5120 - bring back saas use-itop-config option: to read db settings from conf directly

* 5120 - move unattended script in setup folder/unattended-install

* 5120 - use-itop-config option: take db_tls_enabled and db_tls_ca into account

* 5120 - move test

* 5120 - put ci enhancements back - logs and conf preservation with install mode

* 5120 - keep PR simple - remove saas use-itop-config option for now

* 5120 - remove ci enhancement to preserve configuration

* Update setup/unattended-install/README.md

Co-authored-by: Thomas Casteleyn <thomas.casteleyn@super-visions.com>

* 5120 - documentation

* 5120 - fix log level

* 5120 - fix test

* fix phpunit test comment

---------

Co-authored-by: Thomas Casteleyn <thomas.casteleyn@super-visions.com>
2024-03-29 11:09:27 +01:00
Molkobain
da99a250bf N°7075 - Add check for Content Security Policies (CSP) in the setup 2024-03-21 14:20:22 +01:00
Pierre Goiffon
dbd5ba0377 N°7302 Fix SetupUtilsTest::testHumanReadableSize 2024-03-13 09:56:31 +01:00
Pierre Goiffon
5d6f293956 N°7302 Report SetupUtilsTest::testHumanReadableSize in the 2.7 branch 2024-03-13 09:48:46 +01:00
Pierre Goiffon
986c24d777 N°7302 Fix unit name in \SetupUtils::HumanReadableSize (#626) 2024-03-12 18:09:29 +01:00
Pierre Goiffon
763112c179 N°7344 rest.php core/get : add try/catch around query execution (#622)
Co-authored-by: Thomas Casteleyn <thomas.casteleyn@super-visions.com>
Co-authored-by: Molkobain <lajarige.guillaume@free.fr>
2024-03-12 18:08:04 +01:00
Pierre Goiffon
a5efd981d8 N°7343 Catch ParseError when loading dict files in setup (#615) 2024-03-12 18:05:38 +01:00
Pierre Goiffon
2922b22478 \DBObject::GetSearchForUniquenessRule remove wrong @api 2024-03-12 17:34:28 +01:00
Pierre Goiffon
2af05a437e N°4314 - Fix Uniqueness rules not working with Silo
(cherry picked from commit e8c11f38d2)
2024-03-12 17:32:56 +01:00
Molkobain
a9f8dcc5e8 N°7122 N°4164 - Portal: Hide log off button when user can't actually log off (eg. SSO using SAML or other providers) (#599)
* N°7122 N°4164 - Portal: Hide log off button when user can't actually log off (eg. SSO using SAML or other providers)

* N°7122 - Fix typo

Co-authored-by: Thomas Casteleyn <thomas.casteleyn@super-visions.com>

---------

Co-authored-by: Thomas Casteleyn <thomas.casteleyn@super-visions.com>
2024-03-11 21:13:09 +01:00
Pierre Goiffon
c325294e17 N°6599 Update moment from 2.22.2 to 2.30.1 2024-03-11 16:39:05 +01:00
Pierre Goiffon
da490739be 💡 Fix \CMDBSource::Query phpdoc block 2024-03-07 11:10:53 +01:00
Pierre Goiffon
b867faa355 Fix DBObjectTest
Error was "Class 'Combodo\iTop\Test\UnitTest\Core\DBObjectSet' not found"
2024-03-04 08:09:35 +01:00
jf-cbd
7453cc184f ✏️ fix a typo 2024-03-01 17:25:08 +01:00
Anne-Catherine
473cf004b6 N°6968 - Audit duration : add of a rule multiplie by 4 the time of response (#575) 2024-02-29 16:33:04 +01:00
Pierre Goiffon
f6fec506b1 💡 Some PHPDoc hints on value types to pass to DBObject::Set 2024-02-20 12:10:00 +01:00
Molkobain
5c12151c26 📝 Update PR template 2024-02-19 09:46:12 +01:00
Pierre Goiffon
5d6c4939f6 N°7245 Bettor logs on RunTimeEnvironment::CallInstallerHandlers exceptions (#606) 2024-02-14 11:01:12 +01:00
Molkobain
1b3a2c8470 N°5775 - Show error message to user in case of issue during token generation 2024-01-24 14:49:51 +01:00
Dennis Lassiter
618d8e6468 N°5775 - Allow configuration of OAuth client on MS Azure with single tenant (#553)
* Add Tenant-Support for Azure OAuthClient

* Improvement: Make tenant required

* Improvment: Removed check for null-value

Since last commit, the "tenant"-field either set to a custom value or "common" by default. It is not allowed to be null

* Add field description

---------

Co-authored-by: Molkobain <lajarige.guillaume@free.fr>
2024-01-24 14:38:54 +01:00
Molkobain
01a955a16f 📝 Add PR template 2024-01-16 19:42:39 +01:00
Anne-Catherine
87582a021b N°6993 - Error message on bulk transition on object containing a null blob (#596) 2024-01-15 15:49:19 +01:00
odain
9830178a47 N°7085 - ci restore runTestsInSeparateProcesses 2024-01-12 08:36:15 +01:00
odain-cbd
c140ebcb6b N°7085 - Fix infinite loop in login page until fatal error occurs (#592)
* N°7085 - login page infinite loop until fatal error- add Config->AddAllowedLoginTypes

* N°7085 - reproduce issue via a test

* N°7085-fix infinite loop

* N°7085 - ci: fix config file rights in tearDown

* N°7085 - ci: fix config file rights in tearDown (again)

* N°7085 - ci: fix config file content

* N°7085 - ci : add runTestsInSeparateProcesses

* Update core/config.class.inc.php

Co-authored-by: Molkobain <lajarige.guillaume@free.fr>

* N°7085 - exit -1 + enhance log message

* PR feedbacks from Romain regarding LoginTest annotations

---------

Co-authored-by: Molkobain <lajarige.guillaume@free.fr>
2024-01-12 08:13:40 +01:00
Molkobain
7a0a4e377b N°7137 - Fix regression from 7fffbb60, missing "default_value" parameter 2024-01-11 16:40:40 +01:00
Thomas Casteleyn
7fffbb60e9 N°7137 - DataSynchro: Remove "Organization" as default value for SynchroReplica->dest_class (#551) 2024-01-11 15:38:02 +01:00
Pierre Goiffon
2fd9523c16 🔖 Prepare 2.7.10 version 2024-01-05 15:50:41 +01:00
Pierre Goiffon
a4f6f6e877 N°4368 Fix CORB blocking regression (#598)
Don't send X-Content-Type-Options HTTP header for certain WebPage impl to workaround CORB blocking
To disable globally this new behavior introduced in 9865bf07, set the `security.enable_header_xcontent_type_options` config parameter to false

Thanks @Molkobain for the review !
2024-01-05 10:41:18 +01:00
Molkobain
94c604a6af N°3062 - Fix setup.css compilation test to ensure that it is versioned correctly. 2023-12-21 12:00:26 +01:00
Pierre Goiffon
6995a3c641 N°6889 backup mysqldump call : restore possibility to connect using socket protocol (#591)
With previous fix (N°6123) we forced to use the tcp protocol each time. This was blocking for users wanting to connect using the socket protocol on localhost.

Now for localhost we will : 
- send both port and protocol arguments if the `db_host` config parameter does contain a port
- don't send any of the port or protocol arguments if `db_host` doesn't contain a port
2023-12-20 15:19:50 +01:00
Pierre Goiffon
9865bf0779 N°4368 add sending X-Content-Type-Options HTTP header
Replace in consumers the \WebPage::add_xframe_options call by \WebPage::add_http_headers
2023-12-19 18:25:26 +01:00
Pierre Goiffon
d5449cca42 💡 iTopMutex: add link to mysql doc 2023-12-08 17:20:37 +01:00
Molkobain
5d38d22c50 N°7023 - Fix regression from the initial fix that throw exceptions even for ext. keys set programatically (eg. ComputeValues), which we still want to allow 2023-12-06 16:27:37 +01:00
Pierre Goiffon
99d69493d1 N°7023 - Update tests so that we are now checking negative ext. keys 2023-12-04 22:36:26 +01:00
Molkobain
c9bb628c30 N°7023 - Improve debug message on portal \DBObject::CheckChangedExtKeysValues() call 2023-12-04 22:36:09 +01:00
Molkobain
08e8d15d78 N°7023 - Fix check to write error when adding a contact on a new user request on the end-users portal 2023-12-04 22:35:07 +01:00
Molkobain
7b59df216b N°7005 - Fix portal stylesheets not being re-compiled when outdated
Stylesheets should remain as a relative path in the portal configuration, only when consumed by the TWIG should they become URLs

Note that if not absolute, URLs will be append to ITOP/pages/
2023-11-24 16:40:58 +01:00
Molkobain
cb5eab812e N°938 - Update compiled portal stylesheet 2023-11-24 16:22:36 +01:00
Anne-Catherine
c9b73a7fe2 N°938 - Improve print of portal object page and portal dashboard page (#537)
N°938 - Improve print of portal object page and portal dashboard page
2023-11-24 15:17:42 +01:00
Molkobain
3b2da39469 N°6989 - Security hardening 2023-11-22 18:02:50 +01:00
odain
fc22d91232 N°6949 - Run subset of itop core unit tests after the setup when validating a module github code 2023-11-22 10:14:58 +01:00
Stephen Abello
b10bcb976d N°6951 - Security hardening 2023-11-21 09:42:11 +01:00
Pierre Goiffon
5a43448644 N°6458 Security hardening 2023-11-15 11:14:07 +01:00
Pierre Goiffon
77409eed99 🎨 DBObject small phpdoc fixes 2023-11-13 16:25:37 +01:00
Anne-Catherine
83a70daf68 N°6887 - Fix excessive OQL requests to display user's grant matrix (#564)
* N°6887 - Fix excessive OQL requests to display user's grant matrix

* N°6887 - Rename variable and add PHPDoc

---------

Co-authored-by: Molkobain <lajarige.guillaume@free.fr>
2023-11-08 14:57:28 +01:00
Molkobain
a49a4e6c2b N°6886 - Add OAuth tests folder to removable directories list 2023-10-30 16:54:28 +01:00
Romain Quetiez
7419749ba6 Prerequisites for boosting tests 2023-10-26 20:51:28 +02:00
Romain Quetiez
037dfe1df6 Optimize tests execution time 2023-10-25 17:51:12 +02:00
Romain Quetiez
0b26d45014 Prerequisites for boosting tests 2023-10-25 17:50:41 +02:00
Molkobain
4fd8177165 N°3715 - Fix unit tests 2023-10-23 14:55:06 +02:00
Anne-Catherine
a2cdf214f0 N°3715 - Export above 1000 entries ignore obsolete data from user preference (#468)
* N°3715 - Export above 10000 entries ignore obsolete data from user preference
2023-10-20 17:02:16 +02:00
Anne-Catherine
013173019f N°2909 - Search on Enum, Date, TagSet,... with index fails (#496) 2023-10-20 16:45:35 +02:00
Stephen Abello
9469681a0c N°6777 - Security hardening 2023-10-17 09:12:40 +02:00
Pierre Goiffon
c72cb7e70e N°6606 security hardening 2023-10-13 17:15:37 +02:00
Pierre Goiffon
9df92665e0 N°6606 Backport of utils::ENUM_SANITIZATION_FILTER_* constants
Were introduced in 3.0.0, but not added to the support/2.7 branch
2023-10-13 17:10:35 +02:00
Molkobain
8ecebee511 PHP unit tests: Fix typo for "final private" methods as they can't be both 2023-09-20 16:11:39 +02:00
Pierre Goiffon
35cd965360 N°6629 Update ci_description php_version 2023-09-19 12:25:40 +02:00
Pierre Goiffon
e5dd51f637 N°6600 Portal download attachment : don't display anymore SQL query on attachment not found error (#525) 2023-09-19 09:54:43 +02:00
Molkobain
0a6c82dfe1 N°6752 - PHP unit tests: Fix typo in postbuild_integration.xml.dist 2023-09-19 08:37:46 +02:00
Molkobain
24c0f4950f Add missing .htaccess / web.config files in .gitignore for /extensions folder 2023-09-18 15:26:06 +02:00
Molkobain
d4dbbc59d4 N°6754 - PHP unit tests: Add local PHPUnit XML files to .gitignore 2023-09-18 15:23:52 +02:00
Molkobain
dc0cd44c79 N°6752 - PHP unit tests: Migrate usages of unitestautoload.php to composer autoloader 2023-09-18 15:14:44 +02:00
odain
6c6131ce03 N°5491 - test enhancement to reduce false positive 2023-09-15 10:07:42 +02:00
odain-cbd
e76728b2bf N°5491 - Inconsistent dictionnary entries regarding arguments to pass to Dict::Format-test first (#545) 2023-09-13 12:02:49 +02:00
Pierre Goiffon
e946fc65fc N°6709 New ItopTestCase::RequireOnceCurrentModuleFile 2023-09-07 14:38:19 +02:00
Pierre Goiffon
0d8ff7bbac N°6629 Set commit tests back to Mysql
For now we have perf issues on Jenkins with MariaDB (see N°6694)
2023-09-04 10:25:41 +02:00
Anne-Catherine
bf768311c2 N°5136 - "Select All objects" add obsolete objects even if the parameter show obsolete data is not activated (#467) 2023-08-31 15:13:20 +02:00
Molkobain
a8c689c6c0 N°6436 - Add unit test to ensure that we don't lose an API during merge between branches 2023-08-18 09:55:45 +02:00
Molkobain
1990ccb5d8 N°6436 - Move interfaces enumeration from 1 line to 1 line / interface (and re-ordered them) for easier merges in newer branches 2023-08-18 09:52:55 +02:00
Molkobain
e107be56e4 N°6097 - Tests: Fix missing hook entry in PHPUnit XML file that led to compiled environment being re-build for each test case 2023-08-18 09:51:15 +02:00
Molkobain
ed6df77cbb N°6097 - Tests: Optimize performances by creating custom env. only once and re-using it across test classes 2023-08-10 15:45:39 +02:00
Molkobain
1ad28312ec N°6097 - Tests: Introduce autoloader for "utility" classes and move them to a sub-folder for better organization as folder was still messy
Note that unittestautoload.php is now useless. We just keep for now until everything is migrated (projects / branches / modules)
2023-08-10 15:45:39 +02:00
Molkobain
f002aa04cd N°6097 - Tests: Enable PHP unit tests on a custom DataModel 2023-08-10 15:45:39 +02:00
Molkobain
b86d70623e N°6097 - Tests: Temporarily add test case for the new ItopCustomDatamodelTestCase class 2023-08-10 15:45:39 +02:00
Molkobain
fe3467309d N°6097 - Tests: Refactor base test classes for better extensibility 2023-08-10 15:45:39 +02:00
Molkobain
851ab9c356 N°6097 - Add \utils::GetDataPath() method to avoid duplicating manual path build 2023-08-10 15:45:39 +02:00
Molkobain
aef3c2e609 N°6097 - Fix \CMDBSource::DropDB() not resetting cache like \CMDBSource::DropTable() which can lead to errors when trying to re-create it afterwards 2023-08-10 15:45:39 +02:00
Pierre Goiffon
6d13397ba1 Add other integration tests in the beforeSetup group
All of those tests can be ran without a running iTop instance, and are blocking
2023-08-08 15:33:09 +02:00
Pierre Goiffon
c0c8a13864 💡 \MetaModel::GetObject : remove documented throw Exception 2023-08-04 14:55:38 +02:00
Pierre Goiffon
cd9beec313 Merge remote-tracking branch 'origin/support/2.6' into support/2.7 2023-07-26 12:07:09 +02:00
Eric Espie
5475b9fbbe N°3454 - MoveToProd in 2 steps - fix utils::GetCurrentModuleName() 2023-07-25 17:44:43 +02:00
Eric Espie
6f8e7c7002 N°3454 - MoveToProd in 2 steps - fix utils::GetCurrentModuleUrl() 2023-07-25 17:20:37 +02:00
Pierre Goiffon
bc7c1b4744 N°6590 Fix DictionariesConsistencyTest for PL dict files 2023-07-24 11:14:37 +02:00
Eric Espie
4d8246c4d8 N°6436 - Integrate Performance Audit pre requisite in iTop Pro 2.7.9 (changed config variable name) 2023-07-19 15:13:43 +02:00
Eric Espie
5c61d725e1 N°6436 - Integrate Performance Audit pre requisite in iTop Pro 2.7.9 (changed config variable name) 2023-07-19 15:06:00 +02:00
Eric Espie
2c4cad4dac N°6436 - Integrate Performance Audit pre requisite in iTop Pro 2.7.9 (avoid unnecessary calls) 2023-07-19 10:37:41 +02:00
Eric Espie
da45651121 Merge branch 'feature/6548_Hide_DBHost_and_DBUser_in_log' into support/2.7 2023-07-18 09:34:48 +02:00
Eric Espie
d388ce9a06 Merge branch 'feature/6548_Hide_DBHost_and_DBUser_in_log' into support/2.7 2023-07-18 09:17:40 +02:00
Eric Espie
47e71d8838 Merge branch 'feature/6436-Integrate_Performance_Audit_extensibility' into support/2.7 2023-07-18 09:17:05 +02:00
Stephen Abello
2b5973ec67 N°6436 - Integrate Performance Audit pre requisite in iTop Pro 2.7.9 2023-07-18 09:15:37 +02:00
Eric Espie
78396d8e4a 6548 - [ER] Hide DBHost and DBUser in log 2023-07-10 17:37:27 +02:00
Stephen Abello
9afc22bd8f N°6123 - Add tests and comments 2023-07-07 09:29:15 +02:00
Pierre Goiffon
264a8cd70a N°6494 - Some tests are run twice, some never
(cherry picked from commit a2a0b2cd0b)

(cherry picked from commit 4c9ea0c9d4)

# Conflicts:
#	tests/php-unit-tests/integration-tests/DictionariesConsistencyTest.php
2023-07-06 15:45:09 +02:00
Stephen Abello
aa1834170b N°6427 - Fix SwiftMailer not retrieving sendmail path 2023-07-06 14:31:54 +02:00
Stephen Abello
f94d67ab35 N°6340 - Fix permission refused when sending an email and renewing OAuth token in synchronous mode 2023-07-06 10:28:10 +02:00
Stephen Abello
3048c8c41f N°5560 - Display an error when trying to regenerate an expired OAuth token 2023-07-06 09:52:00 +02:00
Stephen Abello
246e4a9f50 N°6123 - Fix warnings when launching a backup on MariaDB > v10.6.1 with localhost dbhost 2023-07-06 09:28:01 +02:00
Molkobain
6d58adb6dd N°6359 - Fix JS crash due to new version trying to detect MSIE browser through a dependency that we don't have.
Cherry-picked from f889c53d71
2023-07-05 08:41:00 +02:00
Pierre Goiffon
5a0b5364d6 N°4698 setup/phpinfo.php : if no iTop installation then display a proper message instead of an exception (#265) 2023-06-14 10:18:38 +02:00
Pierre Goiffon
76eed2eba0 N°6098 updateLicenses script : check availability of the required JQ command (#458)
This packaging script requires both bash and the JQ command when running on Windows.
If the later isn't available, it will run without throwing an error...

With this change the script will now check directly at launch for the JQ command availability, and exit in error if it isn't.
2023-06-14 10:17:00 +02:00
Eric Espie
1ec671ef61 N°6351 - code hardening 2023-06-14 09:08:42 +02:00
Eric Espie
72716b7ec8 N°6396 - Protect URL display 2023-06-12 11:36:51 +02:00
Eric Espie
4f999de844 N°6359 - ⬆️ Update jQuery BBQ (from https://github.com/cee-chen/jquery-bbq) 2023-06-08 14:30:09 +02:00
odain
ea49c0a87c enable authent-cas in ci 2023-06-07 21:44:17 +02:00
odain
6cc971849b ci: enhance AddProfile 2023-06-07 21:44:00 +02:00
Pierre Goiffon
2405810864 N°6238 Security hardening 2023-06-07 16:45:35 +02:00
Eric Espie
fff46d99fc N°6358 - Login REST API - renamed test 2023-06-07 15:31:51 +02:00
odain
3a891f707c ci: enhance AddProfile test method to work with any User (not only UserLocal) 2023-06-07 15:06:28 +02:00
odain
8b6ea43ebe N°6358 - Login REST API - fix cas + add tests 2023-06-07 15:05:32 +02:00
Eric Espie
90cf7502e8 N°6358 - Login REST API 2023-06-07 10:09:30 +02:00
Eric Espie
c596fa2967 N°6358 - Login API REST 2023-06-07 09:17:24 +02:00
Timothee
a45177410e N°6350 - Fixing phpunit test 2023-06-06 16:47:06 +02:00
Eric Espie
9e96ea2873 N°6350 - code hardening 2023-06-01 15:35:56 +02:00
Eric Espie
1172159745 N°6351 - code hardening 2023-06-01 15:12:50 +02:00
Pierre Goiffon
fa038ded3d N°6254 ItopDataTestCase::CreateUserRequest : fix new argument default value
Was creating error Too few arguments passed
2023-04-26 16:42:27 +02:00
Pierre Goiffon
e7ea1b831c N°6254 ItopDataTestCase::CreateUserRequest : now pass fields values as array
More versatile way of doing things !
2023-04-26 16:22:26 +02:00
Molkobain
4aff65f98b N°6217 - Add accessiblity meta data for title on "Power menu" 2023-04-25 21:51:32 +02:00
acognet
3c94974d9d N°541 - Dashlets: Improve readability when to much labels (pie chart) or too long labels (bar chart) 2023-04-25 12:09:11 +02:00
Molkobain
fbd72b2783 N°6217 - Add accessiblity meta data for title on "Power menu" 2023-04-20 11:03:43 +02:00
Anne-Catherine
4e95ca3c7b N°541 - Dashlets: Improve readability when to much labels (pie chart) or too long labels (bar chart) (#452)
* N°541 - Dashlets: Improve readability when to much labels (pie chart) or too long labels (bar chart)
2023-04-13 11:23:20 +02:00
Pierre Goiffon
1114ed9562 N°6099 DeadLockLog : improve documentation and use existing constants (#441) 2023-04-12 10:21:34 +02:00
Pierre Goiffon
34368fe795 N°6173 \HTMLSanitizer::Sanitize : Fix handling only svg_sanitizer (#450) 2023-04-11 17:52:41 +02:00
Molkobain
0f016d7511 N°6112 - Dashboard: Improve robustness by trimming dashlet ID returned by server 2023-03-17 15:37:57 +01:00
Pierre Goiffon
5ee6223434 N°5893 Add test for \TriggerOnObject::LogException 2023-03-10 16:04:55 +01:00
Pierre Goiffon
d908827787 N°6016 Setup Wizard : fix MissingDependencyException message logged as html in setup.log
Was the case since e831d66b (commit for parent bug N°5090)
Now we are getting the text version in the log (and still the html one on screen)

The unattended install isn't concerned : it just prints back CheckResult returned by \SetupUtils::CheckSelectedModules, with the exception text message ($e->getMessage())
2023-03-06 11:24:46 +01:00
Pierre Goiffon
4cea418517 N°5893 - Log triggers exception in CRUD stack (#390)
* Log TriggerOnObjectCreate crash

* Log TriggerOnObjectUpdate crash

* Log TriggerOnObjectDelete crash

* Factorize TriggerOnObject log

* \TriggerOnObject::LogException : do not replace not persisted yet object keys
2023-02-28 15:13:28 +01:00
Molkobain
97965277c7 N°6017 - Update OAuth dependencies 2023-02-23 15:57:32 +01:00
Molkobain
18ed5ed526 N°6019 - Increase PHP min version to 7.1.3 to enable dependencies update 2023-02-23 14:53:48 +01:00
Pierre Goiffon
94c4f8c929 N°6016 MissingDependencyException : better log message (#355)
The error displayed on screen was already improved (see #280)
This commit improves the log message we can have for example by running unattended install.
2023-02-23 12:04:56 +01:00
Pierre Goiffon
822922df5c N°5588 - Improve PDF export robustness when AttributeImage dimensions cannot be determined (#350)
Can happen for example on SVG images
Now the export won't crash anymore, and we'll get a log (export channel, warning level) with  the object and attribute causing a problem as context

Co-authored-by: Molkobain <lajarige.guillaume@free.fr>
2023-02-23 11:45:29 +01:00
Stephen Abello
cac7e94a67 N°5729 - Fix disabled button in bulk update/transition when picking a value in a drop-down list 2023-02-22 15:42:20 +01:00
Stephen Abello
6d019615d0 N°5865 - Restore DoCheckToWrite error messages in portal 2023-02-22 10:17:34 +01:00
Molkobain
dbd58cfeb6 Tests: Force RestAPI unit tests not to verify SSL certificate as most dev / test envs are self-signed 2023-02-10 23:07:27 +01:00
Pierre Goiffon
f65e14397c N°4660 Fix permissions changes in tests 2023-01-16 11:22:23 +01:00
Pierre Goiffon
c696a81c3a N°5821 JenkinsFile : introduce buildDiscarder 2023-01-12 10:42:06 +01:00
Molkobain
845adf43c6 N°5608 - Harmonize namespaces and merge duplicated test files 2023-01-10 22:36:35 +01:00
Molkobain
5916e4ea39 N°5608 - Ensure both old & new tests structure are ran for extensions for backward compatibility 2023-01-10 22:03:40 +01:00
Molkobain
fbc0a898ae N°5608 - Move test files to corresponding directories after branch rebase 2023-01-10 12:11:12 +01:00
Molkobain
36f8e58e25 N°5608 - Use new ItopTestCase::RequireOnceXXX in unit tests 2023-01-10 12:11:12 +01:00
Molkobain
6a7dbb06b0 N°5608 - Add methods to require_once an iTop or a unit test file to avoid crashes when tests dir is moved 2023-01-10 12:11:12 +01:00
Molkobain
5721a324c1 Tests: Always display test status for better feedback 2023-01-06 22:30:09 +01:00
Molkobain
7de6c72154 Tests: Rename provider method name to match convention 2023-01-06 22:30:09 +01:00
Molkobain
c0cee02351 N°5608 - Factorize all core modules tests to a single test suite 2023-01-06 22:30:09 +01:00
Molkobain
bb674fb873 N°5608 - Move/rename "status" unit tests to match their counterpart location/name 2023-01-06 22:30:09 +01:00
Molkobain
6136eadd31 N°5608 - Fix some broken require paths since move/rename 2023-01-06 22:30:08 +01:00
Molkobain
87cb73c038 N°5608 - Rename "test" folder to "tests" to better match conventions 2023-01-06 22:30:08 +01:00
Molkobain
11d8547cef N°5608 - Move/rename unit tests to match their counterpart location/name 2023-01-06 22:30:08 +01:00
Molkobain
0998c73a1a N°5608 - Add README files 2023-01-06 22:30:07 +01:00
Molkobain
471f66649a N°5608 - Rename unitary test folders for better understanding 2023-01-06 22:30:07 +01:00
Molkobain
e8bf9cf688 N°5608 - Move "twig" PHP unit test to new folder
Notice: Test was not working, still not working
2023-01-06 22:30:07 +01:00
Molkobain
4f88a0e7d2 N°5608 - Move legacy PHP unit tests (not run by CI) to a dedicated folder 2023-01-06 22:30:07 +01:00
Molkobain
c6b0e273e6 N°5608 - Rename "VisualTests" folder to match new convention 2023-01-06 22:30:07 +01:00
Molkobain
d9539f9d01 N°5608 - Add comments to main autoloader 2023-01-06 22:30:06 +01:00
Molkobain
a3e309acb5 N°5608 - Revert "authent-local" test suite to its original rank as it is crashing the CI 🤔 2023-01-06 22:30:06 +01:00
Molkobain
c06cbfd4a9 N°5608 - Rename "coreExtensions" test suite to correct datamodel module (authent-local) 2023-01-06 22:30:06 +01:00
Molkobain
1d7e4e1a42 N°5608 - Move unit tests to a dedicated folder and start reorganizing to match iTop folder structure 2023-01-06 22:30:06 +01:00
Eric Espie
92a36dcfdd 📝 Change packages for auto-documentation 2022-12-29 12:24:56 +01:00
Eric Espie
b37e74b407 📝 Change packages for auto-documentation 2022-12-28 09:51:46 +01:00
Pierre Goiffon
0d49c605e2 💡 Fix \DBSearch::FromOQL phpdoc + modifiers order 2022-12-15 15:36:14 +01:00
Molkobain
7c2f8f4d93 N°5765 - Setup: Never cache folder permissions test response (#374) 2022-12-14 09:33:54 +01:00
Pierre Goiffon
1f76ff940d N°5797 Replace wrong config load (#338) 2022-12-13 18:23:09 +01:00
Eric Espie
bb26e48d38 Update version to next release 2.7.9 2022-12-12 16:19:42 +01:00
Eric Espie
cf433f2f80 N°5725 - Twig update 'filter', 'map' and 'reduce' filters 2022-12-08 08:25:11 +01:00
Eric Espie
ae94e58a43 N°5725 - Twig update 'filter', 'map' and 'reduce' filters 2022-12-07 13:53:15 +01:00
Eric Espie
cda017fa4f N°5725 - Twig update 'filter', 'map' and 'reduce' filters 2022-12-07 13:37:52 +01:00
Pierre Goiffon
dad22f6f83 📄 Update Licenses 2022-12-07 11:04:33 +01:00
Eric Espie
9077f7ba37 N°5430 - OAuth authentication : customize redirect landing URL - remove unnecessary parameter to JS function OAuthConnect 2022-12-02 11:17:01 +01:00
Eric Espie
957ff40f30 N°5155 - Email by SMTP with self-signed certificate (changed default values to the previous behaviour) 2022-12-02 09:25:53 +01:00
Eric Espie
aff9c7748b N°5155 - Email by SMTP with self-signed certificate 2022-11-30 14:18:11 +01:00
Eric Espie
e518d34bc9 N°5553 - OAuth 2 : Hide Client Secret
* client_id is now 255 chars (AttributeString)
 * client_secret is now 64 chars (AttributePassword) and cannot be anymore in the uniqueness rules
 * The modification of redirect_url, client_id or client_secret change the status to inactive and generate a session message to ask for token regeneration
2022-11-30 14:15:37 +01:00
Eric Espie
f0141530b9 N°5725 - Twig update 'filter', 'map' and 'reduce' filters (+1 squashed commits)
Squashed commits:

[00148dec5] N°5725 - Twig update 'filter', 'map' and 'reduce' filters
2022-11-30 13:28:33 +01:00
xtophe38
ce5096a896 N°5758 Change setup test for GDPR consent (#336)
We were using SetupUtils::IsProductVersion, but this was blocking for certain packages like TeemIP standalone.
After this change we are now relying on a new method : \SetupUtils::IsConnectableToITopHub. It will check the iTop Hub Connector module presence instead.
2022-11-29 19:00:17 +01:00
Pierre Goiffon
23e0ed5e56 N°4449 Test for FPD detection in RuntimeDashboard 2022-11-29 18:10:17 +01:00
Pierre Goiffon
d412a52fcc N°4449 Fix FPD in dashboard export/import 2022-11-29 18:10:17 +01:00
Molkobain
3e18ad590f Fix image attributes not being visible in PDF exports 2022-11-25 19:30:35 +01:00
Eric Espie
22111bf667 N°5611 - Fix missing composer files in itop-oauth-client 2022-11-24 14:32:51 +01:00
Eric Espie
6d0c46595d N°5611 - Fix missing composer files in itop-oauth-client 2022-11-24 14:27:42 +01:00
Eric Espie
d292a6b0c3 N°5333 - OAuth and iTop url change 2022-11-24 13:55:36 +01:00
Eric Espie
74702c8d06 N°5430 - OAuth authentication : customize redirect landing URL 2022-11-24 13:55:36 +01:00
Pierre Goiffon
e9c91d986d 📝 CONTRIBUTING : fix typo (stash in stead of squash)
Thanks Molkobain ! (https://github.com/Combodo/iTop/pull/371#discussion_r1030759606)
2022-11-24 09:00:32 +01:00
Eric Espie
70a6b276ca Merge branch 'issue/5685-UpgradeApereoPHPCas' into support/2.7 2022-11-23 15:58:36 +01:00
Eric Espie
f77361ceb2 N°5685 - Upgrade apereo/phpcas 2022-11-23 15:53:43 +01:00
Eric Espie
75f4751b82 N°5741 - remove use of get_config_parameter in Twig 2022-11-23 15:09:20 +01:00
Romain Quetiez
b56f2f56f1 N°5704 - Fix compatibility with PHP <7.3 (HEREDOC syntax) 2022-11-16 17:12:53 +01:00
Eric Espie
68d44fa981 N°5724 - code hardening 2022-11-16 09:32:47 +01:00
Eric Espie
7e5307bd96 N°4867 - "Twig content not allowed" error 2022-11-16 09:31:42 +01:00
Romain Quetiez
cd010afb48 N°5704 - Unit tests on XML assembly (#329)
* Add a complete test suite for XML assembly

* Add a complete test suite for XML assembly

* Dispatched the test of GetDelta into real unit tests

* Add test for GetDelta on a rename operation

* Add comments on a weird case and a case on rename

* Update XML version after rebase from develop to support/2.7

* Fix phpdoc about coverage

* Remove ModelFactory::GetRootDirs and ItopTestCase::RecurseRmDir+CreateTmpDir+RecurseMkDir+RecurseCopy, that were meant to be introduced in iTop 3.0 and have been copied here by mistake, when rebasing the branch from develop to 2.7.0

* Update test/ItopTestCase.php

Co-authored-by: Molkobain <lajarige.guillaume@free.fr>

* Update test/setup/ModelFactoryTest.php

Co-authored-by: Molkobain <lajarige.guillaume@free.fr>

* Update test/ItopTestCase.php

Co-authored-by: Molkobain <lajarige.guillaume@free.fr>

Co-authored-by: Pierre Goiffon <pierre.goiffon@combodo.com>
Co-authored-by: Molkobain <lajarige.guillaume@free.fr>
2022-11-08 19:43:07 +01:00
Pierre Goiffon
0cf8d731bb Rename iTopDesignFormat test class 2022-11-08 15:59:14 +01:00
Pierre Goiffon
189ca3c555 🚚 Move visual test file to the dedicated directory 2022-10-11 14:28:44 +02:00
Pierre Goiffon
1e1f1f78bf 📝 Backup : more details on check-backup parameters 2022-10-03 14:41:44 +02:00
Pierre Goiffon
1494604740 📝 Backup : move info from wiki to distrib file 2022-10-03 14:35:14 +02:00
Molkobain
583ab98210 Fix typo 2022-09-21 16:11:24 +02:00
Pierre Goiffon
88d743b1cc N°5538 Make PHPUnit test fail if transaction opened but not closed 2022-09-21 14:05:27 +02:00
Pierre Goiffon
7ac4bc95bb ItopDataTestCase : improve log message 2022-09-21 11:51:07 +02:00
Pierre Goiffon
d431811725 N°4947 Fix Email always picking "production" env config file (#331)
Note that the code was duplicated in both Email* impl, this is refactored : LoadConfig and m_oConfig are pulled up in Email, and SetRecipientFrom() calls are also refactored in Email
2022-09-14 15:33:48 +02:00
xtophe38
7512f721e9 Setup wizard : use the ITOP_APPLICATION constant instead of hardcoded "iTop" string (#335)
* Update wizardsteps.class.inc.php

* Done as requested

* Fix typo for better readability/genericity

Co-authored-by: Molkobain <lajarige.guillaume@free.fr>
2022-09-13 20:11:38 +02:00
Pierre Goiffon
bdfe3a3b35 N°5235 Tmp dir setup check is now non blocking (woops previous commit was incomplete) (#301) 2022-09-13 18:22:29 +02:00
Pierre Goiffon
5cf391c3bb N°5235 - Add non blocking setup check : is tmp dir is writable (#301) 2022-09-13 18:20:35 +02:00
Eric Espie
4c1df9927d N°5394 - use session for the FSM 2022-09-12 09:45:30 +02:00
Pierre Goiffon
74003f12c1 N°5513 Remove test name debug info 2022-09-08 18:20:52 +02:00
Pierre Goiffon
3bc12b0434 N°5513 Improve PHPUnit output to stdout
Will allow to see progress when looking at the Jenkins output
2022-09-08 15:11:02 +02:00
Pierre Goiffon
02a0969b53 N°5414 Fix undefined constant error in notification with wrong placeholder
Fix regression introduced in 33c2168 (#282)
2022-08-29 12:31:45 +02:00
Stephen Abello
d78a25ee4e N°5462 Add a setup check to verify if directory-level configuration files (.htaccess and web.config) are used by the server 2022-08-24 16:33:54 +02:00
Pierre Goiffon
7a6a3d1ac0 Integration tests : move and comment itop-community group 2022-08-24 14:41:32 +02:00
Pierre Goiffon
6b32be0899 N°5216 Fix invalid message-id when sending notification using cron on system with a specific locale set (#297)
The timestamp used was indeed locale dependent.
This commit fixes this behavior by removing the locale dependency using a better printf format (see https://www.php.net/manual/fr/function.sprintf.php)
2022-08-17 14:11:32 +02:00
Pierre Goiffon
33c2168af2 🔊 Adds a debug log for invalid placeholders (#282)
This adds a debug log when a placeholder cannot be replaced.
Before the placeholder was just not replaced.
Now we can enable a debug log on the LogChannels::NOTIFICATION channel.
2022-08-17 14:09:59 +02:00
Lars Kaltefleiter
ae021064a4 🌐 Update German translations for oauth-client (#319) 2022-08-16 17:02:37 +02:00
Benjamin Dalsass
0a61169326 Update version to next release 2.7.8 2022-08-16 09:47:46 +02:00
Anne-Catherine
d7e5705520 N°5318 - Fix DBObject::CheckValue() messages being HTML encoded when not necessary (#326)
* Rollback N°4898 - Security fix

* N°5318 - security fix
2022-08-12 17:50:14 +02:00
Stephen Abello
35a8b501c9 N°5393 Security hardening 2022-08-12 11:33:55 +02:00
Eric Espie
8fa616f440 N°5395 - Errors from OAuth servers for email are not well handled 2022-08-10 14:57:26 +02:00
Molkobain
5829e698da Fix typo 2022-08-09 17:19:21 +02:00
Molkobain
df347b90e5 N°5383 - Declare DBObject::EnumTransitions() as "overwritable hook" 2022-08-08 11:53:46 +02:00
acognet
bb861aa262 N°3024 - Archiving Service Families (or any class with no child) with combodo-archive-manual 2022-08-04 16:26:21 +02:00
acognet
f9ac07830e Fix translation 2022-08-04 16:26:01 +02:00
Pierre Goiffon
0f4c7ac90f N°5129 Prevent "fieldForm is null" JS error when updating dependant field
For example when changing Server.location, 3 JS errors are thrown in the console :/
2022-07-29 10:12:37 +02:00
Molkobain
0687f9a0a9 Convert line endings to LF on misaligned text files 2022-07-28 09:58:04 +02:00
Molkobain
6e75ab2889 Add .gitattributes to enforce line endings
More info: https://docs.github.com/en/get-started/getting-started-with-git/configuring-git-to-handle-line-endings
2022-07-28 09:44:42 +02:00
Molkobain
b90d29d448 🔧 Add IntelliLang.xml file to provide PHP synthax highlighting in DM XML files 2022-07-20 17:48:01 +02:00
Molkobain
1f78bf4119 N°5287 - Fix license in composer.json 2022-07-18 13:52:40 +02:00
Molkobain
5d25e77189 Code format 2022-07-13 17:03:01 +02:00
Molkobain
d9dabf25da PHPDoc 2022-07-13 17:03:01 +02:00
Molkobain
73af605892 Fix typo in dictionaries 2022-07-13 17:03:00 +02:00
Benjamin Dalsass
f70f95c119 Update community licence 2.7.7 (script from git bash, not php execution) 2022-07-11 15:20:36 +02:00
Benjamin Dalsass
53c50cf6fc Update community licence 2.7.7 2022-07-11 08:24:20 +02:00
Vincent Dumas
f19d1472c5 N°5102 - OAuth - replace double quote char EN
Use a special double quote characters so it is correctly handled in HTML
2022-07-08 13:44:00 +02:00
Vincent Dumas
eef00502cd N°5102 - OAuth - remove unsupported quote FR 2022-07-08 13:38:37 +02:00
Molkobain
0b1caac195 N°4867 - Restore datamodel node to avoid minor version migration crash
Will be properly removed in 3.1.0
2022-07-08 13:22:27 +02:00
Vincent Dumas
e900a44d47 N°5102 - OAuth client - FR tooltips 2022-07-08 12:22:52 +02:00
Vincent Dumas
a3de9fa898 N°5102 - OAuth client - Add EN tooltips 2022-07-08 12:06:47 +02:00
bdalsass
8b0154cc62 N°5168 - Access to unauthorized contact information on Portal (#305)
GlobalRequestMgmt issue
2022-07-08 09:51:20 +02:00
Eric Espie
1a225bf55b N°5102 - Allow to send emails using GSuite SMTP and OAuth - Access rights 2022-07-07 17:57:24 +02:00
Eric Espie
24d19cd8d6 N°5102 - Allow to send emails using GSuite SMTP and OAuth - Add a flag to select OAuth client for SMTP usage 2022-07-07 16:34:19 +02:00
Eric Espie
c25a4a7346 N°5102 - Allow to send emails using GSuite SMTP and OAuth - Access rights 2022-07-07 14:17:09 +02:00
Eric Espie
20fb7b241f N°5102 - Allow to send emails using GSuite SMTP and OAuth - Highlight classes 2022-07-06 17:23:44 +02:00
Eric Espie
a0553e1195 N°5102 - Allow to send emails using GSuite SMTP and OAuth - Highlight classes 2022-07-06 17:10:59 +02:00
Eric Espie
f40141072a N°5102 - Allow to send emails using GSuite SMTP and OAuth - Fix errors on vendor name 2022-07-06 14:10:01 +02:00
Eric Espie
c759856a61 N°5102 - Allow to send emails using GSuite SMTP and OAuth - Highlight classes 2022-07-06 10:10:42 +02:00
Pierre Goiffon
237b181eec 💡 Fix \SetupUtils::GetTmpDir PHPDoc 2022-07-05 18:09:59 +02:00
Eric Espie
48957fd2f0 N°5102 - Allow to send emails using GSuite SMTP and OAuth - refactor scopes 2022-07-05 17:54:43 +02:00
Pierre Goiffon
8a99c37200 N°5287 Fix composer.json errors
See https://getcomposer.org/doc/03-cli.md#validate
2022-07-05 15:08:29 +02:00
Eric Espie
d388c3fd3d N°5102 - Allow to send emails using GSuite SMTP and OAuth - Limit error size 2022-07-04 16:48:56 +02:00
Eric Espie
1b8e48539d N°5102 - Allow to send emails using GSuite SMTP and OAuth - Add comment in configuration 2022-07-01 14:32:44 +02:00
Eric Espie
104beff158 N°5102 - Allow to send emails using GSuite SMTP and OAuth - Fix log 2022-06-29 15:09:17 +02:00
Pierre Goiffon
4712569a36 📝 CONTRIBUTING : fix GitMoji link 2022-06-29 10:56:21 +02:00
Pierre Goiffon
2392f4a902 🔒 Update guzzlehttp/guzzle 2022-06-28 15:13:04 +02:00
Eric Espie
a0f28a9098 N°5102 - Allow to send emails using GSuite SMTP and OAuth - Rework 2022-06-28 10:47:20 +02:00
Eric Espie
6df622e8ed N°5102 - Allow to send emails using GSuite SMTP and OAuth - Rework 2022-06-23 14:05:17 +02:00
Eric Espie
54eb9d081b N°5102 - Allow to send emails using GSuite SMTP and OAuth - Rework 2022-06-23 12:20:53 +02:00
Eric Espie
9f60f27636 N°5102 - Allow to send emails using GSuite SMTP and OAuth - Rework 2022-06-22 16:41:45 +02:00
Eric Espie
ba59643f52 N°5102 - Allow to send emails using GSuite SMTP and OAuth - Rework 2022-06-21 16:47:46 +02:00
Eric Espie
01c02a75a8 N°5102 - Allow to send emails using GSuite SMTP and OAuth - Rework 2022-06-21 16:40:43 +02:00
Eric Espie
f5b3e5f341 N°5102 - Allow to send emails using GSuite SMTP and OAuth - Rework 2022-06-21 16:10:34 +02:00
Eric Espie
9b825cb529 N°5102 - Allow to send emails using GSuite SMTP and OAuth - Rework 2022-06-21 16:05:58 +02:00
Eric Espie
3f326f0913 N°5102 - Allow to send emails using GSuite SMTP and OAuth - Rework 2022-06-21 16:05:58 +02:00
acognet
ec86bd246a N°5129 - Unwanted popup during a transition with an AttributeExternalField 2022-06-21 15:24:25 +02:00
Eric Espie
aa90d5b6ab N°5102 - Allow to send emails using GSuite SMTP and OAuth - Rework 2022-06-21 13:51:08 +02:00
acognet
53d2129bd1 N°5129 - Unwanted popup during a transition with an AttributeExternalField 2022-06-16 17:58:19 +02:00
Benjamin Dalsass
00e8c11ec2 N°5037 - Setup: Add disclaimer about collected data
change ui organization
2022-06-14 17:18:34 +02:00
Benjamin Dalsass
617b6b991f N°5037 - Setup: Add disclaimer about collected data
flip modules array
2022-06-14 14:33:35 +02:00
Benjamin Dalsass
b3ea1050eb N°5037 - Setup: Add disclaimer about collected data 2022-06-14 12:40:36 +02:00
Benjamin Dalsass
ca98066d68 N°5037 - Setup: Add disclaimer about collected data 2022-06-14 10:54:25 +02:00
Pierre Goiffon
352f7c8675 Update guzzlehttp/guzzle 2022-06-14 09:47:13 +02:00
Eric Espie
df5d514c28 N°4642 - Core Update : limit the usage of this function to minor version - fix error message (revert) 2022-06-13 15:59:25 +02:00
Eric Espie
16663797b2 N°4642 - Core Update : limit the usage of this function to minor version - fix error message 2022-06-13 15:51:36 +02:00
Eric Espie
4099376472 N°5102 - Allow to send emails using GSuite SMTP and OAuth - Defer the deletion (expunge) to the end of connection 2022-06-09 11:40:13 +02:00
Eric Espie
6d3118d9e9 N°5102 - Allow to send emails (eg. notifications) using GSuite SMTP and OAuth (fix config error message) 2022-06-08 13:24:29 +02:00
odain
4c585614cd ease testing: CreateTestOrganization returns org object 2022-06-08 11:07:31 +02:00
Eric Espie
9674378c56 N°5211 - Core update not working with auto-selected modules (comments) 2022-06-08 10:36:55 +02:00
Eric Espie
9e314ba77b N°5211 - Core update not working with auto-selected modules 2022-06-08 10:24:03 +02:00
Eric Espie
cdd7dcdc5c N°5211 - Core update not working with auto-selected modules 2022-06-08 10:12:19 +02:00
Benjamin Dalsass
34bed5ec4f N°5215 - Portal insufficient access control for ajax search form 2022-06-07 11:14:43 +02:00
Pierre Goiffon
3ea82e37d5 N°4635 Report \LogChannels::NOTIFICATIONS 2022-06-03 18:00:29 +02:00
Pierre Goiffon
596c62aec8 💡 N°4867 Add bug reference in phpdoc 2022-06-03 09:54:29 +02:00
acognet
265415030e N°4867 - "Twig content not allowed" error when use the extkey widget search icon in the user portal - Add comment 2022-06-02 12:35:42 +02:00
Eric Espie
3d26f28f9b N°5102 - Allow to send emails (eg. notifications) using GSuite SMTP and OAuth
* Add icons to wizard
2022-06-01 11:44:02 +02:00
Eric Espie
0abec767e3 Dictionaries 2022-06-01 10:45:53 +02:00
Benjamin Dalsass
9fd10bd73e N°5168 - Security hardening 2022-05-31 16:28:02 +02:00
acognet
95dafc87c0 N°4867 - "Twig content not allowed" error when use the extkey widget search icon in the user portal - Add tests 2022-05-30 15:10:50 +02:00
acognet
fe1790793e N°4898 - security hardening 2022-05-30 15:10:49 +02:00
Eric Espie
ddb95dc64e Removed laminas service manager test folder 2022-05-27 09:32:16 +02:00
Eric Espie
f6f9ee26e1 Removed laminas service manager test folder 2022-05-27 09:29:00 +02:00
Eric Espie
21faa92904 Merge branch 'support/2.7' into feature/OAuthMail 2022-05-27 09:06:28 +02:00
Eric Espie
622f40c06c N°3169 - Add feature to connect Gsuite mail box with OAuth
N°2504 - Add feature to connect Office mail box with OAuth2 for Microsoft Graph
 * Fix legacy mailboxes compatibility
2022-05-25 08:21:16 +02:00
acognet
964134cb60 N°4867 - "Twig content not allowed" error when use the extkey widget search icon in the user portal - Remove useless code 2022-05-24 18:20:18 +02:00
acognet
72f498a63b N°5168 - Fix error message "Call to a member function GetKey() on null" 2022-05-24 10:50:56 +02:00
Pierre Goiffon
f9a1f68295 N°4655 Remove OQL tests
Were only here to check legacy OQL engine, but since 2.7.0 we fixed couple of bugs in the current OQL engine : we can't keep same functionalities in both engines :/.

Plus now we are working on 2.7.7 and we're not aware of any use of this legacy engine...

Note that it will be deprecated (N°3141) and removed (N°4715) very soon.
2022-05-24 10:38:59 +02:00
Pierre Goiffon
9b67b0b9d5 Same options in phpunit config files 2022-05-23 14:53:13 +02:00
acognet
f798ef1d76 N°4538 - Dashlet Groupby on ExternalKey with special character, bad display - remove useless test 2022-05-23 14:21:03 +02:00
Eric Espie
754946bf62 N°3169 - Add feature to connect Gsuite mail box with OAuth
N°2504 - Add feature to connect Office mail box with OAuth2 for Microsoft Graph
 * Fix legacy mailboxes compatibility
2022-05-23 12:09:40 +02:00
Eric Espie
a6580e3cd8 Merge branch 'support/2.7' into feature/OAuthMail 2022-05-23 10:56:32 +02:00
Pierre Goiffon
da6621f2ff Fix include warning in unittestautoload.php on Windows 2022-05-23 09:53:30 +02:00
Molkobain
f2d42a7e56 N°5002 - Simplify code 2022-05-20 18:41:39 +02:00
Benjamin Dalsass
d01e4b4a85 N°5168 - Security hardening 2022-05-20 16:08:25 +02:00
Pierre Goiffon
f57d1f1de3 Fix PHPunit errors with InlineImageMock.php and UtilsTest
HTMLDOMSanitizerTest : fix "Fatal error: Cannot declare class InlineImage, because the name is already in use in /var/www/html/iTop/test/core/sanitizer/InlineImageMock.php"
We are now injecting the class to mock, instead of declaring another class with the same name (was working before but why ?!???)

\UtilsTest::testSanitizer : no more testing the "class" filter, because it is a simple indirection, and we need to load datamodel which is causing multiple problems (see the comment in the test method dataprovider)
2022-05-20 10:48:05 +02:00
Eric Espie
a3f122184c N°4642 - Core Update : limit the usage of this function - revert due to N°4666 fix 2022-05-20 10:20:47 +02:00
acognet
16fcddc249 N°4867 - "Twig content not allowed" error when use the extkey widget search icon in the user portal (regression of N°4384 ) 2022-05-20 09:52:25 +02:00
Eric Espie
2a9c9be36a N°4666 - Core Update : handle modules 2022-05-20 09:42:14 +02:00
Eric Espie
ca3aae23a1 N°4666 - Core Update : handle modules 2022-05-20 09:33:41 +02:00
bdalsass
4dd384e418 N°4872 - Create a ticket in resolved statut Inlineimage disappear (#294) 2022-05-20 09:26:06 +02:00
Molkobain
80e7313b24 PHPDoc 2022-05-19 17:40:14 +02:00
Eric Espie
183c3c1baf N°4666 - Core Update : handle modules 2022-05-19 16:30:06 +02:00
Eric Espie
160c52fe81 Merge branch 'support/2.7' into feature/OAuthMail 2022-05-19 14:49:48 +02:00
Benjamin Dalsass
5f0a820b4a N°4899 - add sanitizer url since annotation and tests for sanitizer function 2022-05-19 08:36:42 +02:00
Benjamin Dalsass
03ef4246bf N°4899 - add sanitizer url since annotation and tests for sanitizer function 2022-05-18 12:03:07 +02:00
Pierre Goiffon
534e7cf59d N°4655 New nightly PHPUnit file containing OQL tests
Those tests were removed in 72af2b7c as they took too much time to run.
We are re-enabling them but only for nightly builds !
2022-05-18 09:35:13 +02:00
Eric Espie
e1645f6903 N°3169 - Add feature to connect Gsuite mail box with OAuth
N°2504 - Add feature to connect Office mail box with OAuth2 for Microsoft Graph
N°5102 - Allow to send emails (eg. notifications) using GSuite SMTP and OAuth
 * Config messages
 * Fix unit tests
2022-05-18 08:41:58 +02:00
Benjamin Dalsass
61a2d200b4 N°4900 - Stored XSS in dashlets failed OQL query 2022-05-18 08:10:01 +02:00
Benjamin Dalsass
3d6bbe4029 Revert "N°4900 - Stored XSS in dashlets failed OQL query"
This reverts commit 562dd8fc21.
2022-05-18 08:05:19 +02:00
Eric Espie
44eda676a3 N°3169 - Add feature to connect Gsuite mail box with OAuth
N°2504 - Add feature to connect Office mail box with OAuth2 for Microsoft Graph
N°5102 - Allow to send emails (eg. notifications) using GSuite SMTP and OAuth
 * 2.7 migration
2022-05-17 16:56:43 +02:00
Molkobain
eac6f07823 N°4985 - PHP 8.0: Fix optional parameter before mandatory parameter
* Method is always (once) called with the value defined in iTop
  * No Combodo extension call the method
  * No customization in the ITSM Designer (snippets / extensions) call the method
  * Calling method with only the first parameter would crash anyway
2022-05-17 16:51:50 +02:00
Pierre Goiffon
424e2a5745 💡 Fix PHPDoc for \DBObject::CheckConsistency 2022-05-17 15:52:43 +02:00
Molkobain
0ef4fee0b4 N°4985 - PHP 8.0: Fix usort callback return type 2022-05-17 15:28:04 +02:00
Eric Espie
1d45eff9b0 N°3169 - Add feature to connect Gsuite mail box with OAuth
N°2504 - Add feature to connect Office mail box with OAuth2 for Microsoft Graph
N°5102 - Allow to send emails (eg. notifications) using GSuite SMTP and OAuth
 * 2.7 migration
2022-05-17 10:11:15 +02:00
Benjamin Dalsass
8e97279401 N°4899 - Reflected XSS on revert_dashboard operation 2022-05-17 09:27:06 +02:00
Eric Espie
932ef780fd N°3169 - Add feature to connect Gsuite mail box with OAuth
N°2504 - Add feature to connect Office mail box with OAuth2 for Microsoft Graph
N°5102 - Allow to send emails (eg. notifications) using GSuite SMTP and OAuth
 * 2.7 migration
2022-05-17 09:06:49 +02:00
Benjamin Dalsass
59424c3126 N°4976 - CSRF in import page 2022-05-17 09:02:06 +02:00
Benjamin Dalsass
562dd8fc21 N°4900 - Stored XSS in dashlets failed OQL query 2022-05-17 08:20:26 +02:00
Molkobain
cf745554fb N°4985 - PHP 8.0: Fix strlen() test condition that needs to be more strict 2022-05-16 18:04:29 +02:00
Molkobain
e909eac98e N°4985 - PHP 8.0: Fix is_callable() first param syntax in ObjectFormManager 2022-05-16 17:44:34 +02:00
Molkobain
5e42efc3ec N°4985 - PHP 8.0: Fix usort callback return type in portal's lists initialization 2022-05-16 17:44:33 +02:00
Eric Espie
eb1d56f439 N°3169 - Add feature to connect Gsuite mail box with OAuth
N°2504 - Add feature to connect Office mail box with OAuth2 for Microsoft Graph
N°5102 - Allow to send emails (eg. notifications) using GSuite SMTP and OAuth
 * 2.7 migration
2022-05-16 14:51:12 +02:00
Eric Espie
644e1ac4f6 N°3169 - Add feature to connect Gsuite mail box with OAuth
N°2504 - Add feature to connect Office mail box with OAuth2 for Microsoft Graph
N°5102 - Allow to send emails (eg. notifications) using GSuite SMTP and OAuth
 * 2.7 migration (wip)
2022-05-13 16:27:56 +02:00
Stephen Abello
4c88dbd9ac N°2504 N°3169 N°5102 Add libraries 2022-05-13 14:39:19 +02:00
Stephen Abello
11d2e62e67 N°2504 N°3169 N°5102 Correctly disable authentication button for 2.7 2022-05-13 14:38:55 +02:00
Stephen Abello
58b27a9daa N°2504 N°3169 N°5102 Handle result display 2022-05-13 14:28:38 +02:00
Stephen Abello
caf939bf58 N°2504 N°3169 N°5102 Add dictionaries 2022-05-13 14:06:11 +02:00
Eric Espie
8c217fdac9 N°3169 - Add feature to connect Gsuite mail box with OAuth
N°2504 - Add feature to connect Office mail box with OAuth2 for Microsoft Graph
N°5102 - Allow to send emails (eg. notifications) using GSuite SMTP and OAuth
 * 2.7 migration (wip)
2022-05-13 12:07:27 +02:00
Eric Espie
6b80bbeaa2 N°3169 - Add feature to connect Gsuite mail box with OAuth
N°2504 - Add feature to connect Office mail box with OAuth2 for Microsoft Graph
N°5102 - Allow to send emails (eg. notifications) using GSuite SMTP and OAuth
 * 2.7 migration (wip)
2022-05-13 11:45:42 +02:00
Eric Espie
134736dce5 N°3169 - Add feature to connect Gsuite mail box with OAuth
N°2504 - Add feature to connect Office mail box with OAuth2 for Microsoft Graph
N°5102 - Allow to send emails (eg. notifications) using GSuite SMTP and OAuth
 * 2.7 migration (wip)
2022-05-13 11:37:09 +02:00
Stephen Abello
4b870bcf1e N°2504 N°3169 N°5102 Add js template 2022-05-12 17:38:38 +02:00
Eric Espie
dd8a4a0082 N°3169 - Add feature to connect Gsuite mail box with OAuth
N°2504 - Add feature to connect Office mail box with OAuth2 for Microsoft Graph
N°5102 - Allow to send emails (eg. notifications) using GSuite SMTP and OAuth
2022-05-12 14:40:55 +02:00
Molkobain
c2607c4223 N°5035 - Setup: Remove tracking image at the end of the setup 2022-05-09 13:55:06 +02:00
Pierre Goiffon
1fb0911710 🔧 N°3091 postbuild PHPunit XML : change html_errors PHP setting 2022-05-03 10:53:32 +02:00
Pierre Goiffon
b348e0ff27 🔧 N°3091 PHPunit XML : change html_errors PHP setting
We are outputting to console, and will get results in Jenkins or terminal, so no HTML please :o)
2022-05-03 10:51:48 +02:00
Pierre Goiffon
4646a05c7a N°4824 Update consumers after swiftmailer/swiftmailer
Multiple things to do as there were some changes in 6.0
Reference : https://github.com/swiftmailer/swiftmailer/blob/master/CHANGES#L107

* Fix "Call to undefined method Swift_Message::newInstance()" exception in notifications
* Fix removed Swift_MailTransport
2022-05-03 09:35:48 +02:00
Pierre Goiffon
c5527c106c 🔧 N°3091 PHPunit XML : set columns 2022-05-02 15:33:39 +02:00
Pierre Goiffon
5eac1b8730 🔧 N°3091 PHPunit XML : fix correct PHP INI settings
see https://phpunit.readthedocs.io/en/8.5/configuration.html#the-php-element
2022-05-02 15:25:59 +02:00
Pierre Goiffon
0de15d040f ⬇️ N°4824 rollback scssphp/scssphp update (won't be done in this branch !) 2022-05-02 09:15:48 +02:00
Pierre Goiffon
c4ae94fd4c Update denied test dirs 2022-04-29 17:15:50 +02:00
Pierre Goiffon
1e8818984e 📄 N°4284 Update licenses 2022-04-29 15:53:03 +02:00
Pierre Goiffon
a023f73509 N°4284 Update jquery UI SCSS to remove SCSSPHP warnings
Replace "Alpha(..." with "alpha(..."

Example of warning at compilation with SCSSPHP :

DEPRECATION WARNING: Calling built-in functions with a non-standard name is deprecated since Scssphp 1.8.0 and will not work anymore in 2.0 (they will be treated as CSS function calls instead).
Use "alpha" instead of "Alpha".
         on line 55 of /var/www/html/iTop/css/../css/ui-lightness/jqueryui.scss
2022-04-29 15:39:26 +02:00
Pierre Goiffon
6f0e1a7f47 N°4824 Update consumers after swiftmailer/swiftmailer update
Also remove new Doctrine test dir (iTopComposerTest feedback)
2022-04-29 15:24:56 +02:00
Pierre Goiffon
0ef9bb1a47 ⬆️ N°4824 Composer libs : update swiftmailer/swiftmailer 2022-04-29 15:24:56 +02:00
Pierre Goiffon
71ceedc4bb 🔨 N°4284 Detect new test dirs on composer update 2022-04-29 15:24:56 +02:00
Pierre Goiffon
73c3c1249f ⬆️ N°4824 Composer libs : update scssphp/scssphp 2022-04-29 15:24:56 +02:00
Pierre Goiffon
88a10dba28 N°4824 Update consumers after pelago/emogrifier update 2022-04-29 15:24:56 +02:00
Pierre Goiffon
001e222f67 ⬆️ N°4824 Composer libs : update pelago/emogrifier 2022-04-29 15:24:56 +02:00
Pierre Goiffon
af8bcdc242 ⬆️ N°4824 Composer libs : update pear/archive_tar 2022-04-29 15:24:56 +02:00
Pierre Goiffon
f4c7afc148 N°4824 Update consumers & tests after nikic/php-parser update
Was done in 3.0.0 with N°3867
(cherry picked from commit cd1ba097cb)
(cherry picked from commit 5b42f67a99)
(cherry picked from commit 2d98ca2318)
(cherry picked from commit ddc5bbd1bb)
2022-04-29 15:24:56 +02:00
Pierre Goiffon
b19c73a36e ⬆️ N°4284 Composer libs : update nikic/php-parser
Was done in 3.0.0 with N°3867
2022-04-29 15:24:55 +02:00
Pierre Goiffon
5fe0d0b94f ⬆️ N°4284 Composer libs : update combodo/tcpdf 2022-04-29 15:18:41 +02:00
Pierre Goiffon
f8d435d5f3 N°4284 Composer libs : refresh symfony 2022-04-29 15:18:41 +02:00
Pierre Goiffon
f15ef36fd1 N°4284 Composer libs : remove symfony/polyfill-php70
Though it is still downloaded because asked by symfony framework, but as we don't need it in our code no need to specify it here !
2022-04-29 15:18:41 +02:00
Pierre Goiffon
64b25c4daa 📌 N°4284 Composer libs : fix twig/twig to ~1.42.5
Without specifying explicitly the Twig version, since the update of require php from 5.6 to 7.0 we are getting Twig 2.12.5 !
We don't want Twig 2 as this version changes the macro scope and causes massive changes in our code... This update will be done later in other branches.
2022-04-29 15:15:32 +02:00
Pierre Goiffon
d0ba0d193b N°3091 iTopComposerTest : change deprecated PHPUnit method call 2022-04-22 14:42:12 +02:00
Pierre Goiffon
8e6e2432d3 Extensibility : iPortalUIExtension and AbstractPortalUIExtension aren't experimental anymore 2022-04-21 17:29:40 +02:00
Molkobain
83ec19dfca Remove duplicated lines in .gitignore 2022-04-21 14:26:56 +02:00
Pierre Goiffon
6e619f2c35 Fix \iTopConfigParserTest::testConfigWriteToFile_FromScratchInstallation throwing error 2022-04-21 12:02:35 +02:00
Pierre Goiffon
163ba41e8d N°3091 Update PHPUnit to 8.5 : remove doesNotPerformAssertions annotation
Modified tests :
- iTopConfigParsertest
- DBSearchIntersectTest::testIntersectOptimization

As expected this isn't working with PHPUnit 8.5
Why does it worked with previous PHPUnit 6 version ? Maybe this annotation wasn't handled yet ? The corresponding PHPUnit doc isn't available anymore...

Annotations doc for PHP 8.5 : https://phpunit.readthedocs.io/en/8.5/annotations.html#doesnotperformassertions
2022-04-21 12:02:35 +02:00
Pierre Goiffon
ec143c43db N°3091 Update PHPUnit to 8.5 : fix setUp and teardDown methods signatures
"Return type declaration must be compatible with parent"
See https://phpunit.de/announcements/phpunit-8.html "Return Type of Template Methods"
2022-04-21 12:02:35 +02:00
Pierre Goiffon
cacf0004a5 🙈 N°3091 Update PHPUnit to 8.5 : add PHPunit cache file to ignore
We don't want to disable the feature, nor we want this file to be versionned
https://phpunit.readthedocs.io/en/8.5/configuration.html#the-cacheresult-attribute
2022-04-21 12:02:35 +02:00
Pierre Goiffon
cb39541e2a N°3091 Update PHPUnit to 8.5 : composer and base files
Autoload wasn't working anymore, easy to see : just launch `php unittestautoload.php` (or see fatal errors when launching tests with your IDE)
2022-04-21 10:47:30 +02:00
Pierre Goiffon
b9ddadeb44 N°5109 update PHP requirements from 5.6 to 7.0
No embedded libs supports all versions from PHP 5.6 to 8.0 included :/
7.0.8 is required for our Symfony version (updated with N°4770)
2022-04-20 17:29:20 +02:00
Pierre Goiffon
11e811cc4b N°3717 Improve iTop object history API (#192)
This fixes a major flaw in the history API that was causing "phantom" CMDBChange records (without any CMDBChangeOp attached). That was happening especially in iProcess impl.
For example this lead to the creation of the combodo-cmdbchange-cleaner module in the Mail To Ticket extension.

The modifications in detail : 
- We can now pass a non persisted CMDBChange instance to \CMDBObject::SetCurrentChange
- No persistence done in \CMDBObject::CreateChange anymore
- Persistence of the attached CMDChange will be done if necessary in CMDBChangeOp::OnInsert
- New CMDBObject::SetCurrentChangeFromParams helper method to ease resetting the current change
2022-04-19 17:13:18 +02:00
Pierre Goiffon
e422adb0d0 N°4998 Fix CSS for AttributeDuration in transition form (#281) 2022-04-19 12:25:15 +02:00
Pierre Goiffon
e02d9f3f0e 💡 N°5090 Improve phpdoc using list array shape 2022-04-15 17:43:20 +02:00
Pierre Goiffon
e831d66b76 N°5090 Setup : improve missing dependencies message (#280)
The setup now relies on the new method MissingDependencyException::getHtmlDesc to get the message to display
MissingDependencyException is also now a CoreException child.

Note that previous behavior (MissingDependencyException instantiator setting message) is kept, as some consumer still do $e->getMessage() (like unattended install)
2022-04-15 17:30:05 +02:00
acognet
6fa2d47780 N°4538 - Dashlet Groupby on ExternalKey with special character, bad display 2022-04-15 10:03:04 +02:00
acognet
e691454339 N°5002 - memory leak after object creation in popup 2022-04-15 10:00:08 +02:00
Pierre Goiffon
92997e3e57 💡 N°2498 add @since 2022-04-08 08:54:07 +02:00
Pierre Goiffon
631b38a160 N°5003 Change cron_max_execution_time config param help text 2022-03-25 15:56:11 +01:00
Eric Espie
7ce5712b71 N°4967 - 'Previous Values For Updated Attributes' not updated if DBUpdate is called without modifying the object 2022-03-21 08:43:03 +01:00
acognet
61137a6f65 N°4479 - Impact analysis : Display and apply filter before display impact analysis graphical - Fix dictionnary 2022-03-18 11:02:04 +01:00
Pierre Goiffon
0080a2e733 💡 N°3129 Fix phpdoc
Method was renamed in 45b5c39a but I forgot to update the PHPDoc
2022-03-17 15:36:39 +01:00
acognet
7f4fddb378 N°4644 - Core update : confusing warning message when integrity of iTop std files is modified - fix default translation 2022-03-15 10:52:19 +01:00
acognet
a71cb97db3 N°4644 - Core update : confusing warning message when integrity of iTop std files is modified - fix comment 2022-03-14 15:30:35 +01:00
acognet
4c99f497cc N°4644 - Core update : confusing warning message when integrity of iTop std files is modified - List all modified files 2022-03-14 14:45:07 +01:00
Molkobain
0205cdf713 N°4791 - Portal: Fix "Twig not allowed" error when transition form has no editable field (auto redirect)
Regression from b6fac4b4
2022-03-13 18:15:49 +01:00
Molkobain
39fc59a8b2 Code cleanup 2022-03-13 17:55:04 +01:00
Molkobain
107c9adf60 N°4791 - Expand usage of ObjectFormHandlerHelper::ENUM_MODE_XXX constants for better robustness / comprehension 2022-03-13 17:29:55 +01:00
Molkobain
d29880b1b8 Update PHPDoc 2022-03-11 17:52:10 +01:00
acognet
2d156bd77b N°4642 - Core Update : limit the usage of this function - disable if new modules found 2022-03-10 16:47:21 +01:00
acognet
d122dbfdd6 N°4642 - Core Update : limit the usage of this function - disable if new modules found 2022-03-10 16:06:37 +01:00
acognet
46d58e6512 N°4642 - Core Update : limit the usage of this function - disable if new modules found 2022-03-10 15:24:29 +01:00
Molkobain
93a138606f N°4664 - Core Update : block zip file upload until instance declared OK 2022-03-09 18:21:08 +01:00
Molkobain
70074ee1cb N°4644 - Core update: Update translations with missing entry 2022-03-09 17:31:22 +01:00
Molkobain
d28ccb264f N°4644 - Core update : confusing warning message when integrity of iTop std files is modified
(cherry picked from commit 69a0bd0c34)
2022-03-09 17:28:38 +01:00
odain-cbd
8ab38854a8 N°4920 - Fix "undefined index" notice in user rights (#271) 2022-03-08 18:21:40 +01:00
acognet
9f27cf2b84 N°4525 - bad source for extensions in system information and about iTop with iTop Pr 2022-03-03 15:14:28 +01:00
Pierre Goiffon
f78986009f Improve messages of iTopModuleXmlInstallationChecklistTest::testAllModuleAreIncludedInInstallationXml 2022-03-03 10:46:06 +01:00
Pierre Goiffon
809ea2eb49 💡 N°4854 Add phpdoc to utils::*Module* methods 2022-03-02 09:42:09 +01:00
Pierre Goiffon
968a0e5f3a Add check to prevent setup crash when creating config
Cherry-pick of 09b12bd0
This will prevent also a warning when running on PHP 8.0 (N°3129)
2022-02-24 15:39:20 +01:00
acognet
83e98ef2b8 N°4284 - Object modification: Attribute value lost if not allowed to be seen 2022-02-17 17:06:06 +01:00
Pierre Goiffon
5048421bfa 🔥 N°4815 Remove .model files in /dictionaries
They were added with 3fb0c768 in 2.5.2, probably by mistake as they :
* exists only for certain languages and not for english
* only contain comments
2022-02-16 10:17:42 +01:00
acognet
788caf9c50 N°4284 - Object modification: Attribute value lost if not allowed to be seen 2022-02-14 12:26:16 +01:00
acognet
35165568af N°4057 - Custom Translation for Custom Tab is not inherited by instanciable Classes 2022-02-14 09:10:18 +01:00
Molkobain
4a67819f87 N°4714 - Revert rename of utils::GetItopVersionWikiSyntax as it is used in cached packages in the ITSM Designer 2022-02-11 20:00:39 +01:00
Pierre Goiffon
81c39c35cd N°4771 Fix lib test dir detection
Thanks to @Molkobain and @Hipska for their review in dfaa9733
2022-02-11 18:15:56 +01:00
Pierre Goiffon
4caf52f1ae 🔥 N°4781 Remove SetupUtils::Log 2022-02-11 16:48:24 +01:00
Pierre Goiffon
0c5b845c8a 📄 N°4770 Update license file 2022-02-11 16:23:54 +01:00
Pierre Goiffon
cdfdb1f2ca 🔧 N°4770 composer.json version constraint
Will help Dependabot !
2022-02-11 16:23:54 +01:00
Pierre Goiffon
f29a8792af ⬆️ N°4770 Update to latest Symfony 3.4 2022-02-11 16:23:03 +01:00
Pierre Goiffon
b494ff2ce6 N°4488 Remove cmdbAbstractObject methods used in export.php from API methods and add comment in export.php
`@deprecated` was added in 03e9bcd4 but as none of those will be removed in a near future, we are using `@internal`instead !
2022-02-11 16:15:35 +01:00
odain
df1e19dc43 enhance ItopDataTestCase->CreateUser to avoid be able to avoid hardcoded contact_id 2022-02-11 14:10:02 +01:00
Pierre Goiffon
9ad341f73a N°4771 Fix .make/composer/rmDeniedTestDir.php Throwing errors when dir in denied list not existing on disk 2022-02-10 15:12:31 +01:00
acognet
03e9bcd47a N°4488 - deprecate cmdbAbstractObject::GetSetAsHTMLSpreadsheet() used only by the old export.php 2022-02-10 15:04:59 +01:00
acognet
55effea0a3 N°4513 - User Portal can apply transition on on an objetc not in his scope 2022-02-10 14:01:21 +01:00
Pierre Goiffon
dfaa973359 N°4771 improve iTopComposerTest
- debug testListDeniedTestDir not working well on Windows
- update error message for testAllDirCovered
2022-02-10 12:54:09 +01:00
Pierre Goiffon
2e45b20fc4 N°4771 Fix .make/composer/rmDeniedTestDir.php doing nothing on Windows
Note that a .gitignore entry was added in dbc3da7b but it isn't necessary if rmDeniedTestDir work as expected !
2022-02-10 12:45:52 +01:00
Pierre Goiffon
e89090f0ec N°4771 Update lib test dirs list : reordered for readability / easier maintenance 2022-02-10 12:08:18 +01:00
Pierre Goiffon
47db04bcb7 💡 N°4760 Add complement in phpdoc 2022-02-09 11:48:17 +01:00
Pierre Goiffon
a49c451ae4 💡 N°4760 Fix wrong phpdoc 2022-02-09 11:43:42 +01:00
Pierre Goiffon
25c3704990 N°4761 Fix license.xml content not displayed in setup with multi modules extensions (#261)
For example :
module "mymodule" is in extension "myextension"
On the file system the `license.xml` file will be in `/extensions/myextension/mymodule/license.mymodule.xml`
This form wasn't working in the setup but well displayed in the about box.

When \SetupUtils::GetLicenses was called in the setup it was searching with a GLOB pattern only in one level subfolders. Now we are searching 2 levels.
When called from the console, it is only searching in env-*, where everything is on one level.
2022-02-08 17:28:47 +01:00
Pierre Goiffon
3000659e86 🎨 Change disable breadcrumb method name to clarify usage
Thanks @eespie for the review !
2022-02-08 17:04:11 +01:00
Pierre Goiffon
ce36c00b83 Remove now useless default values
Co-authored-by: Thomas Casteleyn <thomas.casteleyn@super-visions.com>
2022-02-08 17:04:11 +01:00
Pierre Goiffon
2a3e6384d9 ♻️ After dev team code review 2022-02-08 17:04:11 +01:00
Pierre Goiffon
dd7e73e413 🎨 Simpler code
Thanks Hipska !
2022-02-08 17:04:11 +01:00
Pierre Goiffon
1709082e39 Controller::CreatePage : default values for sUrl and sIcon 2022-02-08 17:04:11 +01:00
Pierre Goiffon
41f6e85673 Controller::CreatePage : use @list() intead of 3 lines with count() tests
Thanks Hipska !

Co-authored-by: Thomas Casteleyn <thomas.casteleyn@super-visions.com>
2022-02-08 17:04:11 +01:00
Pierre Goiffon
3ef3166bd5 Add new methods to override in order to control breadcrumb in Controller children classes 2022-02-08 17:04:11 +01:00
Pierre Goiffon
299ad7e753 N°4714 Fix \utils::GetCoreVersionWikiSyntax throwing Exception when 2nd version digit is "0" (for example in 3.0.1) 2022-02-08 14:48:02 +01:00
acognet
84280a3b5f N°4530 - Bug with OQL and profiles. 2022-02-04 16:21:53 +01:00
Pierre Goiffon
b4fc647845 N°4714 Rename \utils::GetItopVersionWikiSyntax to GetCoreVersionWikiSyntax
Will avoid confusion between core or product version !
2022-02-01 15:40:43 +01:00
Pierre Goiffon
17612f88d3 N°4714 utils version method refactoring
- removes utils::GetItopPatchVersion and GetItopMinorVersion : unused and badly named :/
- GetItopVersionWikiSyntax now uses core version constant
- iTopModulesPhpVersionIntegrationTest::testiTopModulesPhpVersion now uses ITOP_CORE_VERSION constant
2022-02-01 15:24:56 +01:00
Pierre Goiffon
e14845728c Prepare 2.7.7 2022-02-01 15:19:10 +01:00
Pierre Goiffon
4e80fc0f76 N°4624 Remove processIsolation flag from postBuild tests
Was done in standard test suite (test/phpunit.xml.dist) with 6bf25f90
2022-02-01 14:50:33 +01:00
Pierre Goiffon
fcfcf85e0d N°4714 fix constant version usages in utils methods 2022-02-01 11:39:57 +01:00
Pierre Goiffon
f0715baf7d N°4714 move constant from core/config.class.inc.php to approot.inc.php
see N°4406
2022-02-01 11:39:35 +01:00
Pierre Goiffon
45b5c39af7 N°3129 PHP 8.0 compat : code review modifications
Many thanks @Molkobain & @Hipska !
2022-01-31 16:41:35 +01:00
Pierre Goiffon
dbc3da7bc3 N°3129 Remove twig-bundle Test dir
Thanks to iTopComposerTest::testNoDeniedDirIsPresentForNow :o)
2022-01-28 17:25:55 +01:00
Pierre Goiffon
ebc9fa684a N°3129 PHP 8.0 compat: Fix "Private methods cannot be final as they are never overridden by other classes"
Was breaking setup ajax compilation
Fixed in:
* \SetupUtils::Log
* \MetaModel::SetUniquenessRuleRootClass
2022-01-28 17:01:07 +01:00
Pierre Goiffon
606bdc1909 N°3129 PHP 8.0 compat: Fix "Access level to MFElement::ReplaceWith() must be public (as in class DOMElement)" 2022-01-28 17:01:07 +01:00
Pierre Goiffon
7495fb9af4 N°3129 PHP 8.0 compat: Fix "Deprecated: Required parameter ... follows optional parameter ..." in Twig
Update symfony/twig-bundle from 3.4.36 to 3.4.47
2022-01-28 17:01:07 +01:00
Pierre Goiffon
75dbad7406 N°3129 PHP 8.0 compat: Fix "Deprecated: Required parameter ... follows optional parameter ..."
* \SQLObjectQuery::PrepareSingleTable
* \HistoryBlock::GetRenderContent
* \MenuBlock::GetRenderContent
* \UILinksWidgetDirect::DisplayAsBlock
* \UILinksWidgetDirect::Display
* \UILinksWidgetDirect::DisplayEditInPlace
* \UIExtKeyWidget::AutoComplete
* \UIExtKeyWidget::DisplayFromAttCode
2022-01-28 17:01:07 +01:00
Pierre Goiffon
3381c085f4 💡 N°4714 fix phpdoc 2022-01-27 16:15:57 +01:00
Pierre Goiffon
9b6f7d94f4 N°4714 Handle ITOP_CORE_VERSION update in .make/release/update-versions.php 2022-01-26 15:45:10 +01:00
Pierre Goiffon
64e8aa5fee N°4714 New ITOP_CORE_VERSION constant
See following constants PHPDoc for information :
* core/config.class.inc.php ITOP_VERSION
* core/config.class.inc.php ITOP_CORE_VERSION
* setup/itopdesignformat.class.inc.php ITOP_DESIGN_LATEST_VERSION
2022-01-26 15:19:29 +01:00
Pierre Goiffon
477128ad53 💡 N°4023 More phpdoc on \DBObjectSearch::AddCondition 2022-01-26 13:58:49 +01:00
Pierre Goiffon
aa66bec783 💡 Add comment for the timezone config parameter 2022-01-24 15:54:42 +01:00
Pierre Goiffon
1da52a8517 Revert "dbtools report.php : compatibility with CLI + symlinks"
Woops pushed by mistake, sorry :/

This reverts commit cbd2181862.
2022-01-24 14:22:01 +01:00
Pierre Goiffon
cbd2181862 dbtools report.php : compatibility with CLI + symlinks 2022-01-24 14:16:41 +01:00
Stephen Abello
4180a41f27 N°4652 Better error message when XML node define fails from delta (#256)
N°4652 Add more details when trying to define an already existing XML node
Co-authored-by: Molkobain <guillaume.lajarige@combodo.com>
Co-authored-by: Pierre Goiffon <pierre.goiffon@combodo.com>
2022-01-14 10:20:46 +01:00
Pierre Goiffon
a43adcd202 🔧 phpunit.xml comment OQL better
Was executing on Jenkins :(
2022-01-13 13:11:26 +01:00
Pierre Goiffon
e8e170fb06 🔧 phpunit.xml reorder testSuites again 2022-01-13 13:05:42 +01:00
Pierre Goiffon
5ac5d649aa 🔧 Try again : reorder test suites for better readability
Jenkins should now be fixed
2022-01-13 12:15:12 +01:00
Pierre Goiffon
decb802df4 Revert "🔧 Reorder test suites for better readability"
This reverts commit cacc3a3085.
2022-01-13 09:48:07 +01:00
Pierre Goiffon
cacc3a3085 🔧 Reorder test suites for better readability 2022-01-13 09:42:21 +01:00
Pierre Goiffon
0fd2ea6a47 🎨 phpunit.xml code formatting 2022-01-13 09:42:21 +01:00
Pierre Goiffon
426f275c03 💡 Add additional phpdoc to \DBBackup::GetMysqlCliTlsOptions 2022-01-12 11:21:21 +01:00
Pierre Goiffon
693a861e7d ♻️ Refactor DBBackuptest
Split each test in a dedicated method
2022-01-12 09:42:57 +01:00
Pierre Goiffon
0ee6c60e94 Fix DBBackupTest (again :/)
Was working on Windows but not on Linux...
2022-01-12 09:12:04 +01:00
Pierre Goiffon
a663e9fded Fix DBBackupTest
DB connection dependency was added in a222ead4 (N°2336) in \DBBackup::GetMysqlCliTlsOptions but test wasn't updated accordingly :/^

The test wasn't ran on Jenkins until b11bf308, so we saw the regression only yesterday :(

This is now fixed ! 🥳
2022-01-12 09:00:26 +01:00
Pierre Goiffon
b3bf516b20 💡 Fix PHPDoc for \DBBackup::GetMysqlCliTlsOptions 2022-01-12 08:24:28 +01:00
Molkobain
c2408b74cd Unit tests: Fix invalid/duplicate class name 2022-01-11 18:13:13 +01:00
Pierre Goiffon
6855c2f83a N°4624 restore backupGlobals to default 2022-01-11 17:29:32 +01:00
Molkobain
b11bf30881 Unit tests: Activate tests that were never ran... 🥶
Note that testGetMysqlCliTlsOptions will fail
2022-01-11 15:49:21 +01:00
Molkobain
64736f1463 Fix unit test provider 2022-01-11 15:48:45 +01:00
Pierre Goiffon
930b224ca2 💡 N°4624 phpdoc for ItopDataTestCase 2022-01-11 15:36:40 +01:00
Pierre Goiffon
92b61c7491 N°4558 Rename \LogChannels::CMDBSOURCE to CMDB_SOURCE to match existing constant in support/3.0 branch 2022-01-10 17:09:43 +01:00
Pierre Goiffon
e530cbb4f2 N°4624 Restore processIsolation on tests which actually need it
Warning, one symptom was having the CI returning an empty phpunit.results.xml !!
2022-01-07 17:25:18 +01:00
Pierre Goiffon
ddb8378fe6 N°4624 align phpunit annotations
Remove processIsolation when not needed
When needed, make sure to have also their counterpart (preserveGlobalState and backupGlobals)
2022-01-07 15:20:34 +01:00
Pierre Goiffon
47db23d91c 💚 N°4624 Fix other tests after global processIsolation was disabled in 6bf25f90 2022-01-07 12:44:08 +01:00
Pierre Goiffon
fc1f701bf6 💚 N°4624 TransactionsTest : add process isolation
Was global before 6bf25f90
2022-01-07 12:34:09 +01:00
Stephen Abello
365c7bb89e N°4397 Update Turkish translations 2022-01-07 11:09:51 +01:00
Pierre Goiffon
b073e4385c 💡 Document versions constants (#255)
Clarify ITOP_VERSION and ITOP_DESIGN_LATEST_VERSION uses
2022-01-06 14:49:34 +01:00
Pierre Goiffon
f9359431fe 💡 N°4558 Add PHPDoc 2022-01-03 12:21:55 +01:00
Pierre Goiffon
25e560fdaa N°4558 Fix possible PHP notice in \CMDBSource::StartTransaction 2021-12-31 16:34:19 +01:00
Pierre Goiffon
6bf25f90bc Tests : remove global process isolation
Is done in ItopDataTestCase using annotation
Other tests (like the one extending ItopTestCase) won't use isolation anymore
2021-12-29 15:31:25 +01:00
acognet
3db20e8028 N°4479 - Impact analysis : Display and apply filter before display impact analysis graphical 2021-12-23 16:53:15 +01:00
Pierre Goiffon
b190d0e385 Prepare 2.7.6 version 2021-12-14 16:54:42 +01:00
Pierre Goiffon
93f273a287 N°4384 Fix PHP warning when decoding formmanager_data when it is already in a PHP array form 2021-12-10 17:10:46 +01:00
Pierre Goiffon
04e7616c84 Merge remote-tracking branch 'origin/support/2.6' into support/2.7
# Conflicts:
#	sources/renderer/bootstrap/fieldrenderer/bslinkedsetfieldrenderer.class.inc.php
2021-12-10 15:57:49 +01:00
Pierre Goiffon
02b09c2535 Merge remote-tracking branch 'origin/support/2.6' into support/2.7 2021-12-10 13:38:42 +01:00
Pierre Goiffon
69578d5d07 Merge remote-tracking branch 'origin/support/2.6' into support/2.7 2021-12-10 12:30:57 +01:00
Pierre Goiffon
7e0d5d64ce Merge remote-tracking branch 'origin/support/2.6' into support/2.7 2021-12-10 09:21:43 +01:00
Pierre Goiffon
eb2a615bd2 N°4384 Security hardening
Module parameter flag for extensions
2021-12-09 12:08:23 +01:00
Pierre Goiffon
0432727ace 🎨 Reformat itop-tickets XML 2021-12-09 11:07:57 +01:00
Pierre Goiffon
e6d61d1ebd Merge remote-tracking branch 'origin/support/2.6' into support/2.7 2021-12-08 17:16:33 +01:00
Stephen Abello
5e61388b65 N°4495 Security hardening 2021-12-07 09:56:20 +01:00
Stephen Abello
910bbe1160 N°4501 Security hardening 2021-12-03 11:10:52 +01:00
odain-cbd
9addc4a7ca Merge pull request #224 from Combodo/feature/dict-apcu-bug
Feature/dict apcu bug
2021-12-02 12:22:22 +01:00
odain
5ed71ecb96 N°4125 - fix file ending (hipska remark) 2021-12-02 12:21:54 +01:00
Stephen Abello
dab0e372d0 N°4499 Security hardening 2021-12-02 10:32:29 +01:00
Stephen Abello
dfd1d5fe35 N°4493 Security hardening 2021-12-02 09:54:31 +01:00
Stephen Abello
d289457c0c N°4495 Security hardening 2021-12-02 09:39:10 +01:00
Stephen Abello
f52b3bff0d N°4492 Security hardening 2021-12-01 15:53:52 +01:00
Stephen Abello
b6b17733bf N°4491 Security hardening 2021-12-01 10:29:29 +01:00
acognet
c1c2d027c3 N°4402 - DbObject::ListPreviousValuesForUpdatedAttributes() returns new values for _list-attributes (at least in DbObject::AfterUpdate()) Fix test 2021-11-30 12:11:04 +01:00
acognet
5269096ecd Merge branch 'support/2.7' of github.com:Combodo/iTop into support/2.7 2021-11-29 15:07:14 +01:00
odain
e4c68936a0 N°4125 - log error in an apc channel 2021-11-29 09:23:05 +01:00
Pierre Goiffon
4db5d4c08d N°4213 Allow all AttributeSet impl to be saved in portal 2021-11-26 17:14:01 +01:00
odain
3511867ba3 N°4125 - use Error log level + apc dedicated log channel 2021-11-26 17:07:20 +01:00
Pierre Goiffon
7934f9b9dc N°4213 Fix EnumSet modifications cannot be saved in portal 2021-11-26 15:25:30 +01:00
Molkobain
7f2eef4a24 Merge remote-tracking branch 'origin/support/2.6' into support/2.7 2021-11-26 13:59:29 +01:00
Pierre Goiffon
7d6b019cfa Merge remote-tracking branch 'origin/support/2.6' into support/2.7
# Conflicts:
#	sources/renderer/bootstrap/fieldrenderer/bslinkedsetfieldrenderer.class.inc.php
2021-11-26 11:45:11 +01:00
Pierre Goiffon
c9c32b0de1 Merge remote-tracking branch 'origin/support/2.6' into support/2.7 2021-11-26 10:58:30 +01:00
odain
dcfdb2d0a9 N°4125 - add integration test apart from ApcService mocking 2021-11-26 10:28:56 +01:00
odain
0cbf34ba5a N°4125 - fix tests under windows (again) 2021-11-26 09:47:01 +01:00
odain
f1037147a9 N°4125 - phpdoc only coming from pull request
Thanks to Hispka and  piRGoif
2021-11-26 09:17:19 +01:00
odain
bea52d5fb9 N°4125 - test did not run under windows 2021-11-26 09:12:58 +01:00
Pierre Goiffon
b6fac4b411 N°4384 Security hardening 2021-11-25 16:07:40 +01:00
Pierre Goiffon
d8a77c22a3 Merge remote-tracking branch 'origin/support/2.6' into support/2.7
# Conflicts:
#	datamodels/2.x/itop-portal-base/portal/public/lib/datatables/js/dataTables.fixedHeader.min.js
#	datamodels/2.x/itop-portal-base/portal/public/lib/datatables/js/dataTables.responsive.min.js
#	datamodels/2.x/itop-portal-base/portal/public/lib/datatables/js/dataTables.scroller.min.js
#	datamodels/2.x/itop-portal-base/portal/public/lib/datatables/js/dataTables.select.min.js
#	datamodels/2.x/itop-portal-base/portal/public/lib/datatables/js/jquery.dataTables.min.js
2021-11-25 15:33:52 +01:00
Pierre Goiffon
312a5b246b N°4399 Fix memory error on setup when lots of attachment in DB 2021-11-24 16:55:34 +01:00
acognet
903de43589 N°4402 - DbObject::ListPreviousValuesForUpdatedAttributes() returns new values for _list-attributes (at least in DbObject::AfterUpdate()) Add tests 2021-11-24 12:10:30 +01:00
Pierre Goiffon
2d67594ccf N°4213 Fix EnumSet rendering on details form in portal 2021-11-24 12:07:10 +01:00
Pierre Goiffon
65f9f86bcc N°3635 DictionariesConsistencyTest : now we can have multiple possible localized language desc
The 'Español, Castellaño' to 'Español, Castellano' was causing problem on builds with other modules that we don't want to update !
2021-11-23 18:59:10 +01:00
Pierre Goiffon
efaf53e568 Merge remote-tracking branch 'origin/support/2.6' into support/2.7
# Conflicts:
#	core/htmlsanitizer.class.inc.php
2021-11-23 18:07:02 +01:00
Pierre Goiffon
77880c3675 🌐 N°3635 ES dict : change 'Español, Castellaño' to 'Español, Castellano' 2021-11-22 08:55:08 +01:00
Pierre Goiffon
3559425fc1 N°°4463 Trigger : remove user rights check when controlling filter 2021-11-19 15:20:21 +01:00
Molkobain
d8c4251c03 Remove (some) redundant description in spanish translations 2021-11-19 11:27:46 +01:00
Pierre Goiffon
9437e689fd N°3635 Update ES translations
Many thanks to Miguel Turrubiates !
2021-11-18 17:48:43 +01:00
Pierre Goiffon
a79459bc53 N°4162 Portal exception page : restore exception message
Was removed with Silex to Symfony migration
2021-11-18 14:56:17 +01:00
Pierre Goiffon
500bd15843 Merge remote-tracking branch 'origin/support/2.6' into support/2.7 2021-11-18 08:54:32 +01:00
Pierre Goiffon
d0fade9ce1 Merge remote-tracking branch 'origin/support/2.6' into support/2.7
# Conflicts:
#	pages/ajax.render.php
#	setup/wizardsteps.class.inc.php
2021-11-17 17:39:36 +01:00
Pierre Goiffon
bcca6ac720 Merge remote-tracking branch 'origin/support/2.6' into support/2.7 2021-11-15 15:07:19 +01:00
odain
865f9f4f67 add @since annotation + @see from Hispka 2021-11-09 17:14:13 +01:00
odain
a7e54d4bad N°4125 - fix infinite loop 2021-11-09 17:08:08 +01:00
Pierre Goiffon
6847d8a5c7 N°4414 Startup error handler : fix message logged twice (#243) 2021-11-09 10:25:29 +01:00
Pierre Goiffon
06985d3cf2 N°4387 synchro_import restore previous set_time_limit call
Was changed in b1761e04 (iTop 2.7.0) by mistake

Added noinspection as the IDE warning (https://github.com/kalessil/phpinspectionsea/blob/master/docs/control-flow.md#statement-could-be-decoupled-from-foreach) seems to be a false positive ?
2021-11-08 16:14:19 +01:00
Pierre Goiffon
8c7f7abaab Merge remote-tracking branch 'origin/support/2.6' into support/2.7
# Conflicts:
#	test/application/privUITransactionFileTest.php
2021-11-03 11:10:43 +01:00
Pierre Goiffon
908a48e0a1 Merge remote-tracking branch 'origin/support/2.6' into support/2.7
# Conflicts:
#	application/transaction.class.inc.php
#	test/application/privUITransactionFileTest.php
2021-10-21 15:09:50 +02:00
Pierre Goiffon
8ea5be4ead Merge remote-tracking branch 'origin/support/2.6' into support/2.7
# Conflicts:
#	application/transaction.class.inc.php
2021-10-18 14:32:27 +02:00
Pierre Goiffon
8154e718a1 N°4356 modifications after code review
Thanks @Molkobain !
2021-10-13 17:23:29 +02:00
Pierre Goiffon
b5369a0c03 N°4356 Fix portal attachment download
Was opening the attachment directly in the browser (HTTP header Content-Disposition set to 'inline' instead of 'download')
2021-10-13 12:10:22 +02:00
Eric
2bc61caab1 N°4207 N°4298 Fix data/.maintenance flag not removed by setup anymore
Was already fixed in the develop branch
(cherry picked from commit d0986c048a)
(cherry picked from commit 9126635cf2)
2021-10-12 12:23:49 +02:00
Pierre Goiffon
8f0a5fcaf9 N°4231 Security hardening 2021-10-12 11:11:11 +02:00
Pierre Goiffon
fe3512cb5f N°4335 Fix export with PHP < 7.0+ 2021-10-11 17:05:30 +02:00
Pierre Goiffon
fdc987f367 Merge remote-tracking branch 'origin/support/2.7.5' into support/2.7 2021-09-29 17:51:17 +02:00
Pierre Goiffon
ec1dcc8df6 💡 N°3513 PHPDoc 2021-09-23 14:42:16 +02:00
Pierre Goiffon
47ed863da9 N°4215 N°3513 Fix DB errors fetch from the wrong object n°2 2021-09-23 14:32:43 +02:00
Pierre Goiffon
88290f9e91 N°4215 N°3513 Fix DB errors fetch from the wrong object 2021-09-23 13:55:23 +02:00
Pierre Goiffon
cfdbc8ae62 N°4215 When checking for TLS cnx, don't set anymore CMDBSource mysql attributes ! 2021-09-23 11:59:44 +02:00
Pierre Goiffon
aaa8f6d311 N°4215 Fix call to a function on null error when setting TLS connection in the setup
Regression introduced by b1ca1f2630 / N°3513
2021-09-22 15:59:39 +02:00
Molkobain
1c983e8093 Merge remote-tracking branch 'origin/support/2.6' into support/2.7
# Conflicts:
#	core/config.class.inc.php
#	datamodels/2.x/itop-portal-base/portal/src/controllers/objectcontroller.class.inc.php
#	pages/ajax.render.php
2021-08-18 16:12:22 +02:00
Molkobain
27217815d1 N°2510 - Fix expand/collapse buttons of log entries in a list 2021-08-16 09:37:36 +02:00
odain
2fe4265223 N°4125 - Make translations loading more robust toward APCu cache corruption or invalid dictionnary - adaptations to get current correction accepted 2021-07-28 11:14:49 +02:00
Pierre Goiffon
2b71ea108a Setup memory_limit check : clearer message
Now the current value is displayed as entered in the PHP conf
And the recommended value is displayed in a friendly format (32M instead of raw bytes value)
2021-07-27 11:37:05 +02:00
Pierre Goiffon
1aa5185c93 Merge remote-tracking branch 'origin/support/2.6' into support/2.7
# Conflicts:
#	README.md
2021-07-21 12:19:52 +02:00
Molkobain
8e6379a112 Merge branch 'support/2.7.5' into support/2.7 2021-07-13 11:42:30 +02:00
Molkobain
da217a1cb3 N°4161 - Fix ManageBrick crash when no item listed 2021-07-12 18:10:22 +02:00
Pierre Goiffon
a683634a05 N°4126 Fix HTML escaped in \SetupUtils::CheckDbServer messages
As content is sent to JS returned to the AJAX request, we need to escape JS string delimiter (single quote)
We had previously a \utils::HtmlEntities call, but this isn't necessary as all content is generated internally, without calling any dict or extensibility interface.
2021-07-12 14:41:26 +02:00
Pierre Goiffon
69ad10785b 🔧 .editorConfig : disable PHP variables alignement
Still enabled for key/value pairs though ! Example in \UtilsTest::ConvertToBytesProvider
2021-07-05 12:34:20 +02:00
Pierre Goiffon
9aead898e2 Fix Wiki URL to use iTop Hub instead of wiki.openitop
Thanks @Molkobain and @Hipska !
2021-07-05 12:29:07 +02:00
Pierre Goiffon
a48ebfefba N°4126 Change max_allowed_packet error message
Thanks @Molkobain !
2021-07-05 09:54:47 +02:00
Pierre Goiffon
4748717e50 N°4126 Improve max_allowed_packet checks messages 2021-07-02 10:10:35 +02:00
Pierre Goiffon
d90b1a3d82 🐛 N°4020 Fix syntax error for PHP < 7.1
`syntax error, unexpected 'const' (T_CONST), expecting variable (T_VARIABLE) in /var/www/itop274/setup/compiler.class.inc.php on line 61`
Was added in 1059befa
2021-07-02 09:26:03 +02:00
odain
ed719e13c7 N°4125 - Add a warning log when corrupted data returned by APCu 2021-07-02 08:53:58 +02:00
odain
2d705c6697 add autoload 2021-07-01 17:38:59 +02:00
odain
c98ad106c4 N°4125 - Make translations loading more robust toward APCu cache corruption or invalid dictionnary 2021-07-01 17:34:23 +02:00
Pierre Goiffon
3694108f42 N°3870 updateLicenses : fix generating wrong product names on Windows
Was including paths fragments.

Example :
<product scope="datamodels">C:\Dev\wamp64\www\itop-dev\.make\license/../..//datamodels/2.x/authent-cas/vendor/apereo/phpcas</product>

Instead of :
<product scope="datamodels">apereo/phpcas</product>
2021-07-01 17:20:55 +02:00
Pierre Goiffon
8cf75f826f 🔨 updateLicenses : add logs and replace rm -f by unlink() 2021-07-01 15:30:33 +02:00
Pierre Goiffon
ad9726b64c 🔧 .editorConfig : restore old ij_visual_guides value
Was overwritten by mistake in 19505649
2021-06-30 10:24:19 +02:00
Pierre Goiffon
e32e275f40 🎨 Align dataprovider elements 2021-06-29 16:45:34 +02:00
Pierre Goiffon
195056492e 🔧 .editorConfig : enable var alignement 2021-06-29 16:45:18 +02:00
Pierre Goiffon
af338de17f 🔨 Changelog generation script 2021-06-29 11:05:59 +02:00
Pierre Goiffon
a6aa183e26 🔖 Prepare 2.7.5 2021-06-28 15:03:17 +02:00
Pierre Goiffon
b5074c4cee N°3806 Fix saying memory_limit isn't enough in CLI scripts and setup
This was caused by the strict comparison in \utils::IsMemoryLimitOk for the special "-1" value of memory_limit, which was added in c2f5cafa.
Fix was to change \utils::ConvertToBytes : it was returning original value when input was numeric (so if input is '-1' output was '-1')  now it always returns an int (input '-1' output -1)
2021-06-28 14:53:39 +02:00
acognet
8b9589744b N°4020 - timeout on updating the hierarchical key during setup - php 5.6 compatibility 2021-06-28 13:56:49 +02:00
Pierre Goiffon
8259a79cd2 🎨 Factorize LogAPI channels value in LogChannels class 2021-06-25 17:13:35 +02:00
acognet
a23ea9a01f N°3678 - Portal : a modification of field cannot hide another one 2021-06-24 14:11:41 +02:00
Eric
949b213f9d N°3513 - revert crud sequence 2021-06-24 13:32:43 +02:00
acognet
a940adc4ba N°3678 - Portal : a modification of field cannot hide another one 2021-06-24 10:35:01 +02:00
Pierre Goiffon
5d994edd62 N°4012 Fix debug trace syntax
Thanks @Molkobain !
2021-06-23 17:26:34 +02:00
Eric
b1ca1f2630 N°3513 - ObjectFormManager : remove transaction
* Add automatic tests
* Fix object consistency
2021-06-22 16:09:41 +02:00
acognet
58e315d7f6 N°4020 - timeout on updating the hierarchical key during setup - fix git ignore 2021-06-21 17:16:08 +02:00
acognet
1059befa39 N°4020 - timeout on updating the hierarchical key during setup 2021-06-21 16:39:58 +02:00
Eric
0f5130611d Fix log API tests 2021-06-21 16:07:36 +02:00
Eric
a1271da74a N°3513 - ObjectFormManager : remove transaction 2021-06-21 15:03:17 +02:00
Denis
0d40235791 🗃️ N°3968 Fix mutex being silently released after connection timeout (#209)
Mutex are using their own DB connection
Because the `wait_timeout` isn't specified when opening the connection, it could be closed before we released the lock : if so the lock is silently released !
We are now setting this variable directly when opening the connection to avoid such case (setting 86400s, so 1 day : this should be enough !)
2021-06-21 12:33:15 +02:00
Pierre Goiffon
dd63f2b817 N°4012 Debug trace for objects lists in portal : ManageBrick and BrowseBrick
'portal' channel, debug level
2021-06-18 10:58:04 +02:00
Pierre Goiffon
8f84c3b84b 🎨 LogAPI code formatting 2021-06-18 10:58:04 +02:00
Pierre Goiffon
00c58bb245 💡 updateLicenses.php : copy phpdoc from develop branch 2021-06-17 17:11:30 +02:00
Eric
3a876d5c75 Log complete error on Memory Limit or max execution time 2021-06-11 09:36:01 +02:00
Pierre Goiffon
147916062b 🎨 Fix local variable names
Was copy/paste and wasn't consistent with the functionnality :/
2021-06-10 16:28:17 +02:00
Pierre Goiffon
0de6f98add 🔊 When ordering objects search list, log problems due to low max_input_vars php.ini option (#211)
iTop is sending large volume of data to the server, and those data can be truncated due to this php.ini option.
Now we are checking for common issues : if the data is truncated a log is done (IssueLog, warning level, no channel) and the corresponding column is set as not selected.
User will still see an inconsistent result, but we won't have PHP notices generated anymore, and a log can tell what caused the issue.
2021-06-08 18:43:43 +02:00
Pierre Goiffon
a076792e77 ⬆️ N°3973 Update update pear/archive_tar 2021-06-08 18:16:12 +02:00
acognet
2d2a6857de N°3797 - [MariaDB] crash while converting utf8mb4 + add index 2021-06-04 09:10:28 +02:00
Pierre Goiffon
373641e01d 🎨 Code formatting 2021-06-03 17:31:34 +02:00
Eric
d11eceac62 N°4052 - OQL parser limit for huge request - fix CI 2021-06-03 17:07:17 +02:00
Eric
3965806fa0 N°4052 - OQL parser limit for huge request - add better feedback 2021-06-03 16:49:21 +02:00
Pierre Goiffon
2625d2da80 💡 PHPDoc 2021-06-03 15:29:13 +02:00
Eric
02d32a556d N°4052 - OQL parser limit for huge request 2021-06-02 15:15:00 +02:00
Eric
71fcc6f026 N°4031 - OQL Error when AttributeObjectKey is used in JOIN condition 2021-06-02 14:45:03 +02:00
Purple Grape
7168860a0b 🌐 Improved chinese for 2.7 (#218) 2021-06-02 08:06:16 +02:00
acognet
684c88e0b8 N°4038 - Pop up erreur portail utilisateur 2021-05-31 23:43:58 +02:00
Eric
84741c19f0 N°4002 - code hardening (merge from support/2.6) 2021-05-27 16:36:00 +02:00
Eric
e7b5953feb documentation 2021-05-27 11:52:38 +02:00
Eric
6be9a87c15 N°3952 - code hardening (merged from support/2.6) 2021-05-27 09:55:16 +02:00
Pierre Goiffon
caa2a05bf4 🔧 restore .editorconfig
Was moved to /test by mistake
And also editorconfig syntax was removed :(
Those mistakes were done in 7f15eed9
Thanks Molkobain, good catch !
2021-05-26 15:19:40 +02:00
Pierre Goiffon
fc39d8aca9 💡 PHPDoc type hinting 2021-05-26 14:24:29 +02:00
Eric
cf12578289 N°3452 - DB tools : better formatting 2021-05-26 12:14:14 +02:00
Pierre Goiffon
44952d1ea0 Fix \UtilsTest::testIsMemoryLimit 2021-05-25 17:04:32 +02:00
Pierre Goiffon
7f15eed9a8 🔧 Update .editorconfig
* Preserve XML line breaks
* Add markdown
* Add editorconfig
2021-05-25 15:50:23 +02:00
BGdu38
c2f5cafaf3 Avoid setting memory_limit to lower value than the one already configured (#215)
Some scripts are setting the memory_limit PHP option : setup, csvimport and XLSX export. This was done to avoid crashing when dealing with such large amount of data.
But sometimes we were setting the value without any prior check, so we could actually lower the memory_limit value :/

Now this memory_limit change is done using \utils::SetMinMemoryLimit, which will call ini_set if and only if the current value is lower than the one to be set.

Setup calls (setup/ajax.dataloader.php and webservices/backoffice.dataloader.php) were left as is as they weren't subject to this bug, and also they are more complex (logging done on each case).
2021-05-25 12:03:19 +02:00
Pierre Goiffon
81822efa0f 💡 PHPDoc for \DBObject::ApplyStimulus 2021-05-25 10:52:12 +02:00
Pierre Goiffon
923a025f1c 🌐 N°4017 Report pt_br translations for TTO/TTR made in combodo-dispatch-incident
Those dict keys were wrongly duplicated in this module, but they are core iTop !
Original commit 75f00d993c
Thanks to @rokam !
2021-05-20 15:51:21 +02:00
Pierre Goiffon
a4b6f4e37c 👥 Add @rokam to contributors list
Thanks to him for his PT-BR translations !
2021-05-20 15:44:24 +02:00
Pierre Goiffon
f0c73451a2 🌐 N°4017 Report pt_br translations for TTO/TTR made in combodo-dispatch-userrequest
Those dict keys were wrongly duplicated in this module, but they are core iTop !
Original commit 9725897623
Thanks to @rokam !
2021-05-20 15:30:00 +02:00
Pierre Goiffon
d74e3e6b42 💡 ItopTestCase : some PHPDoc 2021-05-18 17:16:04 +02:00
acognet
b740cb2afd N°2540 - prevent the mysql password to appear on misconfigured servers 2021-05-12 08:17:35 +02:00
Molkobain
6ad3c40c42 Merge branch 'support/2.7.4' into support/2.7 2021-05-11 12:14:36 +02:00
Molkobain
f49c8ce188 Merge branch 'support/2.7.3' into support/2.7.4 2021-05-11 12:13:29 +02:00
Molkobain
acf828b72e N°3995 - Portal: Fix loader not displaying in BrowseBrick for tree/mosaic modes with huge amount of data 2021-05-11 12:10:31 +02:00
Pierre Goiffon
bac92716f3 📄 Update Font Awesome license
Was duplicated...
And also not the correct license !
Source for new license text : https://github.com/FortAwesome/Font-Awesome/blob/master/LICENSE.txt

(modification already committed to develop : f8f9c2d7)
2021-05-04 08:58:34 +02:00
bruno-ds
07257cc2d2 N°3671 - fix a code comment too evasive
thanks @Hipska
2021-04-21 09:25:10 +02:00
Pierre Goiffon
87ba67225a 💡 Add since phpdoc tags for \DeadLockLog::Log 2021-04-16 08:36:21 +02:00
Pierre Goiffon
2ad3b3c27e 🎨 Fix \DeadLockLog::Log parameter name + PHPDoc
Thanks @Hipska !
2021-04-15 15:03:13 +02:00
Molkobain
92a640e41a Merge branch 'support/2.7.4' into support/2.7 2021-04-15 10:37:17 +02:00
Molkobain
842df7646b Merge branch 'support/2.7.3' into support/2.7.4 2021-04-15 10:35:56 +02:00
Molkobain
01b38d2ed6 N°3869 - Portal: Fix the Notice "Undefined index: max_display_limit" 2021-04-15 10:34:46 +02:00
Molkobain
9af4846372 N°3810 - Avoid syntax highlighting that shouldn't take place 2021-03-23 16:39:22 +01:00
bruno-ds
91fc2d2e2b N°3671 - reformat tests 2021-03-17 08:46:41 +01:00
Pierre Goiffon
2432ff77a3 💡 More details in PHPDoc for \utils::RealPath 2021-03-17 08:34:25 +01:00
odain
d229e08f02 prepare iTop release 2.7.4 2021-03-16 09:00:06 +01:00
odain
b5adb2e82b N°3671: fix and make test more lisible 2021-03-15 19:01:09 +01:00
odain
386c90c601 N°3668 - URL direct error: renamed trust_proxies<-behind_reverse_proxy 2021-03-15 14:56:16 +01:00
odain
5d0c61178b N°3671 : persist absolute URL when setup context (force trustproxy enabled) 2021-03-15 14:34:56 +01:00
odain
3bcae734e5 N°3671 : persist absolute URL when setup context (force trustproxy enabled) 2021-03-15 12:27:05 +01:00
odain
842e8f9e01 php doc 2021-03-10 15:32:44 +01:00
odain
52cd4f7c5e N°3788 - timeout/excessive duration during MTP - fix PostDbCreation 2021-03-09 11:44:25 +01:00
odain
995619af9b N°3788 - timeout/excessive duration during MTP - increase timeout from 5 to 30s 2021-03-09 08:27:33 +01:00
odain
c842162fe2 N°3788 - timeout/excessive duration during MTP 2021-03-09 08:13:57 +01:00
odain
83f99642e0 N°3793 - Cleanup of orphan CMDBChange can hang the setup 2021-03-08 11:38:20 +01:00
bruno-ds
ae6a264d6d N°3671 - fix typo in HTTP header name 2021-03-05 16:57:03 +01:00
bruno-ds
a06bf6ea7c coding convention (thanks @molkobain) 2021-03-05 09:20:04 +01:00
bruno-ds
bb8d4a92cb fix an indentation problem (thanks @Hipska) 2021-03-04 09:56:05 +01:00
bruno-ds
1429792690 N°3668 - fix an improper redirection to the homepage when iTop is behind a reverse proxy 2021-03-04 09:39:48 +01:00
bruno-ds
1f26b59d90 N°3671 - add an API endpoint (it will be used by N°3668 and N°3760) + some code cleanup asked by @molkobain 2021-03-04 09:32:13 +01:00
bruno-ds
7b093a6bba N°3671 - app_root_url: handle reverse proxies during the setup and preserve existing configuration during an upgrade. 2021-03-03 11:55:18 +01:00
odain
d4607ee815 N°3065 - Failed enum comparison when values contains parenthesis : add a warning 2021-03-02 07:33:36 +01:00
odain
5c0e92d51a N°3065 - Failed enum comparison when values contains parenthesis 2021-03-01 17:06:49 +01:00
bruno-ds
cd4b3fdaab N°3764 - fix CI 2021-03-01 16:27:40 +01:00
bruno-ds
0030d5c2b8 N°3764 - add transactions_gc_threshold in order to tune CSRF token GC load 2021-03-01 15:30:40 +01:00
bruno-ds
95a0efedcf N°3728 - security hardening 2021-03-01 15:28:34 +01:00
bruno-ds
13a1d32f56 N°3453 - portal export header fields are now localized 2021-02-26 11:47:34 +01:00
Pierre Goiffon
35155e4b7a 💡 N°3065 comments modifications 2021-02-26 10:06:29 +01:00
Eric
77710f1613 Revert "#1946 Fix Twig templates logging too much"
This reverts commit 2763b991
2021-02-25 17:57:39 +01:00
Eric
2763b99142 #1946 Fix Twig templates logging too much 2021-02-25 14:44:16 +01:00
bruno-ds
db13c105ad N°3473 - PHPdoc
as requested by @piRGoif
2021-02-24 17:38:54 +01:00
bruno-ds
2276539f24 N°3430 - code cleanup 2021-02-24 16:50:14 +01:00
bruno-ds
9b7cd20d47 N°3473 - security hardening 2021-02-24 16:50:13 +01:00
bruno-ds
e1d644c33b Merge remote-tracking branch 'origin/support/2.7' into support/2.7 2021-02-24 12:06:40 +01:00
bruno-ds
c601082a5e 3548 - disable core update if a file integrity problem is detected 2021-02-24 12:05:11 +01:00
Molkobain
5836be7131 Fix unit test 2021-02-24 09:49:16 +01:00
Molkobain
6f40bb4c35 Change check level to "warning" in order to keep consistency with the others 2021-02-24 09:29:42 +01:00
bruno-ds
241bd1cdeb N°3430 - code cleanup
- during the code review @dflaven preferred the reference rather than the return alternative
 - typo
2021-02-22 09:43:42 +01:00
Molkobain
71c5f47cd8 PHPDoc 2021-02-19 09:37:53 +01:00
odain
74246a8278 N°3065 - Failed enum comparison when values contains parenthesis - enhance db model parsing used during setup comparison with expected one to generate SQL migration queries 2021-02-18 18:24:09 +01:00
bruno-ds
c450c9426c Merge remote-tracking branch 'origin/support/2.7' into support/2.7 2021-02-18 16:29:44 +01:00
odain
46f9fe743c fix ci: adapt test to make sure config date_and_time is set properly before 2021-02-18 16:27:38 +01:00
odain
c31df5fff3 fix ci: adapt test to make sure config date_and_time is set properly before 2021-02-18 16:07:37 +01:00
Pierre Goiffon
6e0af1a3b7 💡 Add variable typing 2021-02-18 13:21:06 +01:00
bruno-ds
e9e18513be N°3430 - fix preference page's warning and add missing token generation
- fix the warning (ajax call interrupted) if preference form ajax call is way faster than the one of the 2 other by adding a new timeout_duration option before the redirect.
2021-02-18 12:18:38 +01:00
Molkobain
9d2fc883b8 Fix test name 2021-02-17 10:31:59 +01:00
odain
913ea0cef2 N°3412 - Command Injection vulnerability in the Setup Wizard - renaming 2021-02-17 10:22:21 +01:00
odain
82ba7f25b0 N°3412 - Command Injection vulnerability in the Setup Wizard - do not use escapeshellcmd before execution in Windows envt 2021-02-17 10:18:28 +01:00
odain
bb877a244b N°3412 - Command Injection vulnerability in the Setup Wizard - do not use escapeshellcmd before execution in Windows envt 2021-02-17 10:09:39 +01:00
odain
a12959d60e N°3412 - Command Injection vulnerability in the Setup Wizard - handle empty path 2021-02-17 07:50:18 +01:00
bruno-ds
83434b5506 N°3430 - add translations 2021-02-16 17:42:11 +01:00
bruno-ds
dcd4abe72b N°3430 - security hardening 2021-02-16 17:33:49 +01:00
odain
571520815a N°3412 - Command Injection vulnerability in the Setup Wizard - include test to CI 2021-02-16 17:25:45 +01:00
odain
e9cff0920b N°3412 - Command Injection vulnerability in the Setup Wizard - fix test and code 2021-02-16 17:12:41 +01:00
odain
905ee19519 N°3412 - Command Injection vulnerability in the Setup Wizard 2021-02-16 15:57:12 +01:00
bruno-ds
0b95220d1b N°3466 - Add (missing) translations 2021-02-16 09:46:04 +01:00
bruno-ds
e1b2a767f5 N°3142 - fix typos 2021-02-15 17:49:25 +01:00
bruno-ds
3058b2eb00 N°3142 - Add (missing) translations 2021-02-15 17:08:47 +01:00
Molkobain
38bc2d9d58 🔧 Change max line length in .editorConfig 2021-02-15 13:49:39 +01:00
Eric
c8e8778d7b N°3468 - Fix extension.xml preventing extensions installation
(cherry picked from commit 92c8af1b19)
2021-02-11 17:48:29 +01:00
bruno-ds
656fa3208a N°3721 - revert the feature (will only be available on the 3.0) 2021-02-10 15:33:01 +01:00
bruno-ds
f647ce61c2 N°3721 - toolkit's "update iTop" with the "Create symbolic links" option checked now empty the compiled directory as expected 2021-02-10 14:34:21 +01:00
Eric
6b76e5a853 N°3618 - Count on union with different conditions fails (php doc) 2021-02-08 09:39:24 +01:00
Eric
dbb6e43751 N°3618 - Count on union with different conditions fails (Fix unit tests) 2021-02-05 11:28:40 +01:00
Eric
f07f0ba1c7 N°3618 - Count on union with different conditions fails (Fix multi-column attributes sql generation) 2021-02-05 10:15:14 +01:00
Pierre Goiffon
a5894c1a4c Rename \Combodo\iTop\Test\UnitTest\ItopTestCase::InvokeInvisible* to InvokeNonPublic* 2021-02-04 09:41:56 +01:00
Eric
e06996a2e4 N°3660 - Fix JOIN without condition on child joined table is ignored (check done in optimizer) 2021-02-03 15:58:54 +01:00
Eric
2f0e7c6d29 N°3586 - Fix login window not correctly displayed 2021-02-03 09:15:56 +01:00
Eric
7115a6ae7d N°3660 - Fix JOIN without condition on child joined table is ignored (remove unnecessary check) 2021-02-03 09:07:59 +01:00
Pierre Goiffon
765560d1f5 ItopTestCase : helpers to call invisble methods 2021-02-02 17:57:40 +01:00
Eric
bc024d9ed0 N°3660 - Fix JOIN without condition on child joined table is ignored 2021-02-02 17:30:03 +01:00
jbostoen
37a4a3eb47 🌐 Fix typo in Dutch translations (#189)
Co-authored-by: jbostoen <->
2021-02-01 16:21:10 +01:00
Pierre Goiffon
54e9bd5c8e Merge branch 'support/2.6' into support/2.7
# Conflicts:
#	.editorconfig
2021-01-25 09:13:43 +01:00
jbostoen
4123c6213d 🌐 NL : distinguish between approval (goedkeuring) <=> acceptance (acceptatie) (#182)
Co-authored-by: jbostoen <->
2020-12-21 14:08:29 +01:00
Pierre Goiffon
8265b9b034 N°3416 fix PHPDoc 2020-12-10 18:10:45 +01:00
Pierre Goiffon
c4756e8cec Upgrade version n° 2020-12-08 18:47:24 +01:00
odain
37351d6b3e N°3464: fix ci 2020-12-07 16:23:17 +01:00
odain
57a085eec1 N°3464: move fix in itop-fence + fix/enhance rest api test 2020-12-07 15:56:35 +01:00
odain
0019595923 N°3464: fix ci 2020-12-07 00:44:39 +01:00
odain
4d61c14f80 N°3464 add test in phpunit.xml.dit to validate the fix 2020-12-07 00:12:31 +01:00
odain
cf1b613923 N°3464 REST comment field not working anymore 2020-12-06 23:54:27 +01:00
Pierre Goiffon
1304e2eb2d N°3416 Updates after code review v2 :) 2020-12-04 08:51:07 +01:00
Pierre Goiffon
3cf16627c1 Merge remote-tracking branch 'origin/support/2.6' into support/2.7
# Conflicts:
#	pages/ajax.render.php
2020-12-03 18:18:36 +01:00
Pierre Goiffon
4aaa237bf9 🔖 Prepare 2.7.3 version 2020-12-03 18:15:58 +01:00
Pierre Goiffon
cece15d10c N°3416 Updates after code review
Many thanks @bruno-ds !
* add comments to explain intentions
* fix indentations
2020-12-03 17:45:44 +01:00
Pierre Goiffon
aa15e009cb 🔖 Prepare 2.7.2-2 version 2020-12-03 10:05:37 +01:00
Pierre Goiffon
80e1e0e61a N°3426 Fix no navigation menu on User object creation
Caused by a typo in js/forms-json-utils.js
Thanks @Molkobain !
2020-12-02 18:02:00 +01:00
Pierre Goiffon
ecebe4ecd5 N°3416 XFrame and cache headers optimizations
* Remove XFrame header set in \WebPage::no_cache : not this method responsability, was confusing :/
* Remove no_cache() calls when already set in page constructor (ajax_page mainly)
* Also calls everywhere the \WebPage::no_cache method instead of setting headers manually
2020-12-02 17:19:05 +01:00
Pierre Goiffon
8bfcb14d0c N°3416 XFrame-Options header is now set using a config parameter, defaults to SAMEORIGIN
Also adds an indirection (\WebPage::add_xframe_options) to set header
2020-12-02 17:17:11 +01:00
Molkobain
1cf1473d6b N°3469 - Fix variable declaration (let => var) 🤭 2020-12-02 17:01:00 +01:00
Molkobain
aa43425df3 N°3469 - Portal: Fix modal created without an ID 2020-12-02 16:59:39 +01:00
Pierre Goiffon
35d77ff642 N°3416 Fix DocumentFile preview not working anymore
Was caused by X-Frame-Options http header added with N°3317
2020-12-02 15:44:58 +01:00
acognet
539fa43503 N°3461 - Setup Broken with Chrome v87 2020-11-30 18:27:25 +01:00
acognet
eb537f45f4 N°3421 - Attributes of class Person are not accessible from :current_contact in portal anymore. Only attributes of class Contact are. 2020-11-30 09:24:35 +01:00
acognet
a2a4cd4e7a N°3426 - Wrong tab is displayed when a creation or modification form is invalidated 2020-11-27 15:20:20 +01:00
Pierre Goiffon
35215cf62f 🌐 Fix typo in comma (2 "m" !!) 2020-11-26 18:34:07 +01:00
Pierre Goiffon
66273ebd39 Merge remote-tracking branch 'origin/support/2.7.2' into support/2.7 2020-10-30 18:08:01 +01:00
Eric
eebc29d2bb N°3111 - Fix Portal export
(cherry picked from commit d3b57c3bda)
2020-10-30 14:16:57 +01:00
Pierre Goiffon
512b415bd6 N°3065 add test case in comment 2020-10-30 11:30:22 +01:00
Pierre Goiffon
906c8855b0 🔊 When error during CoreUpdate, show full file path instead of only basename 2020-10-28 18:32:49 +01:00
Pierre Goiffon
97d322a059 📝 N°3218 Add some PHPDoc on current change set/get 2020-10-27 15:17:17 +01:00
acognet
ada7f30793 N°3139 - import csv : hyperlink not clickable - replace htmlentities with utils::HtmlEntities() to ensure that the same options are used application wide. 2020-10-27 09:59:05 +01:00
Pierre Goiffon
b065d13374 Integration tests : add itop-community group 2020-10-27 09:46:03 +01:00
Pierre Goiffon
1f092f8418 🎨 Integration test code formatting 2020-10-27 09:45:26 +01:00
Pierre Goiffon
65d6947e52 🔖 Prepare 2.7.2 version 2020-10-22 15:06:48 +02:00
Pierre Goiffon
ba54b47f7d Merge remote-tracking branch 'origin/support/2.6' into support/2.7 2020-10-22 10:27:36 +02:00
Pierre Goiffon
adb4e77c8d 🎨 MetaModel : function modifiers order + little formatting 2020-10-19 15:36:56 +02:00
Pierre Goiffon
d3cf7176da 📝 MetaModel : add comment on @deprecated added in 9c75cb4537 2020-10-19 15:34:15 +02:00
Pierre Goiffon
1cfb52d220 🐛 Fix CoreException constructor generating a warning on PHP >= 7.2
In the CoreException constructor, we're using the $aContextData parameter to do a count(), a foreach(), and uses values as string.
Only a null check was done.
Now we are also checking that the value is_array().
As others checks (Countable, Iterable, __toString() impl) are quite difficult depending on the PHP version we're running, we didn't add any other checks.

The call in \MatchExpression::__construct (added in 05a0d612) was passing directly an Expression object. We could embed it in an array, but the object hierarchy isn't implementing __toString so we would have another bug.
In consequence we removed this parameter.
2020-10-19 11:57:53 +02:00
Pierre Goiffon
18d5231900 N°3332 Security hardening 2020-10-19 09:25:30 +02:00
Pierre Goiffon
e6539ccb6e 🔧 Update .editorconfig : braces on next line for classes and functions 2020-10-19 09:09:31 +02:00
acognet
96332b7885 N°3139 - import csv : hyperlink not clickable 2020-10-16 14:15:51 +02:00
acognet
557b9be795 N°3377 - Allow to get data of current user - Fix Exception when using :current_user->... for non admin users 2020-10-15 17:31:25 +02:00
Pierre Goiffon
75ebecddd5 Merge remote-tracking branch 'origin/support/2.6' into support/2.7
# Conflicts:
#	datamodels/2.x/itop-portal-base/portal/src/controllers/userprofilebrickcontroller.class.inc.php
#	datamodels/2.x/itop-portal-base/portal/src/helpers/applicationhelper.class.inc.php
2020-10-14 09:19:07 +02:00
Pierre Goiffon
2d130cbba8 Merge remote-tracking branch 'origin/support/2.6' into support/2.7
# Conflicts:
#	test/core/UserRightsTest.php
#	test/setup_params/default-params.xml
2020-10-12 12:47:58 +02:00
Pierre Goiffon
06acac97ba Fix tests
* update datamodel XML version
* Remove \Combodo\iTop\Test\UnitTest\Core\OQLTest::testTypeErrorQueryParser
2020-10-07 16:21:36 +02:00
acognet
2d6d1132c7 N°3262 - Avoid PHP notices on DBObject core code 2020-10-07 13:26:38 +02:00
acognet
ed0e16494d N°3335 - Fix test 2020-10-05 16:23:56 +02:00
Pierre Goiffon
a765eb8725 Merge remote-tracking branch 'origin/support/2.6' into support/2.7
# Conflicts:
#	application/ajaxwebpage.class.inc.php
#	application/csvpage.class.inc.php
2020-10-05 16:12:49 +02:00
BenGrenoble
5d7ae38adf Merge remote-tracking branch 'origin/support/2.7' into support/2.7 2020-10-02 10:51:59 +02:00
BenGrenoble
2e08ae571a 3354 change sie by Sie 2020-10-02 10:51:25 +02:00
Pierre Goiffon
37522459a8 N°3351 restore LogKPI calls in portal index 2020-10-01 18:02:31 +02:00
Pierre Goiffon
db8c26da17 📝 update PHPDoc for \Expression::IsTrue 2020-10-01 17:02:22 +02:00
BenGrenoble
93c91c4077 3354 remove now from "Bitte bestätigen sie, dass jetzt ein Backup erstellen wollen now." 2020-10-01 15:11:07 +02:00
Pierre Goiffon
e4b3871947 📝 PHPDoc for \Expression::IsTrue 2020-10-01 14:51:28 +02:00
Pierre Goiffon
b2474d3368 N°3324 Portal fix ignore_silo when using nested query in scopes
The AllowAllData attribute wasn't updated in the nested queries.
It is now set both when calling DBObjectSearch::AllowAllData and when creating a new nested query (\DBObjectSearch::AddConditionExpression)
2020-10-01 12:15:34 +02:00
Pierre Goiffon
6cd0670d6b 🎨 Fix parameter for all DBSearch::AllowAllData impl 2020-10-01 10:09:34 +02:00
Pierre Goiffon
e9f81bd978 🔧 Update .Editorconfig for braces always at eol 2020-10-01 10:09:34 +02:00
Eric
0cc5dc0471 N°3317 - Add http headers 2020-09-30 10:18:44 +02:00
odain
20ce42b24b Reintegrate validation tests to ease iTop release management from develop
- N°3053 - Check XML conversion methods
     - N°3059 - Automatically set the documentation URLs
     - N°3052 - Check community modules XML version against latest version
     - N°3054 - Check community modules version against major version
     - N°3062 - setup.css file integrity test
     - N°3060 - Check consistency between the list of modules and installation.xml
     - N°3061 - Automatically check the installation.xml consistency
     - N°3268 Add test to check dictionary files: make sure that the Dict::Add declarations match the file name
2020-09-29 14:43:51 +02:00
Eric
d86e904e18 N°3317 - Add http headers 2020-09-29 14:11:11 +02:00
Eric
5a46bb8461 N°3320: Do not display empty tabs 2020-09-29 11:23:49 +02:00
acognet
05a0d61244 N°3335 - Notifications on threshold don't work when trigger is created on iTop 2.7.1 - nicer fix 2020-09-29 10:27:05 +02:00
acognet
80b3212a19 N°3335 - Notifications on threshold don't work when trigger is created on iTop 2.7.1 2020-09-29 09:12:47 +02:00
Molkobain
794d4f1e0e N°3310 - Fix corrupted backups when a file has a size which is a multiple of 512 bytes 2020-09-28 14:31:36 +02:00
Molkobain
389b61d3a8 Fix missing author information in composer.json for TCPDF lib. 2020-09-28 14:29:51 +02:00
Molkobain
0948e80060 N°3320 - Fix empty tabs being displayed (misuse of the API or user rights) 2020-09-28 14:10:19 +02:00
odain
9520d2794f 💚 fix ci Serialization of 'ReflectionClass' is not allowed 2020-09-25 10:29:48 +02:00
Pierre Goiffon
e2c67dfcc4 Merge remote-tracking branch 'origin/support/2.6' into support/2.7 2020-09-25 08:57:08 +02:00
odain
4e0eed6e13 N°3270 Notify on expiration not sending notification (trigger exception)
add boilerplate function and use it to intercept/enrich trigger exception loops
2020-09-25 07:18:14 +02:00
Eric
94b9a9bb75 N°3309 - Spelling mistake 2020-09-22 12:51:43 +02:00
Eric
0c90b701ea N°3283 - Spelling mistake 2020-09-22 12:45:19 +02:00
Eric
58961cd4ec N°3318 - don't display error details 2020-09-22 11:57:43 +02:00
Eric
1453558f3e N°3317 - Add http headers 2020-09-22 11:39:19 +02:00
Eric
c6df0b6d7d N°3311 - Stop capturing output before sending backup file (avoid memory problem) 2020-09-22 11:03:59 +02:00
Pierre Goiffon
7c3659d5ba 🔧 Remove versionned PHPStorm files
Those files were duplicates of the .editorconfig file

.editorconfig was pushed with ecd8f40c0f for 2.7.0 and should be the only source of the IDE / editor configuration

This generic format is implemented in PHPStorm since v2019.2 (see https://blog.jetbrains.com/idea/2019/06/managing-code-style-on-a-directory-level-with-editorconfig/)
To check if your IDE / editor supports it, check https://editorconfig.org/
2020-09-18 18:26:31 +02:00
Pierre Goiffon
dd942997cb 🎨 Fix invalid formatting introduced in 827b4b5bbe 2020-09-18 14:22:28 +02:00
Pierre Goiffon
57fea03745 🔧 Fix editorconfig for JS files 2020-09-18 14:21:47 +02:00
Pierre Goiffon
827b4b5bbe 🎨 Fix string delimiter
Thanks @jbostoen for pointing this out (see discussion in 0773660ef2)
2020-09-18 14:15:41 +02:00
Pierre Goiffon
7de59c1977 Update .editorconfig 2020-09-18 10:19:38 +02:00
Pierre Goiffon
c34c4bc09d 📝 Fix CRUD wiki page URL
was linking to Combodo private wiki :/, now is the public one \o/
Many thanks @Hipska !
2020-09-14 15:05:44 +02:00
Pierre Goiffon
bced819b3f 📝 N°2293 PHPDoc for DBObject::GetOriginal 2020-09-14 14:26:29 +02:00
acognet
23136bdf00 N°3303 - Bug on Mass update of actions (notification) 2020-09-11 09:53:23 +02:00
odain
98c371c5cf add new code style for brackets 2020-09-07 16:12:12 +02:00
acognet
1e0415e902 3234 - php 5.6 compatibility 2020-09-07 12:14:38 +02:00
Eric
dbada2f72a N°3238 - Fix multi-words search in FilterBrick and ManageBrick 2020-09-04 17:34:59 +02:00
Eric
9694e9848d N°3285 - Fix Standard Global Search: multiple words search 2020-09-04 09:27:39 +02:00
bruno-ds
fe87700135 Un-deprecate ItopExtensionsExtraRoutes::AddRoutes(...)
we had imagined it as a compatibility layer for migrating from Silex to Symfony,
but it must'nt be deprecated until we provide a new API (ideally based on a scan of yaml configuration file?)
2020-09-03 16:43:30 +02:00
Eric
7107c2f616 N°3260 - Fix rendering of an ExternalField on a Text with XML content (format transitivity) 2020-09-02 18:15:31 +02:00
Eric
92e0f101d7 N°3260 - Fix rendering of an ExternalField on a Text with XML content (format transitivity) 2020-09-02 17:58:04 +02:00
acognet
29624bc5c5 N°3163 - Portal Filters doesn't work 2020-09-01 14:16:16 +02:00
acognet
d09f3f4f83 N°3149 - Change Color of Brick Search on Portail with extension Custom 2020-09-01 10:55:48 +02:00
acognet
f774a90b7e N°3146 - Affichage des class user dans l'import CSV 2020-08-31 17:15:59 +02:00
acognet
fef8038f70 N°3261 - Configure this list : sort icon disappears when descending sort is selected 2020-08-31 15:11:47 +02:00
bruno-ds
2806a76c1d :greenheart: test readability 2020-08-31 14:47:55 +02:00
Eric
328ec52c88 N°3162 - Remove default admin phone number (can be incompatible with validation pattern) 2020-08-31 11:38:24 +02:00
Eric
70734e2b71 N°3188 - Fix LIfeCycle visualization details
Fix js broken by the fix of N°309
2020-08-28 17:28:52 +02:00
Eric
bb892cc180 N°3078 - Fix error on login while in maintenance mode 2020-08-27 17:10:37 +02:00
acognet
4618f12d8a N°3234 - Notify on expiration not sending notifications 2020-08-21 18:50:27 +02:00
odain
d12e2e592a N°3265 - Log stacktrace when cron exception raised with debug enabled 2020-08-21 10:25:05 +02:00
Eric
6a25933744 N°3248 - code hardening 2020-08-18 17:21:48 +02:00
Pierre Goiffon
208ccfe3ab N°3257 Fix cannot create objects with AttributeImage from extkey widget on PHP 7.4 2020-08-18 17:13:37 +02:00
Eric
f74c78d61c N°3248 - code hardening 2020-08-18 17:02:46 +02:00
Eric
6176af089c N°3256 - Invalid filter parameter, when using & (ampersand) in filter parameter (OQL Query) 2020-08-18 14:41:18 +02:00
odain
a35b2d83b7 Cancel functionnal changes to make sure they are ok in next release (develop/2.8) first 2020-08-07 15:17:24 +02:00
odain
8902d6e532 CI migration/automation + new test to ease iTop release management
- new Jenkinsfile and .jenkins removal to launch phpunit/behat tests
triggered on both iTop build and push.
 - N°3053 - Check XML conversion methods
 - N°3057 - New build recipe
 - N°3059 - Automatically set the documentation URLs
 - N°3052 - Check community modules XML version against latest version
 - N°3054 - Check community modules version against major version
 - N°3062 - setup.css file integrity test
 - N°3060 - Check consistency between the list of modules and installation.xml
 - Add exclusion group for CI
 - N°3061 - Automatically check the installation.xml consistency
2020-08-07 14:48:51 +02:00
Pierre Goiffon
07bd6b8539 N°3219 cron : reset CMDBChange for each process 2020-08-04 09:44:20 +02:00
Pierre Goiffon
1148449bb7 📝 Add missing @since on \DBSearch::GetFirstResult 2020-07-29 17:21:15 +02:00
jbostoen
11d418fd49 🌐 Dutch translations: fix use of ITOP_APPLICATION, ITOP_APPLICATION_SHORT
* Fix incorrect ITOP_APPLICATION, ITOP_APPLICATION_SHORT
2020-07-28 16:26:16 +02:00
Eric
ace676dc24 N°2585 - Fix alias problem in portal scopes
The re-aliasing map structure now allows multiple mapping for the same alias (used for the translations of UNIONS)
2020-07-23 16:41:57 +02:00
Eric
8122270476 N°3176 - OQL: Fix malformed UNION queries in portal scopes
Fix regression in Unit tests
2020-07-22 17:30:38 +02:00
Eric
1f66d53ab4 N°3176 - OQL: Fix malformed UNION queries in portal scopes
Fixed AddCondition_ReferencedBy() for unions (regression introduced by N°2970)
2020-07-22 16:09:08 +02:00
Eric
dfaeca43e4 N°3148 - OQL request malformed
Fix variables in ListExpression
2020-07-22 10:06:11 +02:00
Eric
5b04143711 N°3111 - Fix Portal export 2020-07-21 16:39:55 +02:00
Eric
bd14096d43 N°3150 - Wrong count for archived objects 2020-07-21 14:21:55 +02:00
Eric
3b20be05cb 3189 - DBTools enhancements
* Add CLI command bin/report.php to generate report offline
* Keep the latest report in log/dbtools-report.log in order to visualize it with "Log management" menu
2020-07-21 14:08:36 +02:00
Eric
fdec608c3e N°3174 - Remove stack trace from MySQLException 2020-07-16 18:09:44 +02:00
Eric
72cb3de50d N°3173 - Installation issue with PHP 7.4 (fix php notice) 2020-07-16 17:23:21 +02:00
Eric
c03d32b423 N°3180 - Allow HTML in dictionary for login screen ('UI:Login:About') 2020-07-16 15:28:49 +02:00
Eric
94f9b16c03 N°2589 - Infinite loops when logging with a Contact having a non empty TagSet field
Add ListParameters to DBSearch for nested queries
2020-06-24 15:18:11 +02:00
acognet
311aeb0b07 N°2589 - Infinite loops when logging with a Contact having a non empty TagSet field 2020-06-24 12:09:55 +02:00
acognet
68fe3f01be Spelling corrections 2020-06-23 17:38:24 +02:00
acognet
7ce94486bd Spelling correction 2020-06-23 13:49:53 +02:00
acognet
6523b34d58 Update version number for 2.7.1 2020-06-23 11:19:44 +02:00
bruno DA SILVA
be20705449 Add unit test.
unit test the behaviour of the removal of the blacklisted html tags

this is in fact an adaptation of the test added for the rolled-back feature of the n°2556.
This feature has been postponed to the 2.8 due to performance scaling issues.
2020-06-22 16:13:31 +02:00
acognet
e7abaa2838 Update dictionnaries 2020-06-22 15:50:18 +02:00
Pierre Goiffon
8d73eb6dff Revert "N°2556 - Html sanitization preserve content of removed tags (except for a forbidden list)"
This reverts commit 746b47bb0e.
Revert "N°2556 - Repair CI"

This reverts commit 79909fadc0.
2020-06-22 11:36:46 +02:00
acognet
f84995a58f N°309 - Afficher les arbres pliés ou dépliés 2020-06-19 18:45:26 +02:00
acognet
7f66e26b5f Merge remote-tracking branch 'origin/support/2.7' into support/2.7 2020-06-19 12:27:35 +02:00
acognet
a6639b067f N°309 - Afficher les arbres pliés ou dépliés 2020-06-19 12:26:08 +02:00
Pierre Goiffon
8a6d66effd 📝 Fix PHPDoc 2020-06-18 11:08:18 +02:00
Pierre Goiffon
6885d64124 📝 N°1418 DBObject PHPDoc 2020-06-17 19:03:29 +02:00
acognet
6fa153ae8b N°3107 - Remove code merged by mistake 2020-06-17 15:20:52 +02:00
acognet
e226222c2a N°3102 - widget regression: OQL syntax error now crash the page instead of displaying an error in place of the widget 2020-06-17 11:11:48 +02:00
Pierre Goiffon
aca0143e89 📝 PHPDoc for BackgroundProcess exceptions 2020-06-17 09:25:38 +02:00
Pierre Goiffon
1968c60770 📝 \DBObjectSet::ToArray PHPDoc 2020-06-16 12:32:57 +02:00
Pierre Goiffon
26014f410a Set back version for 2.7.1
Was set to 2.8 by mistake in 23afee51 (PR #125 that was rebased in GitHub web)
2020-06-15 15:49:01 +02:00
Pierre Goiffon
8912618732 Revert "N°2214 Add PHP check in CLI scripts"
This reverts commit c768e18e2b.
No risk taken for the 2.7.1 : this will be included but for 2.8 !
2020-06-15 15:18:26 +02:00
Eric
7bee718a13 N°3775 - Dashboard Definition with unknown class leads to an error 2020-06-15 14:53:58 +02:00
Pierre Goiffon
2705543efd N°2997 new test for AbstractWeeklyScheduledProcess
Document the way GetNextOccurrence works O:)
2020-06-12 18:20:07 +02:00
Pierre Goiffon
1e6b885301 SetupUtils : add missing public access keyword for methods 2020-06-12 16:50:04 +02:00
Pierre Goiffon
c768e18e2b N°2214 Add PHP check in CLI scripts
It is quite common that the PHP interpreter that is launched in CLI is different that the one used by the webserver. So iTop code launched by CLI could run in a context that doesn't meet iTop requirements !

This adds in the following scripts the same control that is done on the setup wizard first step :
* cron.php
* backup, check-backup
* export, exportv2
* bulk import
* synchro-exec, synchro-import

If the check throws at least one error then the script is stopped with an appropriate message, and a log is made (IssueLog, Error level, CLI channel)
2020-06-12 16:46:37 +02:00
Eric
d4b93f3bf0 N°2641 - Create a dedicated ErrorPage for fatal errors 2020-06-11 17:16:47 +02:00
acognet
6354c62c2b N°3012 - Fix blocking MTT/MTP when /extensions 2020-06-11 14:13:27 +02:00
acognet
cf8a12fe95 PMP light first version - small evolutions 2020-06-10 10:44:18 +02:00
acognet
36804dfcf4 N°3098 - Portal with IE : apply a transition ends with blank page 2020-06-10 10:44:17 +02:00
Eric
6966c0498a N°3071 - fix missing index for AttributeSet (for migration) 2020-06-08 16:50:32 +02:00
Eric
bbffc40ee0 N°3074 - Fix dashlet creation for IE 2020-06-08 16:20:41 +02:00
acognet
1b7473365d N°3075 - Fix syntax error with PHP 5.6 and TCPDF 6.3.4 2020-06-05 17:03:46 +02:00
Eric
0b84e809f6 Add cache to twig templates 2020-06-05 15:52:26 +02:00
acognet
a858362622 N°3080 - Portal cannot display more 10 attachments 2020-06-05 09:42:04 +02:00
Eric
d195c2b4c9 N°3071 - fix missing index for AttributeSet 2020-06-04 17:04:07 +02:00
acognet
28b75f29e5 N°3020 - Recurring PHP Notice with itop-fence "Undefined index: login_temp_auth_user 2020-06-04 16:21:07 +02:00
Eric
9d8a7bf561 N°3007 - Warn the user that installing a patch on a non conform install is not recommended 2020-06-04 10:38:58 +02:00
Eric
8064a20718 N°2970 - Reset conditions of joined filter because they can be used later by the Filter() method 2020-06-03 11:47:12 +02:00
acognet
f301a283e2 N°3015 - Fix "Undefined index: login_mode" Notice 2020-06-02 16:04:50 +02:00
Pierre Goiffon
e6a8f492d5 N°3049 Fix notice when having an ENUM field with values containing parenthesis 2020-05-28 15:38:21 +02:00
Pierre Goiffon
336637a7a4 SetupLog : ease changing manually the default level
In setup no conf file available so the log_level_min config option cannot be read
A solution is to manually change this constant
2020-05-28 11:40:22 +02:00
acognet
0e5a501b2a N°3012 - Fix blocking MTT/MTP when /extensions 2020-05-27 10:13:44 +02:00
acognet
59af58a173 N°3008 - Align transition form markup metadata to regular form in the backoffice 2020-05-27 10:00:20 +02:00
acognet
7f922560ba N°1976 - Duplicate Service on Customer Contract - formating code 2020-05-27 09:35:02 +02:00
acognet
d2e286345e N°1976 - Duplicate Service on Customer Contract 2020-05-27 09:30:52 +02:00
Pierre Goiffon
fb120bdc7c Merge remote-tracking branch 'origin/support/2.7.0' into support/2.7 2020-05-26 08:44:21 +02:00
Pierre Goiffon
5548997f3e 📝 README : fix for 2.7.0-2 2020-05-26 08:43:11 +02:00
bruno DA SILVA
156828c448 Merge branch 'feature/2958_unescape_slack' into support/2.7 2020-05-25 16:07:05 +02:00
bruno DA SILVA
04ef2b0454 2958 - test a restore 2020-05-25 15:52:37 +02:00
bruno DA SILVA
076d2e3d46 2958 - test a failure 2020-05-25 15:51:42 +02:00
bruno DA SILVA
0c6ab86e54 2958 - Slack notification : fix escaped branch name 2020-05-25 15:34:18 +02:00
bruno DA SILVA
876db3e58f 2958 - Slack notification : fix escaped branch name 2020-05-25 15:32:16 +02:00
Molkobain
5f7fe345cc Update README with iTop 2.7.0-2 information 2020-05-20 10:23:18 +02:00
Molkobain
cb6f78c9e3 Update README with iTop 2.7.0-2 information 2020-05-20 10:22:34 +02:00
acognet
8c86908652 N°3023 - Portal: Fix filter brick input not working in IE11 2020-05-19 10:17:27 +02:00
acognet
7e69256cb4 N°2668 - Notifications - Export wrong attribut format in html 2020-05-18 21:52:31 +02:00
acognet
83e3c089a4 N°1976 - Duplicate Service on Customer Contract 2020-05-18 21:51:29 +02:00
Pierre Goiffon
0d1059a8fc Merge remote-tracking branch 'origin/support/2.6' into support/2.7
# Conflicts:
#	application/utils.inc.php
#	conf/web.config
#	datamodels/2.x/itop-backup/ajax.backup.php
#	datamodels/2.x/itop-backup/status.php
2020-05-18 09:24:46 +02:00
Eric
e2f15ca24a 🌐 Add ES_CR translations to Application Upgrade Menu
From PR#128 by Federico Lazcano
2020-05-15 14:39:22 +02:00
Eric
7628b85b70 🌐 Add ES CR translations for DB Tools
From PR#127 by Federico Lazcano
2020-05-15 14:13:24 +02:00
Eric
525f600c18 🌐 Config Menu title should be uppercase
From PR#126 by Federico Lazcano
2020-05-15 14:04:15 +02:00
Pierre Goiffon
0ffa2850ea Deadlock log : log inside a dedicated log file instead of creating an EventIssue object (#139)
First log implementation (75730ee) was creating EventIssue objects, and was rollbacking transaction if it exists

The new one has some benefits :

* always log one line by default in log/error.log, but details must be activated though config (channels `Deadlock-WaitTimeout` and `Deadlock-Found`)
* detailed logs are in a dedicated file (log/deadlock.log) : 
  - easier for our clients to get and share
  - has rotation by default
  - looking at the file size is a direct way to know if error happened
  - more compliant to industry standards !
* the transaction stays untouched, so that the consumer can do whatever it prefers
2020-05-14 17:49:05 +02:00
Eric
fa3610cfee N°2641 - Create a dedicated ErrorPage for fatal errors
Fix fatal errors being logged in setup.log instead of error.log
2020-05-14 14:37:38 +02:00
acognet
898ee95a2c N°1997 - dbClick to exit the "description" field when creating an incident on the portal 2020-05-14 13:03:49 +02:00
Pierre Goiffon
730570f1f8 📝 MFCompiler language injection 2020-05-14 11:43:57 +02:00
Pierre Goiffon
80ce1eb125 N°2984 Security hardening 2020-05-14 11:33:48 +02:00
bruno DA SILVA
79909fadc0 N°2556 - Repair CI 2020-05-14 10:49:31 +02:00
bruno DA SILVA
746b47bb0e N°2556 - Html sanitization preserve content of removed tags (except for a forbidden list)
forbidden list: see $aTagsContentRemovableList
2020-05-14 10:33:30 +02:00
acognet
150d3e096d N°2346 - Function GetTrackOrigin() doesn't return good value during csvimport 2020-05-13 23:55:26 +02:00
Thomas Casteleyn
23afee514d 🌐 Update nl.dictionary.itop.ui.php (#125) 2020-05-13 14:38:32 +02:00
acognet
48c5698f08 N°2934 - Backoffice theme: Add variable for menu group background color 2020-05-13 12:22:35 +02:00
acognet
1a4ee0f977 N°1953 - Dashlet Title alignment not consistent : Left on List, Center on Table/Pie/Chart 2020-05-13 12:22:35 +02:00
Eric
1ca39618e1 N°1610 - Fix [DBObject] ExecAction - apply_stimulus
removed unnecessary test
2020-05-13 11:38:22 +02:00
Eric
7bb1f9f423 N°2937 - fix export error on EventIssue object 2020-05-13 11:24:34 +02:00
bruno DA SILVA
21c2574cd9 N°2358 - Fix deletion of a single replica within a list 2020-05-13 09:37:36 +02:00
Pierre Goiffon
6d9923be68 AbstractWeeklyScheduledProcess fix typo and add @noinspection 2020-05-13 08:45:03 +02:00
bruno DA SILVA
839bbc425f N°2901 Add log to help diagnose lost InlineImage
they are disabled by default, use this to enable:
 ```
 'log_level_min' => array(
 		'InlineImage' => LogAPI::LEVEL_TRACE,
 		'UserRequest' => LogAPI::LEVEL_TRACE,
 	),
```
2020-05-12 15:34:13 +02:00
acognet
70cc19768a N°1953 - Dashlet Title alignment not consistent : Left on List, Center on Table/Pie/Chart 2020-05-12 14:48:56 +02:00
acognet
873d109b98 N°1910 - iTop - Search on Text contains "_" not working - move correction in other place 2020-05-12 14:48:16 +02:00
Eric
a81950571a N°1598 - Fix regression on modify 2020-05-12 14:21:34 +02:00
Eric
bcd9679957 N°3006 - Fix filtering an UNION with parent class 2020-05-12 12:08:18 +02:00
Eric
2c10913fe5 N°2093 - Keep object values when a stimulus action fails 2020-05-12 11:29:30 +02:00
Eric
0342b89481 N°1598 - warning for bad stimulus instead of fatal error 2020-05-12 11:01:04 +02:00
acognet
3fd55c6dd6 N°1693 - the history of AttributeEncryptedString must not interpret HTML tags 2020-05-11 12:14:55 +02:00
Eric
c15b3462d1 N°2945 - Adding an empty file as an attachment is generating a fatal error
Changed error message
2020-05-07 08:49:05 +02:00
Pierre Goiffon
32f05ea917 👥 Added Pascal Schirrmann as contributor (N°2980, thanks to him !) 2020-05-07 08:36:53 +02:00
Molkobain
6a50b55a2a N°1598 - Improve user feedback on invalid transition: Display a better error message to the user in the portal 2020-05-06 16:58:25 +02:00
Eric
72f11c6a4d N°2815 - Fix basic authentication with Apache
Added support for REDIRECT_HTTP_AUTHORIZATION
2020-05-06 11:35:56 +02:00
Eric
609ea47f7b PHPDoc 2020-05-06 10:29:47 +02:00
Pierre Goiffon
74b3cfd46c Merge remote-tracking branch 'origin/support/2.7.0' into support/2.7 2020-05-06 10:13:15 +02:00
acognet
f7ea6c09cd N°2589 - Infinite loops when logging with a Contact having a non empty TagSet field 2020-05-05 19:00:24 +02:00
acognet
526a7f9817 N°1910 - iTop - Search on Text contains "_" not working - convert _ to \_ in javascript 2020-05-05 18:36:38 +02:00
Eric
5ccb1ef72a N°1662 - Fix Auto-complete on external key ignore obsolescence user preference
ValueSetObjects now consider obsolete data
2020-05-05 11:14:59 +02:00
Pierre Goiffon
180da03f08 N°2980 Fix backup not executed anymore
Regression introduced by #89
2020-05-05 09:00:40 +02:00
Pierre Goiffon
7ec7626aa0 N°2977 PHP Doc change 2020-05-04 18:13:40 +02:00
Eric
f92a980b4d N°2974 - Fix Global Search doesn't search in external field.
For External Field, allow the search also for FriendlyNames.
2020-05-04 18:13:18 +02:00
Pierre Goiffon
5d7582bb6f N°2977 LogAPI : restore default log level to OK, and really allow LEVEL_DEFAULT overloads
* Level was changed by mistake to trace with refactoring in 289171b9
Thanks @v-dumas !

* self wouldn't allow to override
see https://www.php.net/manual/fr/language.oop5.late-static-bindings.php
Thanks @bruno-ds !

* improve PHPDoc !
2020-05-04 16:55:46 +02:00
bruno DA SILVA
7a40db94fb 2424 - Better messages when an object update fail & removed an unwanted webserver error log entry 2020-05-04 12:00:30 +02:00
Eric
843798505a N°2974 - Fix Global Search doesn't search in external field
The IsSearchable() check was wrong for some attributes
2020-05-04 11:40:02 +02:00
Pierre Goiffon
bf13f9fc8a N°2975 improve RotatingLogFileNameBuilder next cron occurrence computation 2020-04-30 08:41:55 +02:00
Pierre Goiffon
289171b9f1 N°2977 LogAPI : allow to overwrite the default log level 2020-04-29 15:16:45 +02:00
Pierre Goiffon
9b065ffb0a Merge remote-tracking branch 'origin/support/2.7.0' into support/2.7
# Conflicts:
#	datamodels/2.x/itop-attachments/renderers.itop-attachments.php
2020-04-29 09:00:10 +02:00
Pierre Goiffon
96d888fcf3 N°2968 fix email-reply notification not updated
- add a specific container for attachments list, upload button and #attachment_plugin hidden input is outside of it
- refactor code between abstract class and implementation, add some comments
- now refreshes only the attachment list instead of the whole content
2020-04-28 17:47:20 +02:00
Vladimir Kunin
a182a37139 Add Russian translations for 2.7.0-1 (rebased) 2020-04-28 08:42:17 +02:00
Pierre Goiffon
23c15c1b6c Revert "N°2902 - Intersect with union generates unwanted alias renaming"
This reverts commit 866e4ab995.

Fix isn't yet commited, so we don't want to break the build.
The fix will be done in the hotfix/2902_intersect_alias branch
2020-04-27 09:36:38 +02:00
Eric
866e4ab995 N°2902 - Intersect with union generates unwanted alias renaming 2020-04-24 18:32:40 +02:00
Eric
75730eeea0 Log database deadlocks in EventIssue 2020-04-23 15:25:12 +02:00
Pierre Goiffon
58fd8709be Merge remote-tracking branch 'origin/support/2.6' into support/2.7
# Conflicts:
#	css/css-variables.scss
#	datamodels/2.x/authent-external/module.authent-external.php
#	datamodels/2.x/authent-ldap/module.authent-ldap.php
#	datamodels/2.x/authent-local/module.authent-local.php
#	datamodels/2.x/combodo-db-tools/module.combodo-db-tools.php
#	datamodels/2.x/itop-backup/module.itop-backup.php
#	datamodels/2.x/itop-bridge-virtualization-storage/module.itop-bridge-virtualization-storage.php
#	datamodels/2.x/itop-change-mgmt-itil/module.itop-change-mgmt-itil.php
#	datamodels/2.x/itop-change-mgmt/module.itop-change-mgmt.php
#	datamodels/2.x/itop-config-mgmt/module.itop-config-mgmt.php
#	datamodels/2.x/itop-config/module.itop-config.php
#	datamodels/2.x/itop-datacenter-mgmt/module.itop-datacenter-mgmt.php
#	datamodels/2.x/itop-endusers-devices/module.itop-endusers-devices.php
#	datamodels/2.x/itop-full-itil/module.itop-full-itil.php
#	datamodels/2.x/itop-hub-connector/module.itop-hub-connector.php
#	datamodels/2.x/itop-incident-mgmt-itil/module.itop-incident-mgmt-itil.php
#	datamodels/2.x/itop-knownerror-mgmt/module.itop-knownerror-mgmt.php
#	datamodels/2.x/itop-portal-base/module.itop-portal-base.php
#	datamodels/2.x/itop-portal/module.itop-portal.php
#	datamodels/2.x/itop-problem-mgmt/module.itop-problem-mgmt.php
#	datamodels/2.x/itop-profiles-itil/module.itop-profiles-itil.php
#	datamodels/2.x/itop-request-mgmt-itil/module.itop-request-mgmt-itil.php
#	datamodels/2.x/itop-request-mgmt/module.itop-request-mgmt.php
#	datamodels/2.x/itop-service-mgmt-provider/module.itop-service-mgmt-provider.php
#	datamodels/2.x/itop-service-mgmt/module.itop-service-mgmt.php
#	datamodels/2.x/itop-sla-computation/module.itop-sla-computation.php
#	datamodels/2.x/itop-storage-mgmt/module.itop-storage-mgmt.php
#	datamodels/2.x/itop-tickets/module.itop-tickets.php
#	datamodels/2.x/itop-virtualization-mgmt/module.itop-virtualization-mgmt.php
#	datamodels/2.x/itop-welcome-itil/module.itop-welcome-itil.php
#	datamodels/2.x/version.xml
2020-04-22 11:14:59 +02:00
Eric
f18ea18a5b N°2936 - TLs option is not set for restore function 2020-04-21 16:59:16 +02:00
Pierre Goiffon
1904bfdba6 css-variables : update to 2.7.0-2 2020-04-21 16:35:41 +02:00
acognet
e1949cd3eb N°2509 - Change Columns via "Configure this list" show obsolete data though user preferences is "not shown obsolete data" 2020-04-21 12:45:59 +02:00
Eric
1b2d3d1e84 N°2952 - Provisioning for hybrid auth fails
Changed Origin for change to an allowed value
2020-04-21 11:59:48 +02:00
acognet
0b95dbee7f N°1588 - Count on Managed Brick sometimes wrong 2020-04-20 16:31:56 +02:00
Pierre Goiffon
db593ff85e Merge remote-tracking branch 'origin/support/2.6' into support/2.7
# Conflicts:
#	application/loginwebpage.class.inc.php
#	application/menunode.class.inc.php
#	datamodels/2.x/itop-portal-base/portal/src/controllers/aggregatepagebrickcontroller.class.inc.php
#	datamodels/2.x/itop-portal-base/portal/src/controllers/userprofilebrickcontroller.class.inc.php
#	datamodels/2.x/itop-portal-base/portal/src/views/bricks/manage/popup-export-excel.html.twig
#	pages/ajax.render.php
2020-04-20 16:05:56 +02:00
Eric Espié
1f750bb12d N°2902 Fix alias renaming when already exists in one OQL of an UNION
The legacy impl is not modified
2020-04-20 14:59:56 +02:00
Pierre Goiffon
4ee66377ce Merge commit '15e5e21a89a3d3214dace82b8765a47e304a8f29' into support/2.7 2020-04-20 14:21:55 +02:00
Eric
432a950f8c N°2945 - Fix fatal error when adding empty attachment
alert when empty attachment is detected
2020-04-20 10:54:27 +02:00
acognet
bbc751bee4 N°2383 - GetAttributeFlag ignored on form refresh with dependent field 2020-04-14 17:56:27 +02:00
acognet
a77ba2fbab N°2564 - Stop copy after "<" character in a Copy operation on a Transition - change only in Copy function 2020-04-14 17:56:27 +02:00
Eric
5b60ec9edf N°2919 - Dashboard - Fix dashboard not saved
the sanitization was too strong. Some names can contain ':'
2020-04-10 18:11:36 +02:00
Molkobain
3103f361a4 Update 2.7.0-1 release date 2020-04-08 11:02:03 +02:00
acognet
621295199c N°1402 - Attribut File cannot be emptied Add a trash next to the name of the file 2020-04-06 16:36:46 +02:00
Eric
c1a7a36896 Compatibility with MySQL 5.6 2020-04-06 09:02:06 +02:00
acognet
d5fe653e51 N°2848 - Align creation and update message on portal to console message - add a comment for next time 2020-04-02 20:31:06 +02:00
acognet
fc2fb235a2 N°1344 - Save without all mandatory attributes (ajax reload not finished) 2020-04-02 17:46:18 +02:00
acognet
d7211509bd N°1062 - Portal : autocomplete and search = broken : change the max size of the list 2020-04-02 17:29:39 +02:00
acognet
c182b1a01f N°2848 - Align creation and update message on portal to console message 2020-04-02 11:50:01 +02:00
Eric
15e5e21a89 Compatibility with MySQL 5.6 2020-04-01 17:37:55 +02:00
acognet
ee0d231426 N°2895 - Tab dictionnary entries not taken in account in "Printer Friendly Version" screen 2020-04-01 01:05:13 +02:00
acognet
3282b46c9b N°2395 - Error in file light-gray.scss 2020-04-01 00:01:26 +02:00
acognet
05649ba50f Merge branch 'master' of github.com:Combodo/iTop 2020-03-31 23:48:35 +02:00
acognet
40efc4cbb1 N°1062 - Portal : autocomplete and search = broken 2020-03-31 23:47:46 +02:00
Molkobain
30034d381b Update version number to 2.7.0-1 2020-03-31 09:47:37 +02:00
Molkobain
986eb90546 N°2893 - Fix DataModel Viewer not supporting special chars in class name (eg. ") 2020-03-31 09:40:31 +02:00
Pierre Goiffon
eb41d3e2ef 📝 Fix erroneous PHPDoc for InlineImageGC 2020-03-30 17:09:04 +02:00
acognet
c6b16bb52e N°2119 - Dashlet Header statistic on ExternalKey, display id instead of name 2020-03-30 16:24:12 +02:00
acognet
95adbbb58f N°1181 - List of searchable classes in SearchMenuNode - add user rights tests 2020-03-30 16:23:23 +02:00
acognet
60f5c60059 N°1796 - Search : false criteria after using the magnifier 2020-03-30 16:19:23 +02:00
acognet
c0284ecc3b N°1953 - Dashlet Title alignment not consistent : Left on List, Center on Table/Pie/Chart 2020-03-30 16:18:43 +02:00
acognet
fc7b772ba3 N°1910 - iTop - Search on Text contains "_" not working
_ is a special caracter in mysql -> replace with \_
2020-03-30 16:13:47 +02:00
Pierre Goiffon
011d742ae3 N°2891 📌 add mbstring as optional extension 2020-03-27 14:41:59 +01:00
Pierre Goiffon
5b496f4d15 N°2866 Change "cron" case in labels as it is not an acronym
Thanks @Hipska for the feedback done in Combodo/iTop#124 !
2020-03-26 11:15:47 +01:00
Pierre Goiffon
97f4c32271 N°2881 Improve robustnedd of \ModuleInstallerAPI::RenameEnumValueInDB
Was causing errors when migrating from datamodels where the fields were not enum yet (this method is usually launched using \ModuleInstallerAPI::BeforeDatabaseCreation, so before an ALTER could be done to the column)
2020-03-26 10:18:34 +01:00
Pierre Goiffon
c002ca7902 setup.css : update .css that was not up to date :/ 2020-03-26 10:13:10 +01:00
Pierre Goiffon
ff22074418 🎨 setup.css : remove warnings & unused code
Removed unused legacy code :
* #header>H1 : a noline-height ugly when renamed to line-height, seems totally unused when noline-height
* table.formTable : cellpadding & cellspacing
2020-03-26 10:09:08 +01:00
Pierre Goiffon
84968ff550 Merge remote-tracking branch 'origin/release/2.7.0' 2020-03-26 08:50:14 +01:00
bruno DA SILVA
46151c87c0 N°2888 Check password policy only if field set with a string
Some callers are setting the field using an ormPassword object containing hashed password + salt

examples:
 - csv import
 - data synchro
 - ...
2020-03-25 12:43:41 +01:00
Pierre Goiffon
75a900c6f8 🚀 Tool to batch update XML datamodel version 2020-03-24 16:46:48 +01:00
Molkobain
e8c9d99783 Increase XML version to v1.7 2020-03-24 14:06:41 +01:00
Eric
1600302ad9 N°2869 - Removed Check for bad finalclass in root classes (already done) 2020-03-19 15:40:52 +01:00
Eric
a9c3a1b782 N°2869 - Check for bad finalclass in root classes (Allow all non-abstract child classes) 2020-03-19 10:01:16 +01:00
Eric
74848254a4 N°2869 - Check for bad finalclass in root classes 2020-03-18 14:10:35 +01:00
Eric
d7d9bfe0fd N°2869 - Check for bad finalclass in intermediate classes 2020-03-18 10:09:05 +01:00
odain
dd96dec100 Fix license file generation; exclude itop-portal-base 2020-03-18 08:42:55 +01:00
Pierre Goiffon
16ff51f3b7 📄 Update licenses after generation tool upgrade
See 76d26e8e
2020-03-18 08:15:09 +01:00
Pierre Goiffon
27c651b33c 📄 Remove itop-portal-base from license file 2020-03-17 18:08:49 +01:00
Pierre Goiffon
32375265cb 📄 Remove 2.x/authent-cas from license file 2020-03-17 17:47:25 +01:00
Pierre Goiffon
0cba163dc9 🔖 Update version to final in iTop files 2020-03-17 16:50:45 +01:00
Pierre Goiffon
fd1e17cc32 🚀 Release tool to update versions 2020-03-17 16:49:05 +01:00
Eric
d85e1906b7 N°2746 - New Attribute Enum Set
XML migration from 1.7 to 1.6
2020-03-17 12:03:10 +01:00
Pierre Goiffon
f8df84aa7b Update dict for 2.7.0-RC 2020-03-17 10:55:53 +01:00
Eric
c26b9459bb N°2869 - Fix 2.7 Migration
Run UPDATE requests just after the corresponding ALTER TABLE requests
2020-03-16 18:49:12 +01:00
Molkobain
4f7676c42d N°2735 - Rollback previous "fixes" to keep the simple ID policy in the Designer and a unique ID generation at runtime 2020-03-16 12:17:09 +01:00
Molkobain
ceddafaebe N°2735 - Rename parameter for better consistency 2020-03-16 12:17:09 +01:00
Stephen Abello
950640babe N°1986 - Revert feature 2020-03-13 10:24:25 +01:00
jbostoen
11e6be1037 🌐 Added NL translations (#124)
Co-authored-by: jbostoen <->
2020-03-13 09:42:37 +01:00
Molkobain
29d963317f N°2735 - Fix dashlet ID generation to have the "CUSTOM" prefix only at runtime 2020-03-12 16:46:15 +01:00
Molkobain
dd300e075c N°2735 - Fix dashlet edition in the Designer (property form ID was not matching dashlet's) 2020-03-12 16:46:03 +01:00
Molkobain
774ace2302 Fix icon select widget to be compatible with iTop 2.7 2020-03-12 14:16:03 +01:00
Molkobain
bbfddea93d Open new_dashlet_id operation for Designer 2020-03-12 14:16:02 +01:00
Stephen Abello
c5c7fd5c85 N°2855 - Security hardening 2020-03-12 14:13:17 +01:00
jbostoen
5d4b9f4a89 🌐 Fix typos in English translation (#123) 2020-03-12 08:51:40 +01:00
Stephen Abello
d01caaf4e4 N°2853 - Security hardening 2020-03-10 10:23:38 +01:00
Pierre Goiffon
f895821db9 ⚗️ CONTRIBUTING : added some emoji O:) 2020-03-06 20:52:33 +01:00
bruno DA SILVA
19f34d1a72 composer reflexion: list outdated packages 2020-03-05 11:33:36 +01:00
Pierre Goiffon
7ff1a03a3c N°2820 monthly log rotation : restore default config 2020-03-04 16:04:19 +01:00
Pierre Goiffon
eadc3b72c2 📝 N°2793 log rotation add PHPDoc about timezones 2020-03-04 14:23:34 +01:00
odain
c06f8e9a98 N°2793 log rotation test : fix timezone issues 2020-03-04 12:05:42 +01:00
Pierre Goiffon
6675d7d42a N°2793 Test log rotation 2020-03-04 09:21:05 +01:00
Eric
afc118e9c2 🐛 fix GetAsPlainText() on EnumSet 2020-03-03 17:34:15 +01:00
Pierre Goiffon
f36fcb2a2d N°2820 Log rotation : change default from weekly to monthly 2020-03-03 15:31:11 +01:00
Eric
f062af367d N°2826 - Bad SQL request for group by with data-localizer
Unit tests to check the fix in data-localizer
2020-03-03 15:25:12 +01:00
Pierre Goiffon
29d24faf52 N°2793 Log rotation : fix no rotation :/
Was caused by erroneous file exists test
2020-03-03 10:18:09 +01:00
Pierre Goiffon
33f3f2810e N°2793 Log rotation : add file exists check in the lock 2020-03-02 18:33:00 +01:00
Pierre Goiffon
fad00200b6 🔧 PHPStorm remove is_null() rewrite inspection 2020-03-02 15:56:26 +01:00
Pierre Goiffon
56ef6feadf N°2820 Log rotation : new MonthlyRotatingLogFileNameBuilder class 2020-03-02 15:52:59 +01:00
Pierre Goiffon
2be16f9078 N°2793 Log rotation (#117)
Now log file name is unchanged : current log is still /log/error.log \o/

Rotation check (using file last modification time) is done :
* on each file write : we don't want to miss calls if session last from 23:59:59 to 00:01 for example ! Though the filemtime() call is done once per session to lower performance impacts
* using a new background process (LogFileRotationProcess)

File renaming on setup is therefore removed.
Also the interface is renamed (from ILogFileNameBuilder to iLogFileNameBuilder) to conform to iTop convention.
2020-03-02 15:01:12 +01:00
Eric
6874aed4a2 N°1627 - Ticket ref sometimes duplicate
add MakeInsertQuery() to legacy
2020-03-02 12:04:12 +01:00
Pierre Goiffon
07b8830436 N°2814 Fix cannot authenticate in some HTTP calls
basic mode was forced in 0dd1f26b
scripts concerned :
* synchro/synchro_import.php
* webservices/cron.php
* webservices/import.php
2020-03-02 11:56:00 +01:00
Molkobain
39d3e00ba1 N°2822 - Fix timeout message through AJAX calls in the Portal 2020-02-28 16:53:16 +01:00
Stephen Abello
ffa43160bf N°1164 #1491 - Add padding and border to code blocks 2020-02-28 16:42:46 +01:00
Pierre Goiffon
a45d1336f4 🎨 Change \ormStopWatch::ComputeGoal for IDE convencience, add phpdoc 2020-02-28 12:02:20 +01:00
Federico Lazcano
5a287fabba 🌐 Typo in ES_CR User Requests 2020-02-28 08:23:34 +01:00
Federico Lazcano
da86ee4114 🌐 Typo in ES_CR Incidents 2020-02-28 08:22:59 +01:00
Federico Lazcano
5157788afe 🌐 Typo in ES_CR User Requests 2020-02-28 08:22:14 +01:00
Molkobain
386e25efd6 N°2314 - Remove basque-red, ocean-blue and test-blue from default themes 2020-02-27 15:41:54 +01:00
Molkobain
649e2f8e6a Internal: Remove unused import 2020-02-27 15:10:41 +01:00
Molkobain
3c3d744747 N°2314 - Refactor part of the compilation in dedicated helpers 2020-02-27 15:09:57 +01:00
Molkobain
1371eee826 N°2735 - Continue rework of the dashlet id generation: Dashlet could not be added in the Designer 2020-02-27 11:54:20 +01:00
Molkobain
6645a5053f N°2806 - Fix errors on legacy portal "portal" tag during migration to iTop 2.7 2020-02-26 17:17:56 +01:00
Molkobain
e2a3e0e74f N°2735 - Continue rework of the dashlet id generation:
- Move generation from DashboardLayout to Dashboard
- Migrate dashlet user preference in RuntimeDashboard only (and not in DesignTimeDashboard)
2020-02-26 16:29:32 +01:00
Molkobain
401f82062a N°2735 - Make sure to always have the dashboard (sanitized) id for dashlets rendering 2020-02-26 12:10:18 +01:00
Molkobain
5a01a76f80 N°2735 - Add new sanitize filter ('element_identifier') for dashboard identifier 2020-02-26 12:10:18 +01:00
Pierre Goiffon
3e5520d079 N°2735 Fix new dashlet id didn't contain dashboard id 2020-02-26 09:13:19 +01:00
Pierre Goiffon
beef2a89a3 N°2684 Remove upgrade from another repository
This upgrade procedure was :
* dangerous : running two iTop of different versions on the same database should not be done
* insufficient : just /extensions/* was copied, not any Hub or Designer data, no log, no instance.txt, ...
2020-02-25 18:01:59 +01:00
Molkobain
2f920cbb46 Internal: PHPDoc and warnings suppression 2020-02-25 17:45:18 +01:00
Pierre Goiffon
feae36e5b8 N°2735 Fix dashlet id duplicates when moving dashlet from one cell to another 2020-02-25 15:43:20 +01:00
Stephen Abello
92ae0e72e1 N°2314 - Markup extensibility: Add a variable for hovered table lines background color 2020-02-25 15:14:12 +01:00
Stephen Abello
ed030403aa N°2112 - Remove unused legacy portal conf variable and its usage 2020-02-25 14:00:58 +01:00
Pierre Goiffon
dfc894f6fd N°2735 Fix cannot edit new dashlet properties regression
Was introduced by cf83bc73
2020-02-25 11:17:52 +01:00
Stephen Abello
368b49ef8f N°2314 - Markup extensibility: Fix table sorter icons in html export pages 2020-02-25 10:36:56 +01:00
Stephen Abello
ccfd3848fb N°1164 #1491 - Fix syntax code highlighting display in CaseLog/HTML fields 2020-02-25 09:54:18 +01:00
Molkobain
ea59f7bc23 N°2314 - Markup extensibility: Add metadata to caselogs in the admin. console 2020-02-24 18:22:01 +01:00
Molkobain
9d6ed7f489 N°2806 - Fix errors on legacy portal constants during migration to iTop 2.7 2020-02-24 17:03:13 +01:00
Molkobain
0aa006f7c4 Internal: Fix typo in PHPDoc 2020-02-24 16:47:10 +01:00
Molkobain
c669d6951b PHPDoc and warnings suppression 2020-02-24 16:36:31 +01:00
Molkobain
9412f260ae PHPDoc 2020-02-24 11:01:24 +01:00
Molkobain
9781a11988 N°2803 - Regression: Fix "forgot_password" parameter not working anymore 2020-02-24 10:58:24 +01:00
Molkobain
1ed0210fe2 N°2799 - Fix double encoding in "top-list" display mode of the ManageBrick 2020-02-24 09:47:22 +01:00
Molkobain
1ce5ec73ea N°2798 - Fix unable to submit portal forms (Regression from dba6e8ce) 2020-02-24 09:24:23 +01:00
Eric
98304e2bda N°2596 - Allow '1' as true value for boolean in XML files 2020-02-21 18:14:03 +01:00
Pierre Goiffon
04fc58b55c 📝 Some @since annotations were missing complete version (ex 2.5 instead of 2.5.0) 2020-02-21 18:05:30 +01:00
Eric
096c3a3f13 N°2772 - Revert the loading of JS Dict in setup pages 2020-02-21 17:15:12 +01:00
Eric
87e22163d7 N°2037 - Add Twig template rendering to the WebPage 2020-02-21 14:35:25 +01:00
acognet
4cc8b89f4e N°2037 - New dashlet Gantt - add method to insert twig in an existing page 2020-02-21 12:09:15 +01:00
Pierre Goiffon
19809249a2 📝 Update PHPDoc for StopWatches interfaces 2020-02-20 18:01:09 +01:00
Molkobain
7347eed3ac PHPDoc 2020-02-20 17:43:14 +01:00
Molkobain
69d816e345 N°2275 - Add XML delta cleanup on datamodel BC breaking changes introduced in 2.7.0 2020-02-20 17:43:14 +01:00
Vincent Dumas
4008cb7688 Add blocks to enable customization 2020-02-20 17:18:39 +01:00
Lars Hippler
41a1bede70 🌐 Update DE-dictionary for iTop 2.7.0 (#113)
Many thanks @r0ert !
2020-02-20 16:04:24 +01:00
odain
e12845e412 N°2651 - Remove test directories from lib 2020-02-20 15:03:36 +01:00
odain
b30ad45792 N°2651 - Fix missing autoload 2020-02-20 14:58:39 +01:00
odain
84a11fb3c1 added namespace + mv iTopComposer + optimize FileIterator 2020-02-20 14:56:08 +01:00
Pierre Goiffon
ee39a387db N°2651 Remove tests from lib : browse dirs using SPL classes instead of GLOB 2020-02-20 14:56:08 +01:00
bruno DA SILVA
e3c6ac814e N°2651 - Removal of "Test" dirs within dependencies handled using composer 2020-02-20 14:56:08 +01:00
Eric
d668d65c70 N°2772 - Fix errors during upgrade. Prevent JS Dict load for setup pages. 2020-02-20 14:45:39 +01:00
Pierre Goiffon
e21e7c9cf0 🌐 N°2795 Fix dict typos 2020-02-20 09:36:33 +01:00
bruno DA SILVA
27a0de1da1 N°2154 - fix server crash in rare cases
Under undetermined circumstances, `exec('php -v')` called the current script triggering an infinite loop crashing the server
problem reported by @molkobain
see: https://stackoverflow.com/questions/43728378/running-php-files-through-shell-exec
2020-02-19 15:43:33 +01:00
Molkobain
d76e54996c PHPDoc 2020-02-19 11:54:50 +01:00
Pierre Goiffon
a4710f7542 N°2760 Abstract classes for extension API interfaces : remove return; for @return void methods 2020-02-18 18:15:45 +01:00
Eric
98a9c680c5 🐛 Updated rest example 2020-02-18 17:02:13 +01:00
Pierre Goiffon
a92157f763 N°2790 fix collapsibleLabel
* change icon when label closed
* fix switch in about dialog for licenses details
2020-02-18 16:34:51 +01:00
bruno DA SILVA
412f1a394f N°2574 - 💚 fix unit test
The behaviours has changed since the "password_renewed_date" is not changed only after the inter/update and no more just aftyer the $oUserLocal->Set('password')
2020-02-18 14:49:53 +01:00
Molkobain
dba6e8ce1a Fix images being too wide in HTML fields and caselogs in the end-users portal
Regression introduced in a previous version of iTop.
2020-02-17 16:29:21 +01:00
Molkobain
a127ca9ca0 N°2313 - Fix regression: No more validation message on password update in the end-users portal 2020-02-17 15:51:38 +01:00
Molkobain
0b5ee1e05c Internal: Fix typo in PHPDoc 2020-02-17 11:24:20 +01:00
Eric
f94e86ecea 🐛 Add missing function 2020-02-14 17:18:00 +01:00
Pierre Goiffon
fe770f36c5 N°2634 / N°2735 Migrate dashlet user prefs to new dashlet ID format 2020-02-14 15:59:09 +01:00
Pierre Goiffon
cf83bc7364 N°2634 / N°2735 Fix dashlets identifiers : was causing prb on widget init, prefs save
Dashlet id now includes :
* "CUSTOM-" if dashlet is contained in a custom dashboard, nothing elsewhere
* the ID of the dashboard
  - for menus : menu id escaped for HTML
  - for AttributeDashboard : <class>__<field>
* the row / cell / dashlet idx

Examples :
CUSTOM-UserRequestOverview_IDrow1-col0-0
Organization__overview_IDrow1-col0-12
2020-02-14 15:59:09 +01:00
Eric
76982a2846 Revert Last change. The values are already protected at this stage. 2020-02-14 15:42:05 +01:00
bruno DA SILVA
4cedd30625 N°2574 - bugfix and UI
- 🐛 fix regression preventing automatic update of password_renewed_date
 - 💄 add a "general information" fieldset
2020-02-13 15:23:56 +01:00
bruno DA SILVA
a86079c477 N°2154 - 🐛 fix an awful typo producing a nonsense
I'm sorry!
2020-02-13 15:21:01 +01:00
Eric
128a237392 N°2746 - Fix Tags configuration screen (removed EnumSet from tag editable list) 2020-02-13 12:31:22 +01:00
Eric
0ecfffe413 N°2746 - Fix export separator 2020-02-13 12:12:35 +01:00
Eric
ef3bdd63a4 N°2746 - Fix search from shortcut 2020-02-13 11:56:19 +01:00
Eric
585135c6c7 N°2758 - Keep AddCondition to avoid BC break 2020-02-13 11:56:01 +01:00
Eric
b3faa96a45 🌐 Add Trigger context label 2020-02-13 09:53:55 +01:00
Eric
6f04525cdf 🎨 cleanup code 2020-02-13 09:49:58 +01:00
Pierre Goiffon
03834fedb8 N°2369 deprecate MySQL views 2020-02-12 18:11:12 +01:00
Vincent Dumas
6bde8e867f Move menu "Universal Search" under "Query" 2020-02-12 18:01:38 +01:00
Molkobain
0e3d195250 N°2275 - Fix XML delta computation putting flags on wrong XML levels 2020-02-12 17:40:53 +01:00
Pierre Goiffon
fae8c9edbd N°2780 Add ContextTag::TAG_CONSOLE for ajax operations 2020-02-12 17:20:10 +01:00
Pierre Goiffon
133d267aca N°2329 Update TCPDF to version fixing unlink bug
Was updated to 6.3.2 fot PHP 7.4 compat, but this version had a regression (issue 159 in the original repo)
This commit integrates 6.3.4 that includes a fix for issue 159
2020-02-12 15:23:57 +01:00
Stephen Abello
166986f336 N°2314 - Markup extensibility: Replace some hardcoded values by overloadable variables 2020-02-12 14:53:19 +01:00
Stephen Abello
f76d649d1a Wee cleanup 2020-02-12 14:53:19 +01:00
Stephen Abello
30747b92c7 N°2755 - Security hardening 2020-02-12 14:53:19 +01:00
Stephen Abello
12ce718662 Internal: Add HtmlEntityDecode() to utils, a counterpart to HtmlEntities() 2020-02-12 14:53:19 +01:00
Molkobain
a1cdb46663 Internal: Refactor newsroom SCSS rules to real SCSS 2020-02-12 14:20:27 +01:00
Pierre Goiffon
824d8398a3 N°2634 / N°2735 Allow saving list prefs for all DashletObjectList
The id generated for the dashlets in the markup is the one used in the saved appUserPreferences. As no control is done during compilation nor in the Designer editor, we could have duplicates.
The first fix (081ba68a) was adding a generated suffix, but for default dashlet this was generated each time so the id was different on every page load ! For custom dashlets as their definition was saved in a XML file it was ok.
This new fix adds a prefix containing row and col id, so every time the id is the same. No duplicates should be found in the same cell.
2020-02-12 14:07:57 +01:00
Eric
406774aa15 N°2746 - Fix Import/Export using labels or code 2020-02-12 12:08:40 +01:00
Pierre Goiffon
dd8712e2e8 📝 Add more doc for \DBObject::GetAsHTML 2020-02-12 11:44:00 +01:00
Eric
767bcdf117 N°2746 - Fix unit tests (typo) 2020-02-11 17:00:55 +01:00
Eric
5e060737df N°2746 - Fix unit tests 2020-02-11 16:46:24 +01:00
Eric
d9bf0fe012 N°2746 - Fix breadcrumb for search of enumSet 2020-02-11 16:02:55 +01:00
Eric
93c9783b1a N°2746 - Fix empty search for TagSet 2020-02-11 14:51:22 +01:00
Eric
e9c1467026 N°2746 - Fix "Modify All" fatal error 2020-02-11 14:35:38 +01:00
Eric
863cb4cad6 N°2758 - Allow only one condition on ValueSetDef and restore cache 2020-02-11 11:54:00 +01:00
Pierre Goiffon
94b70fc473 N°2776 ObjectFormManager : change transaction scope
* move ApplyStimulus & triggers out of the transaction
* move \utils::RemoveTransaction to a finally block
2020-02-11 11:36:59 +01:00
Pierre Goiffon
4dc383cba8 N°2684 Fix setup broke when upgrading with a config file from another directory
In the moduleschoice screens we were using a wrong approot_url !
2020-02-11 09:41:48 +01:00
Pierre Goiffon
55d8a2316a 📝 GetAttributeFlags PHPDoc revised 2020-02-11 08:34:57 +01:00
Stephen Abello
fe8f274c14 N°2314 - Markup extensibility: Replace a hardcoded value by an overloadable variable 2020-02-10 15:33:47 +01:00
Stephen Abello
72fad49c4e N°2314 - Markup extensibility: Add default color to body node 2020-02-10 15:33:47 +01:00
Eric
888d0775e6 N°2758 - Removed ValueSetDef cache 2020-02-10 14:29:28 +01:00
Molkobain
db19f71758 N°2771 - Fix "Unknown form type" when changing user language in portal 2020-02-10 14:20:11 +01:00
Molkobain
a259443735 N°2314 - Markup extensibility: Add attribute flags as metadata to object forms 2020-02-10 13:27:36 +01:00
Pierre Goiffon
58e8ca1f50 📝 GetAttributeFlags PHPDoc 2020-02-10 09:56:31 +01:00
Pierre Goiffon
ab79426508 N°2293 some PHPDoc update 2020-02-07 18:21:02 +01:00
bruno DA SILVA
7e61917521 N°524 - password validity message can be superseded with conf 2020-02-07 17:25:17 +01:00
Molkobain
e42aab30a5 Internal: Fix regression introduced in 3d2a844f ("Close" button always displayed in object forms in IE) 2020-02-07 17:22:41 +01:00
Molkobain
a79ef0bd51 Update (massively) translations before iTop 2.7 release 2020-02-07 16:51:21 +01:00
Eric
5d88391109 N°2758 - Reset ValueSetDef cache when modifying some parameters 2020-02-07 14:27:22 +01:00
Molkobain
c56c04d84d N°2760 - Ease API interfaces implementation through abstract classes 2020-02-06 18:09:59 +01:00
Molkobain
f2b8f50a94 Internal: Add Anne to the sample data to welcome her! 👋 2020-02-06 18:07:51 +01:00
Molkobain
9de11a29fb PHPDoc 2020-02-06 16:25:25 +01:00
Molkobain
6537e00453 Internal: Add Matthieu to the sample data to welcome him! 👋 2020-02-06 15:53:26 +01:00
Eric
dd5f4909da Fix warning 2020-02-06 15:01:02 +01:00
Stephen Abello
ed67df734f N°2755 - Security hardening 2020-02-06 14:50:27 +01:00
Stephen Abello
44894526f1 N°2742 - HTML files preview are now raw text only 2020-02-06 14:27:13 +01:00
xtophe38
de78963b30 Fix DataAdministration translation to be aligned with other menus 2020-02-06 14:25:52 +01:00
bruno DA SILVA
948fd6f0ce N°2154 - improve robustness of submitted config validator
thanks to @molkobain 's awful provider's using PHP 4.4 within CLI
2020-02-06 14:07:39 +01:00
bruno DA SILVA
214dbeef5b N°2154 - var into string patterns can now also be enabled using server vars
- usage: $_SERVER['ITOP_CONFIG_PLACEHOLDERS']
 - plus removal of useless log Trace since this code is too early in iTop's init process for this feature
2020-02-06 14:05:08 +01:00
bruno DA SILVA
f2fbd8457d N°2498 - Authorize map extension
so as `.js.map` is not forbidden by apache
2020-02-06 14:05:08 +01:00
Molkobain
6a432c6a25 N°2757 - Fix count in group by dashlets 2020-02-06 12:12:27 +01:00
Molkobain
e96a8387a0 N°2750 - Regression: Fix default user profile image not shown in portal due to N°2060 2020-02-06 10:06:18 +01:00
Pierre Goiffon
f3576cffb0 📝 README : remove 2.4.* version as this branch isn't supported anymore by Combodo 2020-02-05 14:51:46 +01:00
Molkobain
c5625e6a8d Internal: Fix setup headers style due to 71708cf 2020-02-05 14:49:33 +01:00
Molkobain
3d2a844fef N°2313 - Markup extensibility: Improve success message display during the workflow 2020-02-05 12:10:15 +01:00
Molkobain
110a030902 PHPDoc 2020-02-05 12:10:15 +01:00
Stephen Abello
5ccd885607 Remove DB Tools from excluded modules 2020-02-05 12:04:26 +01:00
Stephen Abello
e5c6efbe69 Merge branch 'master' into develop
# Conflicts:
#	README.md
2020-02-05 11:24:44 +01:00
Stephen Abello
65b8132914 N°2314 - Markup extensibility: Fix collapsible icons in "About iTop" modal 2020-02-05 09:47:27 +01:00
Eric
3c2130aa72 N°2321 - Fix SQL request generation for inherited magic attributes 2020-02-04 15:54:03 +01:00
Stephen Abello
e70a2f75d3 N°2748 - Fix regression introduced by 71f5d29c, CKEditor's paragraph spacing wasn't coherent with how it's displayed in iTop 2020-02-04 11:41:10 +01:00
Molkobain
fe8e6ba4b0 N°2314 - Markup extensibility: Fix UI elements not using main colors variables 2020-02-04 10:32:57 +01:00
Eric
008614fde6 N°2321 - Fix SQL request generation for inherited magic attributes 2020-02-04 10:28:35 +01:00
Molkobain
ac6e60f5a1 N°2595 - Reorganize admin. console menus: Change new menu groups IDs to avoid collision with existing extensions 2020-02-04 09:50:11 +01:00
Stephen Abello
bf18d623d6 N°2314 - Markup extensibility: Add 2 additional themes for the backoffice
Adds a colored top bar to easily identify different environments (tests, production, ...)
2020-02-03 16:17:46 +01:00
Stephen Abello
10d04756ee N°2314 - Markup extensibility: Fall back on iTop's default theme when a non existing theme is selected 2020-02-03 15:12:59 +01:00
bruno DA SILVA
6e927114e0 N°2154 - 💚 fix tests
- the correct file is now versioned
2020-02-03 12:04:51 +01:00
Pierre Goiffon
682c24a873 N°2293 DBUpdate : save changed fields and corresponding previous values (#111)
* N°2293 DBUpdate : save changed fields and corresponding previous values for callbacks
* update PHPDoc
* remove m_aChanges and ListChangesUpdated() that were introduced in 2.7.0-beta
* add m_aPreviousValuesForUpdatedAttributes and ListPreviousValuesForUpdatedAttributes()

* :memo Woops forgot to change one PHPDoc

* 📝 Some more PHPDoc O:)

* 📝 Add more info in .doc README

* 📝 Well, again some PHPDoc O:)

* 📝 Replace inline @link by @see
@link are for URI, see https://docs.phpdoc.org/latest/references/phpdoc/inline-tags/link.html
2020-01-31 18:01:26 +01:00
bruno DA SILVA
d4b4ced649 🌐 update dictionaries
- set the translation as requested by Q&A
2020-01-31 17:29:38 +01:00
bruno DA SILVA
c2589492d9 📝 documentation generator dependencies handling improvement
- ignore /.doc/vendor
 - uses a lock file (at /.doc/composer.lock)
2020-01-31 17:29:38 +01:00
bruno DA SILVA
15c9cf926e 2154 - preserve "var" in conf
- add possibility to inject var using string patterns (ie: `'%env(DB_HOST)?:localhost%`)
 - on WriteToFile, preserve the non interpreted value when the interpreted value is kept the same
 - added unit tests for both behaviours
 - minor bugfix (default value in comment was wrong) and code readability improvements
2020-01-31 17:29:37 +01:00
Molkobain
78d4c8c7c7 Internal: Fix typo 2020-01-31 17:22:57 +01:00
Eric
d9e8eed084 💚 Fix CI on TagSet search (request have changed) 2020-01-31 16:13:59 +01:00
Eric
ebe86d09ee N°985 - Add applicable contexts on Trigger (logs) 2020-01-30 16:18:49 +01:00
Eric
5e5d368299 N°2657 - MTP : Progress Bar has disappeared (Search exact match) 2020-01-30 16:02:16 +01:00
Molkobain
f990a83453 N°2060 - Migrate error page to the Symfony framework 2020-01-30 13:56:32 +01:00
Molkobain
c6325dce8e Internal: Fix autoloader path for Symfony bin/console utility 2020-01-30 13:56:32 +01:00
Eric
bbca1625fb N°2657 - MTP : Progress Bar has disappeared (Search exact match) 2020-01-30 12:31:22 +01:00
Pierre Goiffon
53975d1d8f 📝 Replace inline @link by @see
@link are for URI, see https://docs.phpdoc.org/latest/references/phpdoc/inline-tags/link.html
2020-01-30 09:35:25 +01:00
Pierre Goiffon
1358bf9b7f 📝 Well, again some PHPDoc O:) 2020-01-30 09:25:53 +01:00
Pierre Goiffon
7c17be4db6 📝 Add more info in .doc README 2020-01-30 09:22:38 +01:00
Pierre Goiffon
367a92b711 📝 Some more PHPDoc O:) 2020-01-30 08:39:18 +01:00
Pierre Goiffon
0a3201dd41 :memo Woops forgot to change one PHPDoc 2020-01-29 18:43:46 +01:00
Pierre Goiffon
d82690dd84 N°2293 DBUpdate : save changed fields and corresponding previous values for callbacks
* update PHPDoc
* remove m_aChanges and ListChangesUpdated() that were introduced in 2.7.0-beta
* add m_aPreviousValuesForUpdatedAttributes and ListPreviousValuesForUpdatedAttributes()
2020-01-29 18:36:46 +01:00
Eric
7f9e4385ac N°2657 - MTP : Progress Bar has disappeared (support any code length) 2020-01-29 18:01:17 +01:00
Stephen Abello
aa3e284af3 Update README for 2.7.0-beta2 2020-01-29 16:59:16 +01:00
Stephen Abello
a941e5f752 Merge branch 'develop' of https://github.com/Combodo/iTop into develop 2020-01-29 11:49:38 +01:00
Stephen Abello
b1878f7265 Update version number for 2.7.0-beta2 2020-01-29 11:49:20 +01:00
Molkobain
b106a54c50 N°2314 - Markup extensibility: Add 2 additional themes for the backoffice
Basic color changes to identify different environments (tests, production, ...)
2020-01-29 11:04:20 +01:00
Molkobain
002da0b387 N°2314 - Markup extensibility: Rework some SCSS variables 2020-01-29 11:04:20 +01:00
acognet
6b9e723a45 Merge remote-tracking branch 'origin/develop' into develop 2020-01-29 09:55:44 +01:00
acognet
b54e457cbb N°2038 - New dashlet Kanban 2020-01-29 09:54:56 +01:00
jbostoen
e750dd53d8 NL translations for iTop 2.7.0 (#94)
Made by @jbostoen & @Hipska in PR #94 . Many thanks to them !
2020-01-29 09:51:11 +01:00
Eric
da6a55504e N°985 - AttributeEnumSet (portal support) 2020-01-28 17:37:17 +01:00
Eric
b58356c42e N°985 - Add applicable contexts on Trigger (search) 2020-01-28 17:37:17 +01:00
Molkobain
524e43b8c4 N°2313 - Markup extensibility: Add metadata on session messages in the end-users portal 2020-01-28 17:27:32 +01:00
Eric
a80bd6f2b9 N°985 - Add applicable contexts on Trigger (display read-only) 2020-01-28 15:29:12 +01:00
Eric
08eb9ee630 🌐 update dictionaries for 2.7.0-beta2 2020-01-28 15:29:12 +01:00
Eric
05485b838e N°985 - Add applicable contexts on Trigger (display read-only) 2020-01-28 15:29:12 +01:00
Eric
029fe6882d N°985 - Add applicable contexts on Trigger (Fix regression) 2020-01-28 15:29:12 +01:00
Eric
b31eb6aab9 Comment 2020-01-28 15:29:12 +01:00
Molkobain
a96c194676 N°2313 - Markup extensibility: Add CSS classes on object details and lists in the end-users portal 2020-01-28 15:25:12 +01:00
bruno DA SILVA
0d85331bca 1627 - Ticket ref sometimes duplicate
🐛 INSERT/UPDATE do not require to free the results
2020-01-28 11:59:04 +01:00
Pierre Goiffon
e9dec8ae05 N°330 Attachments as table : fix table sorting on size and date
* portal : use data-order attribute for the DataTable plugin (https://datatables.net/manual/data/orthogonal-data)
* console : add textExtraction override for the attachments table (https://mottie.github.io/tablesorter/docs/example-option-text-extraction.html)
2020-01-28 10:11:29 +01:00
bruno DA SILVA
6a6a0ffa24 1627 - Ticket ref sometimes duplicate
🐛 fix ref. generation when inside a transaction (by opening a new connection).
note: the portal make uses of such a transaction.
2020-01-27 17:58:30 +01:00
Molkobain
87623fba3d PHPDoc 2020-01-27 16:58:55 +01:00
Molkobain
a7619f2820 N°2313 - Markup extensibility: Add metadata on admin. console object lists 2020-01-27 16:58:55 +01:00
bruno DA SILVA
cff53d71ba N°2154 & N°2720 & N°2684 - config integrity during setup 2020-01-27 15:21:50 +01:00
Molkobain
71708cfbc7 Internal: Fix setup headers size 2020-01-27 14:54:53 +01:00
acognet
e05b3a5fb9 N°2618 - Fix missing scroll bar in DataModel Viewer for class with large number of attributs 2020-01-27 10:47:19 +01:00
acognet
bfcb1fdb30 N°2618 - Fix missing scroll bar in DataModel Viewer for class with large number of attributs 2020-01-27 10:47:19 +01:00
Eric
cc4e1ea104 N°985 - Add applicable contexts on Trigger (Add portal contexts) 2020-01-24 17:43:59 +01:00
Molkobain
5485897bbb N°2313 - Markup extensibility: Fix raw value and attribute label not always being escaped 2020-01-24 17:38:18 +01:00
Molkobain
27f343e543 N°330 - Attachments: Align table rendering to linkset tables rendering 2020-01-24 17:02:02 +01:00
Molkobain
cca79735fc N°330 - Attachments: Fix empty "Delete" column displayed all the time 2020-01-24 17:02:02 +01:00
Molkobain
c48bbfd32a N°2313 - Markup extensibility: Add metadata on attachments 2020-01-24 17:02:02 +01:00
Molkobain
3ae2058f6f N°2314 - Markup extensibility: Refactor utils::GetCSSFromSASS() to enable SCSS compilation out of a file 2020-01-24 17:02:02 +01:00
Molkobain
0a63568715 PHPDoc 2020-01-24 17:02:02 +01:00
Molkobain
f878eea68d N°330 - Attachments: Update MS Office and OpenOffice file icons with more modern versions 2020-01-24 17:02:02 +01:00
Eric
8ad2b8091c N°2657 - MTP : Progress Bar has disappeared 2020-01-23 11:28:52 +01:00
bruno DA SILVA
d6ca08efb8 N°2730 - Cannot log callstack with callback into EventIssue 2020-01-22 17:37:44 +01:00
Molkobain
ba8a2c1b15 N°2710 - Fix setup crash due to PHP notices (regression introduced in 59678955) 2020-01-22 13:32:31 +01:00
bruno DA SILVA
0ae0336e04 N°1627 - Ticket ref sometimes duplicate
🐛 Ticket creation no more crash if the current user have limited read access
2020-01-21 18:31:09 +01:00
Molkobain
8df0ef6af9 N°2723 - Fix double scrollbar in search criterion 2020-01-21 17:40:11 +01:00
Molkobain
d77c77c03b PHPDoc 2020-01-21 17:20:12 +01:00
Molkobain
5967895561 N°2710 - Fix extremely slow page load for first user after setup (regression introduced in N°2314) 2020-01-21 17:19:16 +01:00
Molkobain
6e754d4fa5 Setup: Fix graphiz detection feedback message on Windows systems 2020-01-21 15:50:33 +01:00
Molkobain
165fd0e700 N°2314 - Setup: Improve UI of user message when CRON is running 2020-01-21 15:35:09 +01:00
Molkobain
d100ce8005 PHPDoc and code formatting 2020-01-21 15:35:09 +01:00
Eric
770f5a7b67 N°985 - Add applicable contexts on Trigger (order values in DB) 2020-01-21 14:55:03 +01:00
Molkobain
a993f6a80b PHPDoc 2020-01-21 14:19:45 +01:00
Molkobain
c8bb710d21 N°2314 - Markup extensibility: Fix regression introduced in the previous commit (used a PHP 7.x function) 2020-01-21 14:17:44 +01:00
Molkobain
d963fbd8cf N°2314 - Markup extensibility: Fix crash when no <theme> defined in datamodel 2020-01-21 12:20:59 +01:00
Eric
beda8e2810 N°985 - Add applicable contexts on Trigger (fix MTP warnings) 2020-01-21 12:01:42 +01:00
Pierre Goiffon
083f8d69c2 Revert "N°2618 DataModel viewer : fix no vertical scrollbar in MSIE"
Was introducing a regression in Chrome & Fx (cannot change tab anymore)
This reverts commit 8a666b09d6.
2020-01-21 10:51:16 +01:00
Eric
1c16eeb5e4 N°2240 - Supportability - Maintenance mode (setup reset maintenance mode) 2020-01-21 10:27:47 +01:00
Stephen Abello
ecc0b57b31 Merge branch 'master' into develop
# Conflicts:
#	css/css-variables.scss
#	css/light-grey.css
#	datamodels/2.x/authent-external/module.authent-external.php
#	datamodels/2.x/authent-ldap/module.authent-ldap.php
#	datamodels/2.x/authent-local/module.authent-local.php
#	datamodels/2.x/itop-attachments/module.attachments.php
#	datamodels/2.x/itop-backup/module.itop-backup.php
#	datamodels/2.x/itop-bridge-virtualization-storage/module.itop-bridge-virtualization-storage.php
#	datamodels/2.x/itop-change-mgmt-itil/module.itop-change-mgmt-itil.php
#	datamodels/2.x/itop-change-mgmt/module.itop-change-mgmt.php
#	datamodels/2.x/itop-config-mgmt/module.itop-config-mgmt.php
#	datamodels/2.x/itop-config/module.itop-config.php
#	datamodels/2.x/itop-datacenter-mgmt/module.itop-datacenter-mgmt.php
#	datamodels/2.x/itop-endusers-devices/module.itop-endusers-devices.php
#	datamodels/2.x/itop-full-itil/module.itop-full-itil.php
#	datamodels/2.x/itop-hub-connector/module.itop-hub-connector.php
#	datamodels/2.x/itop-incident-mgmt-itil/module.itop-incident-mgmt-itil.php
#	datamodels/2.x/itop-knownerror-mgmt/module.itop-knownerror-mgmt.php
#	datamodels/2.x/itop-portal-base/module.itop-portal-base.php
#	datamodels/2.x/itop-portal/module.itop-portal.php
#	datamodels/2.x/itop-problem-mgmt/module.itop-problem-mgmt.php
#	datamodels/2.x/itop-profiles-itil/module.itop-profiles-itil.php
#	datamodels/2.x/itop-request-mgmt-itil/module.itop-request-mgmt-itil.php
#	datamodels/2.x/itop-request-mgmt/module.itop-request-mgmt.php
#	datamodels/2.x/itop-service-mgmt-provider/module.itop-service-mgmt-provider.php
#	datamodels/2.x/itop-service-mgmt/module.itop-service-mgmt.php
#	datamodels/2.x/itop-sla-computation/module.itop-sla-computation.php
#	datamodels/2.x/itop-storage-mgmt/module.itop-storage-mgmt.php
#	datamodels/2.x/itop-tickets/module.itop-tickets.php
#	datamodels/2.x/itop-virtualization-mgmt/module.itop-virtualization-mgmt.php
#	datamodels/2.x/itop-welcome-itil/module.itop-welcome-itil.php
#	datamodels/2.x/version.xml
2020-01-20 16:42:42 +01:00
Stephen Abello
be9f6eff29 Merge branch 'develop' of https://github.com/Combodo/iTop into develop 2020-01-20 16:41:44 +01:00
Eric
900e8ac6d7 N°985 - Add applicable contexts on Trigger 2020-01-20 15:50:08 +01:00
Molkobain
2fcea4d02e N°2313 - Markup extensibility: Add field label in its metadata 2020-01-20 14:43:40 +01:00
Stephen Abello
1927fc743a N°2314 - Fix left padding for menu entries 2020-01-20 11:20:56 +01:00
Molkobain
6aff09eaf7 N°2708 - Internal: Fix regression introduced with N°2313 "Undefined index 'prefix'" 2020-01-20 11:16:07 +01:00
Molkobain
54e9830a3b PHPDoc 2020-01-20 09:53:22 +01:00
Molkobain
a45819dbf0 N°2682 - Portal: Fix transaction ID not being removed 2020-01-17 17:40:37 +01:00
Molkobain
e8aaec5789 N°2060 - Regression: Fix missing PORTAL_ID constant 2020-01-17 17:33:52 +01:00
Molkobain
d16c0ffef9 N°2313 - Markup extensibility: Add metadata on admin. console object creation forms 2020-01-17 14:16:31 +01:00
Molkobain
24ad593dc8 N°2313 - Markup extensibility: Add password attributes to exclude list in metadata 2020-01-17 09:03:14 +01:00
Molkobain
0b67828ab9 Add comments in standard end-users portal XML 2020-01-17 09:03:14 +01:00
Eric
8a1a78444d N°2249 - Supportability - Updater module (unified version name) 2020-01-16 18:13:58 +01:00
Eric
4552bc0778 N°2249 - Supportability - Updater module (changed version name in the priv_module_install table) 2020-01-16 17:42:02 +01:00
Eric
3a113e31fb N°2249 - Supportability - Updater module (run setup when error occurs) 2020-01-16 17:25:28 +01:00
Pierre Goiffon
8a666b09d6 N°2618 DataModel viewer : fix no vertical scrollbar in MSIE
The scrollbar is present on the right side but after viewport limit so not visible !
Can't change div.ui-layout-pane.ui-layout-center width as it is calculated dynamically by JS Layout...
So added another container with a margin. The CSS rules are added to MSIE only using the media query tip :/
2020-01-16 16:40:36 +01:00
Pierre Goiffon
0d9dc34a08 Schema.php : replace <br/> to <br> (might break on MSIE) 2020-01-16 15:06:04 +01:00
Pierre Goiffon
c7ca1eeab5 🎨 Code formatting on pages/schema.php 2020-01-16 15:06:04 +01:00
Eric
02265135e3 N°2249 - Supportability - Updater module (run setup when error occurs) 2020-01-16 11:43:17 +01:00
Eric
2c1bf665c3 N°2249 - Supportability - Updater module (Add read-only warning) 2020-01-16 11:34:50 +01:00
Molkobain
60b6fcc783 N°2313 - Markup extensibility: Better display of success messages on form validation 2020-01-16 11:34:08 +01:00
Molkobain
53adb37f43 N°2060 - Fix session messages and SCSS compilation services being cached 2020-01-16 11:34:08 +01:00
Molkobain
a6fe564a95 Add comments in standard end-users portal XML 2020-01-16 11:34:08 +01:00
Pierre Goiffon
4945f25d49 N°2602 Portal : fix no more border around new caselog editor
With the new version of CKE N°2271, container is span.cke on MSIE instead of div.cke
2020-01-16 11:27:24 +01:00
Eric
e5f3daf88a N°2249 - Supportability - Updater module (Add read-only warning) 2020-01-16 11:19:30 +01:00
Eric
cc3e6d64e1 N°2249 - Supportability - Updater module (Allow to run setup in case of failure) 2020-01-16 10:49:49 +01:00
Eric
8024aad43d N°2249 - Supportability - Updater module (Add read-only warning) 2020-01-16 10:47:37 +01:00
Pierre Goiffon
757dbb8b25 N°2311 login page : add autofocus attribute to the id field
https://caniuse.com/#feat=autofocus
2020-01-16 10:38:08 +01:00
Eric
b370deaac9 N°2313 - Markup extensibility: Add support for both code AND title in admin. console tabs 2020-01-16 09:56:22 +01:00
Eric
026b7e1836 N°2249 - Supportability - Updater module (split ajax calls) 2020-01-15 17:09:31 +01:00
Eric
d03b924240 N°2249 - Supportability - Updater module (split ajax calls) 2020-01-15 16:58:36 +01:00
Eric
97a047e38f N°2249 - Supportability - Updater module (split ajax calls) 2020-01-15 16:42:47 +01:00
Eric
5be800cfce N°2249 - Supportability - Updater module (split ajax calls) 2020-01-15 15:48:54 +01:00
Molkobain
956b597e50 Fix how user data is retrieved for "Form Prefill" in the end-users portal 2020-01-15 15:16:50 +01:00
Molkobain
57100dee9f N°2060 - WIP: Fix cached part of the portal (sync. commit) 2020-01-15 12:53:40 +01:00
Eric
c3cc1afec1 🙈 remove unnecessary info 2020-01-15 11:37:10 +01:00
Pierre Goiffon
7fe24f58f3 N°330 Display attachments as table : portal remove author column 2020-01-15 10:26:25 +01:00
Molkobain
e4160c7cf2 N°2702 - Portal: Fix origin modal not closing when switching to editing of an object 2020-01-15 10:15:36 +01:00
Molkobain
7d87768ec4 PHPDoc and warnings suppression 2020-01-15 10:15:36 +01:00
Molkobain
9946e6c41a Fix typo 2020-01-15 10:15:36 +01:00
Stephen Abello
02b483e33e Setup's cursor style on label wasn't present in .scss file and was lost since 7b6481e 2020-01-15 10:14:59 +01:00
Stephen Abello
7b6481efbd N°2112: Setup alert message introduced by 83ba909 stopped working since 797893d🐒 🐒 2020-01-15 10:09:46 +01:00
Molkobain
efef582119 N°2306 - Security hardening (Fix regression introduced in f3b66a44, thanks to @bruno-ds !) 2020-01-15 08:42:35 +01:00
Molkobain
5056e561fe PHPDoc 2020-01-15 08:42:35 +01:00
Molkobain
4400cfde62 N°2313 - Markup extensibility: Update usages of admin. console tabs to have codes and titles 2020-01-15 08:42:35 +01:00
Molkobain
5a39581c60 N°2313 - Markup extensibility: Add support for both code AND title in admin. console tabs 2020-01-15 08:42:35 +01:00
Pierre Goiffon
4eab0e6450 N°330 Display attachments as table : portal improvements
* display attachments count in section title, updated on each add/delete
* remove "no attchments message" on adding new attachment
2020-01-14 11:56:20 +01:00
Molkobain
f3b66a44ee N°2306 - Security hardening 2020-01-14 11:50:50 +01:00
Molkobain
558f108520 N°2314 - Change breadcrumb icons color to black instead of Combodo's orange 2020-01-14 11:09:01 +01:00
Molkobain
07a93d12e2 Cleanup: Remove old/unused images/CSS files (Exhaustive list in migration notes) 2020-01-14 11:09:01 +01:00
Eric
ce127278bb N°2434 - Track field Comment in core/delete - API REST 2020-01-14 10:46:21 +01:00
Molkobain
887946144c N°2696 - Upgrade ArchiveTar to v1.4.9 (PHP 7.4 compatibility) 2020-01-14 10:35:53 +01:00
Molkobain
cc887c29fd N°2696 - Upgrade SCSSPHP to v1.0.6 (PHP 7.4 compatibility) 2020-01-14 10:35:53 +01:00
Molkobain
460836852e N°2696 - Upgrade SwiftMailer to v5.4.12 (Allow explicit tls1.0, tls1.1, tls1.2 for startTLS) 2020-01-14 10:35:53 +01:00
Eric
208d7ee7ba N°2093 - ApplyStimulus return true when stimuli is not applicable 2020-01-14 10:27:55 +01:00
Eric
3d92b73ae5 :globe-with-meridian: changed filesystem into files for itop-core-update 2020-01-14 10:14:03 +01:00
Stephen Abello
deddb0824b N°2315: Forgot password sent page needed stylization 2020-01-14 09:26:58 +01:00
Vladimir Kunin
3718899663 🌐 Update Russian translations for 2.7.0-beta 2020-01-13 17:52:15 +01:00
Pierre Goiffon
7f30d74f30 N°2269 Update Font Awesome to 5.12.0 2020-01-13 10:47:57 +01:00
Eric
21199fce34 N°2240 - Supportability - Maintenance mode exit on MTP or core update error 2020-01-10 15:32:29 +01:00
Pierre Goiffon
ad821e7d9c N°2651 rollback gitignore for lib tests dirs
Too dangerous ! We'll work properly on this but for 2.8
2020-01-10 15:23:15 +01:00
Eric
881fc2a1de N°2240 - Supportability - Maintenance mode exit on MTP or core update error 2020-01-10 14:14:20 +01:00
Vincent Dumas
44ee6baddb N°2675: Fix AdminTools DataSynchro creation
User with a profile enabling write access on the group id="AdminTools" was not able to create a DataSynchro also it should have been.
2020-01-09 16:07:47 +01:00
Federico Lazcano
42d782740e Paste error! 2020-01-09 10:05:22 +01:00
Federico Lazcano
cf16229948 🌐 Typos and new translations in ES CR 2020-01-09 10:05:22 +01:00
Federico Lazcano
a25427f4c6 Change from alias to real name
Sorry @Molkobain i changed my mind :-|
2020-01-09 10:01:03 +01:00
Federico Lazcano
04b2f7c836 🌐 Added ES CR translations 2020-01-09 09:28:36 +01:00
Molkobain
0f917af55a 👥 Add @lazki to our contributors list. Thanks! 👏 2020-01-09 09:12:27 +01:00
Federico Lazcano
daaed4696e 🌐 Typo in ES CR Translation 2020-01-09 09:08:34 +01:00
Pierre Goiffon
5f52c273d9 N°2329 PHP 7.4 compat : update setup requirements
This PHP version should be ok : we will give it a try during the beta program
2020-01-09 09:05:24 +01:00
Molkobain
b8d35e4783 👥 Add Guy Couronné (@GurneyHallack) to our contributors list! 2020-01-08 19:53:12 +01:00
Molkobain
149dff4b4d N°2313 - Markup extensibility: Add markup hooks on BrowseBrick and ManageBrick tables 2020-01-08 19:48:45 +01:00
Molkobain
f235e0cd66 Update copyright 2020-01-08 19:48:45 +01:00
Pierre Goiffon
e47e02932a N°2329 PHP 7.4 compat : fix warnings in TCPDF
Integrate last TCPDF fork version (6.3.2)
2020-01-08 17:50:51 +01:00
Eric
4544bba652 N°2240 - Supportability - Maintenance mode (setup CRON message) 2020-01-08 17:29:53 +01:00
Eric
9445e12254 MSIE 11 minimum 2020-01-08 17:23:36 +01:00
Eric
951945a607 N°2240 - Supportability - Maintenance mode (Better REST/Export message) 2020-01-08 17:17:34 +01:00
Eric
34f8fff01c Fetch() ignore row when sub-class does not exist 2020-01-08 16:38:11 +01:00
Stephen Abello
8d45e48ce1 🥅 N°1192 Portal: Increase navigation rules checks robustness 2020-01-08 15:31:19 +01:00
Eric
ed26f1cecc Fix menu creation flags 2020-01-08 15:10:10 +01:00
Molkobain
bc298afda3 Merge remote-tracking branch 'origin/master' into develop
# Conflicts:
#	datamodels/2.x/combodo-db-tools/cs.dict.combodo-db-tools.php
#	datamodels/2.x/combodo-db-tools/da.dict.combodo-db-tools.php
#	datamodels/2.x/combodo-db-tools/datamodel.combodo-db-tools.xml
#	datamodels/2.x/combodo-db-tools/db_analyzer.class.inc.php
#	datamodels/2.x/combodo-db-tools/dbtools.php
#	datamodels/2.x/combodo-db-tools/de.dict.combodo-db-tools.php
#	datamodels/2.x/combodo-db-tools/default.css
#	datamodels/2.x/combodo-db-tools/default.scss
#	datamodels/2.x/combodo-db-tools/en.dict.combodo-db-tools.php
#	datamodels/2.x/combodo-db-tools/es_cr.dict.combodo-db-tools.php
#	datamodels/2.x/combodo-db-tools/fr.dict.combodo-db-tools.php
#	datamodels/2.x/combodo-db-tools/hu.dict.combodo-db-tools.php
#	datamodels/2.x/combodo-db-tools/it.dict.combodo-db-tools.php
#	datamodels/2.x/combodo-db-tools/ja.dict.combodo-db-tools.php
#	datamodels/2.x/combodo-db-tools/module.combodo-db-tools.php
#	datamodels/2.x/combodo-db-tools/nl.dict.combodo-db-tools.php
#	datamodels/2.x/combodo-db-tools/pt_br.dict.combodo-db-tools.php
#	datamodels/2.x/combodo-db-tools/ru.dict.combodo-db-tools.php
#	datamodels/2.x/combodo-db-tools/tr.dict.combodo-db-tools.php
#	datamodels/2.x/combodo-db-tools/zh_cn.dict.combodo-db-tools.php
2020-01-08 12:03:55 +01:00
odain
1fc290587c N°2154: Fix security breach (scratch install usecase) 2020-01-08 10:10:49 +01:00
Molkobain
77fa02fcf9 PHPDoc and warnings suppression 2020-01-08 10:06:03 +01:00
Molkobain
d445551031 N°1986 - Fix regression introduced in b91183e9, creation form should never be read-only 2020-01-08 10:05:33 +01:00
Molkobain
ebfe9da464 N°2306 - Security hardening 2020-01-07 20:59:09 +01:00
odain
fdd79e91f0 N°2154: Fix security breach (scratch install usecase) 2020-01-07 17:44:39 +01:00
Molkobain
94a09493b0 N°2306 - Security hardening (BC break for some portal extensions, see migration notes) 2020-01-07 17:40:03 +01:00
Molkobain
56dbbb09dc Fix dependencies between modules 2020-01-07 17:00:19 +01:00
Pierre Goiffon
f019e05af5 N°2042 deprecated chrono extensivity 2020-01-07 16:07:25 +01:00
bruno DA SILVA
838c4f123c 👌 peer review
mostly coding convention,

thanks @molkobain
2020-01-07 15:34:27 +01:00
bruno DA SILVA
2043010aad N°2293 - API OnDBUpdate and AfterUpdate need modified fields and previous data
- add a getter for the protected property DBObject::$m_aChanges
2020-01-07 15:05:29 +01:00
bruno DA SILVA
cda18b950e N°524 - Password policy
- removal of a forgotten console.debug
2020-01-07 14:28:20 +01:00
Molkobain
acf28ca4aa N°2306 - Security hardening 2020-01-07 13:54:16 +01:00
Eric
864ded2102 Refactor Core Update (+8 squashed commit)
Squashed commit:

[b907bb759] Refactor Core Update

[5da2473aa] Refactor Core Update

[3fce45615] Refactor Core Update

[5f050a828] Refactor Core Update

[4b9b85174] Refactor Core Update

[f637ed358] Refactor Core Update

[56543edce] Refactor Core Update

[7f06900ef] Refactor Core Update
2020-01-07 10:00:14 +01:00
Eric
5cdc58846b Allow browsing developed OQL class tree 2020-01-07 10:00:14 +01:00
Eric
45cd96eb0d More informative message when class does not exist 2020-01-07 10:00:14 +01:00
Eric
c8335499fd Allow browsing developed OQL class tree 2020-01-07 10:00:14 +01:00
Eric
7f3efe59ab Refactor Core Update (+3 squashed commit)
Squashed commit:

[e1cbfe93f] Refactor Core Update

[41ec2adf7] Refactor Core Update

[ca6cefca3] Refactor Core Update
2020-01-07 10:00:13 +01:00
bruno DA SILVA
69551378c2 n°524 - password policy
- ajax message is now translated in the user's language
 - prevent the form submission if the password policy is not respected
2020-01-06 18:33:47 +01:00
odain
f3fd4bde87 💚 2020-01-06 16:09:41 +01:00
bruno DA SILVA
c115f64cb5 N°2154 - Security breach 2020-01-06 15:31:31 +01:00
Stephen Abello
ee61c1e8fb N°524: Fix style for inputs' feedback on "change password" page 2020-01-06 13:51:40 +01:00
bruno DA SILVA
e716fb118b N°2574 - enable Password expiry 2020-01-06 12:14:34 +01:00
bruno DA SILVA
b0c76346a5 N° 524 - password policy
better colors for : "change pwd" page: add feedback during the password typing
2020-01-06 11:45:48 +01:00
Pierre Goiffon
56807fd941 Person sample file : fix Descartes email
Fix typo introduced in 906e309791
2020-01-06 11:17:57 +01:00
Molkobain
b56f248b79 👥 Add Pimkie to our contributors list (BR / IT translations) 2020-01-06 09:50:15 +01:00
bruno DA SILVA
7a85201a07 524 - password policy
"change pwd" page: add feedback during the password typing
2020-01-06 09:31:28 +01:00
Purple Grape
97ebffd5fb improved chinese translations
1 improved chinese translations
2 fix some missing enries
3 correct line number against english language
2020-01-06 08:43:25 +01:00
Eric
46c239c211 typo 2020-01-03 16:40:49 +01:00
Vincent Dumas
906e309791 Replace Erri De Luca by René Descartes 2020-01-03 11:10:44 +01:00
bruno DA SILVA
4ad1ca0fc6 add option classmap-authoritative to composer.json 2020-01-02 14:19:00 +01:00
bruno DA SILVA
015955f396 N°2306 - Security hardening 2019-12-30 17:31:50 +01:00
Pierre Goiffon
9bee1905c8 N°2329 PHP 7.4 compat : remove get_magic_quotes_gpc/get_magic_quotes_runtime calls
Methods are now deprecated and since PHP 5.4 were always returning false
2019-12-24 17:30:12 +01:00
Pierre Goiffon
8ab157eae4 N°2329 PHP 7.4 compat, AttributeDefinition : fix visibilities of members called by AttributeDefinition::__construct
Not enough to get rid of child classes constructors though :/
2019-12-24 15:28:36 +01:00
Molkobain
17978b829b Internal: Simplify classes FQN 2019-12-24 15:08:45 +01:00
Molkobain
4ddb23cd7c N°2654 - Portal: Fix filter on external key when coming from filter brick 2019-12-24 15:08:45 +01:00
Pierre Goiffon
e27eb7419e N°2329 PHP 7.4 compat, AttributeDefinition : add __construct() to child classes
Shouldn't be necessary but if not present PHP 7.4.0/7.4.1 is crashing when executing new Attribute...(...)
2019-12-24 12:22:49 +01:00
Pierre Goiffon
64ef572429 🎨 AttributeDefinition : some little inspections fixes, and fix misordered function modifiers
According to PSR, we should use public static and not static public
See https://www.itophub.io/wiki/page?id=latest%3Acustomization%3Acoding_standards
2019-12-24 12:22:49 +01:00
Pierre Goiffon
2f81e0fd6f N°2329 PHP 7.4 compat : remove deprecated array with curly braces 2019-12-23 18:44:52 +01:00
odain
987f1f7dbf N°2568 - Log_KPI viewer in the console - Fix broken links 2019-12-23 17:17:10 +01:00
Pierre Goiffon
b53c91f7f3 Merge remote-tracking branch 'origin/master' into develop
# Conflicts:
#	Jenkinsfile
#	setup/setuputils.class.inc.php
2019-12-23 11:34:55 +01:00
Pierre Goiffon
13d31ac211 utils::GetDefaultUrlAppRoot : make comparison case insentitive, add a test 2019-12-23 11:06:29 +01:00
Pierre Goiffon
57ae29cf2f \SetupPage::error : remove "error" title as existing calls already add it 2019-12-23 09:54:07 +01:00
Pierre Goiffon
0b3895e39e Core update : fix CanUpdateCore result never displayed on server with warning enabled
Was caused by a call to :
\Combodo\iTop\FilesInformation\Service\FilesInformationUtils::Scan
With path set to ''. Made from :
\Combodo\iTop\FilesInformation\Service\FilesInformation::CanUpdateCore
2019-12-20 18:37:51 +01:00
Pierre Goiffon
0d231d9b94 N°2651 Remove lib test files from index 2019-12-20 17:07:20 +01:00
Molkobain
27a6abeeb3 Internal: Add Benjamin to the sample data to welcome him! 2019-12-20 12:21:02 +01:00
Pierre Goiffon
c75e6960a7 N°2651 Remove lib test files from index 2019-12-20 11:57:18 +01:00
Pierre Goiffon
4766ca3fd0 N°2650 fix run_query error handling incompatible with PHP < 7.3.0 2019-12-20 09:21:00 +01:00
odain
523dd97eca N°2570 Update iTop license list 2019-12-19 16:40:17 +01:00
bruno DA SILVA
c09bd2bfc6 2626 - log modularity: filterable logs using minimal log level per channel
🔊 Adding log level Trace, which is not logged by default (as for Debug)
2019-12-19 11:17:18 +01:00
Molkobain
bd662eaf19 Update README to add 2.7.0-beta section 2019-12-18 16:47:11 +01:00
Pierre Goiffon
ff75ecfe27 💄 Setup : add styling on prerequisites summary title 2019-12-18 11:12:21 +01:00
Pierre Goiffon
54f8b74383 📝 restore WizardStep documentation
Do not add documentation in a doc block containing @copyright O:)
2019-12-18 11:05:41 +01:00
Pierre Goiffon
18a506673f 💄 Setup : restore label{ cursor:pointer;} 2019-12-18 10:44:28 +01:00
Pierre Goiffon
a108be8517 N°330 Fix first column not centered when creating attachment on new ticket 2019-12-18 09:56:33 +01:00
Eric
3e57c3b1e9 N°2249 - Supportability - Updater module (application upgrade) 2019-12-18 09:45:34 +01:00
Stephen Abello
f18e27a183 N°2314 Setup progress bar is now cuter (following 01cb88a) 2019-12-18 09:40:48 +01:00
Pierre Goiffon
358efb0f2f N°2518 Change log level for non existent legacy log file when trying to rename 2019-12-18 09:28:11 +01:00
bruno DA SILVA
723fc917f1 🐛 change back to an authoritative autoloader 2019-12-18 09:25:35 +01:00
Pierre Goiffon
01f34eea29 N°330 Attachments display as table : portal. Table is now responsive, attachment section is collapsable (collapsed by default) 2019-12-17 18:14:21 +01:00
bruno DA SILVA
705d941979 ⬆️ Upgrading dependencies 2019-12-17 17:43:18 +01:00
Stephen Abello
691acb45e6 N°2314 2 css variables were not overridable 2019-12-17 15:23:02 +01:00
Pierre Goiffon
97e4ff30ff N°330 attachments size column : right align (both on console and portal)
Allows easier comparison to see bigger files
2019-12-17 15:12:28 +01:00
Pierre Goiffon
34c76c735a N°330 Attachments display as table : portal. Various improvements
* update CSS for table layout (vertical align, change text-align)
* tooltip : fix max size was not used anymore (tooltip was removing the style attributes)
* tooltip : fix tooltip always available
* delete button background color set to same as validate button
* remove "type" column
* reduce attachment line height
2019-12-17 15:08:22 +01:00
Pierre Goiffon
47d8e35639 N°330 Improve \ormDocument::GetFormattedSize
* Fix typo in method name (many thanks @jbostoen !)
* Use \utils::BytesToFriendlyFormat
2019-12-17 15:08:22 +01:00
odain
d4dc739b30 Finalize license update file 2019-12-17 14:56:13 +01:00
acognet
b84859b07e optimizing the display of the label in FieldsExpression 2019-12-17 13:07:21 +01:00
bruno DA SILVA
3f154fa765 2626 - log modularity: filterable logs using minimal log level per channel
🐛 logs are no more written twice.
2019-12-17 12:33:34 +01:00
Eric
f31e32d7a9 N°2249 - Supportability - Updater module (disable submit when no file provided) 2019-12-17 11:53:29 +01:00
Molkobain
1589535a45 Internal: Add automatic refresh of the maintenance page every 30s to redirect user to iTop when done 2019-12-17 11:48:27 +01:00
odain
53353ec9e1 Merge branch 'develop' of https://github.com/Combodo/iTop into develop 2019-12-17 11:44:17 +01:00
odain
a601b1c59a release: css part of community-licenses.xml 2019-12-17 11:44:13 +01:00
odain
e093abcb2b release: lib part of community-licenses.xml 2019-12-17 11:28:05 +01:00
Molkobain
01cb88a661 N°2314 Regression: Add progress bar color change while on going to show user it's not stucked 2019-12-17 11:15:00 +01:00
Molkobain
5ef32b6b31 N°2314 Regression: fix invisible icons due to wrong FontAwesome calls 2019-12-17 11:09:10 +01:00
Stephen Abello
ba1c719568 N°2314 Regression: fix invisible icons due to wrong FontAwesome calls 2019-12-17 10:55:05 +01:00
Eric
0507e4f4a8 🔖 version 2.7.0-beta 2019-12-17 10:35:15 +01:00
Eric
60eb312e68 🔖 version 2.7.0-beta 2019-12-17 10:28:13 +01:00
Eric
044a8926b3 🔖 version 2.7.0-beta 2019-12-17 10:25:28 +01:00
odain
acf8c9d49e release: js part of community-licenses.xml 2019-12-17 10:22:07 +01:00
Eric
d99e79eb3f 🔖 xml version 1.7 2019-12-17 10:22:03 +01:00
Eric
843c8ccd38 🔖 version 2.7.0 2019-12-17 10:18:15 +01:00
Eric
d45326606d 🌐 Update translations 2019-12-17 10:09:10 +01:00
Molkobain
5886d038e3 Regression: Fix iTop Hub connector not being installed (caused by dd5ac38dd4) 2019-12-17 09:50:27 +01:00
Pierre Goiffon
8fed7c7005 💄 Setup : TLS message style was hardcoded, get back to standard CSS classes to be aligned with the rest 2019-12-17 09:16:10 +01:00
Molkobain
604522aa61 N°2314 Regression: Work on Setup stylesheet 2019-12-16 18:07:59 +01:00
Molkobain
7af35c2d09 Internal: Improve how CSS and JS files are loaded in the DOM to optimize rendering and avoid glitches 2019-12-16 17:53:43 +01:00
Stephen Abello
87497eb491 N°2314 Regression: extracted setup's stylesheet in its own file and pimped it up 2019-12-16 17:05:36 +01:00
Pierre Goiffon
434ed0dd4e N°330 Attachments display as table : portal 2019-12-16 15:51:56 +01:00
Pierre Goiffon
473a55bde6 🎨 bsfileuploader : code formatting 2019-12-16 15:25:32 +01:00
Pierre Goiffon
0b65b36e74 N°330 Attachments : add attributes in Attachment object
* creation date
* external key to creator User
2019-12-16 15:25:32 +01:00
Pierre Goiffon
4aeb78ccac N°330 Attachments display as table : console 2019-12-16 15:25:31 +01:00
Pierre Goiffon
21d5de1756 Fix run_query throwing exception when inccorect query and no suggestions returned 2019-12-16 15:07:26 +01:00
Stephen Abello
797893d317 N°2314 Regression: fix crash on setup ⌨️ 🐒 2019-12-16 14:16:29 +01:00
Eric
dd5ac38dd4 N°2249 - Supportability - Updater module (application upgrade) 2019-12-13 17:28:35 +01:00
Eric
2741a446ea Integrate database integrity module 2019-12-13 17:28:08 +01:00
Molkobain
da3d886bd7 N°2618 - Fix missing scroll bar in DataModel Viewer for class with large number of attributs 2019-12-12 16:41:09 +01:00
Stephen Abello
ad40e02fee N°2314 Forgot to commit these changes with 611e82 🙈 2019-12-12 15:55:06 +01:00
Vincent Dumas
7cc63e21dd Prevent trigger without friendlyname
Make 'description' mandatory as it is used as friendly name, and a blank value is not clickable in the UI
2019-12-12 15:47:39 +01:00
Stephen Abello
611e828d1a N°2314 Introduce custom themes for iTop's console 2019-12-12 15:46:03 +01:00
odain
3abcd59b03 remove redundant test on log api 2019-12-12 14:41:26 +01:00
odain-cbd
48f4cd8943 Merge pull request #101 from Combodo/feature/faf_log_modularity
Feature/faf log modularity
2019-12-12 14:44:02 +01:00
odain
abd5e27c2e fix and complete testcase 2019-12-12 14:22:49 +01:00
Eric
ccb3a21c68 N°2595 - Reorganize/rename admin. console menus (hide empty sub-menus) 2019-12-12 10:20:29 +01:00
Molkobain
aa060746d7 N°2009 - Fix non editable dashboard when wrong attribute code used in its definition 2019-12-12 09:50:13 +01:00
odain
6ec441e501 peer review: added tests but not passed yet 2019-12-12 08:43:01 +01:00
Molkobain
52d3d8cfe7 Internal: PHPDoc, warnings suppression and typos 2019-12-11 20:54:45 +01:00
Molkobain
081ba68af4 N°2634 - Fix non editable dashlets in dashboards 2019-12-11 20:54:45 +01:00
odain
38d5889979 log kpi: class name added to next page buttons in order to use them in itop-log-mgt 2019-12-11 17:58:49 +01:00
Molkobain
5b4808c378 Internal: PHPDoc 2019-12-11 15:58:47 +01:00
Molkobain
2af22d3387 N°2060 Fix regression introduced during migration (iPortalUIExtension extensions not working) 2019-12-11 15:54:01 +01:00
Eric
7c1a8c90da N°2595 - Reorganize/rename admin. console menus 2019-12-11 13:59:31 +01:00
Molkobain
e7726a17db N°2630 - Portal: Fix wrong "apply stimulus" form being used in a branch of classes 2019-12-10 21:51:28 +01:00
Molkobain
57da9a848d Internal: Optimize regexp to remove warning 2019-12-10 21:51:28 +01:00
Molkobain
464ee46631 Internal: Refactor a small piece of code for better readability 2019-12-10 21:51:28 +01:00
Molkobain
46358b6e36 N°1982 - Fix resolution date not updated as expected when concurrent access from both portal and admin. console 2019-12-10 21:51:28 +01:00
Pierre Goiffon
46d6779562 🎨 utils : some code formatting + 1 @var 2019-12-10 17:57:55 +01:00
bruno DA SILVA
ea708e1e05 995 - Searching in OQL, URs with a particular request template field value
added AllowDelete in order to bypass the user's rights
2019-12-10 16:59:44 +01:00
Eric
374946505a N°2381 - Not possible to create a ticket in "resolved" with lnk objects 2019-12-10 15:30:53 +01:00
Pierre Goiffon
18db31f138 Log : rename config parameter from 'min_log_level' to 'log_level_min' 2019-12-10 09:46:42 +01:00
Pierre Goiffon
332c6eb33c log : factorize level & context 2019-12-10 09:39:46 +01:00
bruno DA SILVA
e5c49e3bd4 filterable logs using min_log_level optionnaly per channels 2019-12-10 09:03:14 +01:00
Molkobain
60769dc4b7 Internal: Add Dimitri to the sample data to welcome them! 2019-12-09 16:15:56 +01:00
Pierre Goiffon
9e652ef214 Update iPortalUIExtension param (not using Silex anymore but Symfony) 2019-12-09 16:11:29 +01:00
Pierre Goiffon
d2825c1b24 iTop Hub Connector : remove installation.xml
Was commited by mistake (duplicate of datamodels/2.x/installation.xml)
2019-12-09 16:02:39 +01:00
Eric
8482be7068 N°2623 - Fix setup request error 2019-12-09 14:56:42 +01:00
Eric
9dc56b727e N°1987 - Fix search equals 0 for integer fails 2019-12-06 17:01:46 +01:00
Eric
c6759220b9 🎨 clean warnings and add KPI in ajax.render.php 2019-12-06 15:42:03 +01:00
Pierre Goiffon
470af54acb Add some HTML in errors thrown by \MetaModel::DBCheckFormat 2019-12-05 17:56:42 +01:00
Eric
344f74f444 N°1213 - Allow NOT IN SELECT in OQL syntax - Fix UNION queries 2019-12-05 17:33:47 +01:00
Molkobain
0d1ca1bc0e N°2611 - Make itop-portal-base module mandatory during setup 2019-12-05 17:30:30 +01:00
Molkobain
d9e3684d3d Internal: Add Marie-Annette to the sample data to welcome them! 👋 2019-12-05 17:07:05 +01:00
Molkobain
e59db3f3d9 Internal: Add Alexandre, Anne-Catherine and Olivier to the sample data to welcome them! 👋 2019-12-05 15:47:46 +01:00
Molkobain
c883d618c3 N°1192 - Change default behavior for navigation rules 2019-12-05 15:02:36 +01:00
Eric
8911a9a3ed N°2381 - Not possible to create a ticket in "resolved" with lnk objects 2019-12-05 13:06:23 +01:00
Molkobain
366d2754ef N°2060 - Fix regression making url pointing to the portal not working in notification anymore 2019-12-05 12:39:28 +01:00
Molkobain
4db114f64d N°2313 - Markup extensibility: Add meta information and hooks
Admin. console:
- Class and id on object form
- Class current and target state on object transition form
- Object form mode (view/edit/create/stimulus)
- Object attributes: Attribute code, attribute definition class and raw value
- Navigation menu: Their IDs on group and items
- Actions menu: Their IDs on items

Portal:
- Object attributes: Attribute code, attribute definition class and raw value
2019-12-05 12:27:02 +01:00
Pierre Goiffon
d36340a3cd TagSet tests : use expectException method 2019-12-05 11:50:58 +01:00
Pierre Goiffon
7e6de5d8dd 🐛 \SetupUtils::builddir : avoid infinite loops 2019-12-05 10:27:22 +01:00
bruno DA SILVA
490eda4f4a n°524 - password policy
bugfix : Enter Password phrase no more lack the userName and is properly displayed
2019-12-05 09:55:44 +01:00
Eric
b5b4d70c2d N°1213 - Allow NOT IN SELECT in OQL syntax - Add unit tests 2019-12-05 09:02:11 +01:00
Eric
a74cff6902 N°1213 - Allow NOT IN SELECT in OQL syntax - Fix unit tests 2019-12-04 15:39:44 +01:00
Eric
1010274c48 N°1213 - Allow NOT IN SELECT in OQL syntax - Fix search init & code cleanup 2019-12-04 14:50:36 +01:00
Eric
c39ff13217 N°1213 - Allow NOT IN SELECT in OQL syntax - Fix search init 2019-12-04 14:40:53 +01:00
Eric
58da108e85 N°1213 - Allow NOT IN SELECT in OQL syntax 2019-12-04 14:27:02 +01:00
Eric
8b4fdb54ea N°1213 - Allow NOT IN SELECT in OQL syntax - support of UNION queries 2019-12-04 11:17:51 +01:00
Pierre Goiffon
1877cb5e93 N°2614 Fix datasynchro error when running synchro_import.php 2019-12-04 11:08:18 +01:00
bruno DA SILVA
1530b3f2ca 🐛 apc_clear_cache & opcache_reset can both be called
especially since not calling apc_clear_cache may result in invalid apcu entries...
2019-12-04 10:39:30 +01:00
Eric
4c3c5228aa N°1213 - Allow NOT IN SELECT in OQL syntax 2019-12-03 17:23:14 +01:00
Eric
3ae4ca89f4 N°1213 - Allow NOT IN SELECT in OQL syntax - support of UNION queries and "nested nested" queries 2019-12-03 17:14:53 +01:00
Eric
b415b1eeae N°1213 - Allow NOT IN SELECT in OQL syntax - support of UNION requests 2019-12-03 12:11:00 +01:00
Eric
c0ae983faa N°1213 - Allow NOT IN SELECT in OQL syntax 2019-12-03 12:11:00 +01:00
acognet
7845cbcc55 update tests 2019-12-03 12:11:00 +01:00
acognet
a33977251e N°1213 - Allow NOT IN SELECT in OQL syntax 2019-12-03 12:11:00 +01:00
odain
b0d668b124 N°1213 - Allow NOT IN SELECT in OQL syntax - add unit tests 2019-12-03 12:11:00 +01:00
odain
b0856c1abf fix HTMLDOMSanitizerTest due to merge 2019-12-03 12:10:26 +01:00
Pierre Goiffon
2bffa3cf17 N°2615 PHP versions setup requirements/warnings 2019-12-03 11:54:13 +01:00
odain
5ab05c6a6a Merge branch 'develop' of https://github.com/Combodo/iTop into develop 2019-12-03 11:42:08 +01:00
odain
72af2b7cd6 comment OQL section in phpunit.dist.xml 2019-12-03 11:41:57 +01:00
Molkobain
143c0a5b07 N°2616 - Fix hyperlink placeholder not working in notifications for other portals 2019-12-03 11:39:14 +01:00
Molkobain
daf79f2324 N°2272 Fix calls to DBObjectSet::OptimizeColumnLoad() 2019-12-03 11:39:14 +01:00
odain
15d11c6c86 reomve echo that prevented phpunit execution 2019-12-03 11:26:35 +01:00
odain
b298a1fa82 fix invalid merge 2019-12-03 11:23:25 +01:00
odain
007b8147c7 fix phpunit step 2019-12-03 11:17:01 +01:00
odain
4013b76c9e Merge branch 'speedup_jenkins' into develop 2019-12-03 11:09:30 +01:00
odain
ed81391aff !y# This is a combination of 4 commits.
run OQL tests depending on jenkins param

try sth

try sth

try sth

try sth

try sth

fix parameter to run OQL tests or not

run OQL tests depending on jenkins param

try sth

try sth

try sth

try sth

try sth

fix parameter to run OQL tests or not
2019-12-03 11:02:15 +01:00
Pierre Goiffon
28818010d6 N°2558 Test for the HTMLDOMSanitizer white list 2019-12-03 10:58:21 +01:00
Eric
928c19f923 move OQL2SQL tests to another folder 2019-12-03 10:58:21 +01:00
Eric
34aa240840 🎨 Fix bad parameter init 2019-12-03 10:58:21 +01:00
Eric
6872dbd180 🎨 Fix bad parameter init 2019-12-03 10:58:21 +01:00
Pierre Goiffon
c5bea30c64 N°2329 PHP 7.4 compat : remove deprecated get_magic_quotes_gpc() function call 2019-12-03 10:58:21 +01:00
Molkobain
071a254611 N°2311 Fix focus set to sumbit button when pressing "tab" key after filing inputs 2019-12-03 10:58:21 +01:00
Molkobain
d2d203df34 💄 Increase blur effect on portal modal backdrop 2019-12-03 10:58:21 +01:00
Molkobain
e1ffdea172 N°2272 Fix call to DBObjectSet::OptimizeColumnLoad() in the portal (doesn't support "id" attribute anymore) 2019-12-03 10:08:46 +01:00
Pierre Goiffon
9abcf40df7 N°2558 Test for the HTMLDOMSanitizer white list : remove new lines
the parser gives different results depending on the PHP version
Didn't manage to get it right :
- no php.ini difference
- playing with the parser preserveWhitespace/formatOutput parser options didn't help

So we're removing new lines on both sides :/
2019-12-03 09:47:45 +01:00
Pierre Goiffon
b67dc888fe N°2558 Test for the HTMLDOMSanitizer white list 2019-12-03 08:42:25 +01:00
Eric
c7b101d169 move OQL2SQL tests to another folder 2019-12-03 08:38:57 +01:00
Eric
df5a7440a4 🎨 Fix bad parameter init 2019-12-03 08:38:57 +01:00
Eric
a59a8c0ec5 🎨 Fix bad parameter init 2019-12-03 08:38:57 +01:00
Pierre Goiffon
bf9f43da8b N°2329 PHP 7.4 compat : remove deprecated get_magic_quotes_gpc() function call 2019-12-02 13:47:44 +01:00
Molkobain
928b82a9c8 N°2311 Fix focus set to sumbit button when pressing "tab" key after filing inputs 2019-11-29 17:40:07 +01:00
Molkobain
b9008d2459 💄 Increase blur effect on portal modal backdrop 2019-11-29 17:38:20 +01:00
odain
50dddaaa9b add debug mode as param + use params in phpunit.sh 2019-11-29 16:46:59 +01:00
odain
1b168501af add a parameter to Jenkins pipeline 2019-11-29 16:37:01 +01:00
bruno DA SILVA
35a49bad60 n°524 - password policy
typos

(thanks @jbostoen)
2019-11-29 08:56:18 +01:00
Pierre Goiffon
97c1ff55e9 📝 Comment to explain why Uniqueness isn't protected by a lock 2019-11-28 17:16:01 +01:00
Molkobain
ffead92d5a N°2613 - Portal: Fix crash in object form having empty AttributeBlob field 2019-11-28 17:05:05 +01:00
Molkobain
81ea2b1fe4 Internal: Add comment on suspected dead code 2019-11-28 17:05:05 +01:00
Molkobain
9cdfe0ecb4 Internal: PHPDoc and warning suppression 2019-11-28 17:05:05 +01:00
bruno DA SILVA
0473269132 n°1617 - iTop Fence
- iTop Fence now lock user fetch/creation per login to prevent duplicates
 - iTop now provide a mean to create safe lock when used untrusted strings
 - better log message & function names
 - reduced cyclomatic complexity

(thanks @piRGoif)
2019-11-28 17:03:31 +01:00
Eric
4798bf2f79 N°2408 - Fix FromOQL() with NULL 2019-11-28 11:54:42 +01:00
bruno DA SILVA
c3c5c56dd8 n°524 - password policy
- changed translation key to be more conventional
2019-11-28 11:40:28 +01:00
bruno DA SILVA
4fb9bbb831 n°524 - password policy
- "change password" is now handled gracefully by the portal
2019-11-28 09:05:20 +01:00
bruno DA SILVA
267cdd2aee n°524 - password policy
- "password reset" workflow now handle gracefully the policy enforcement.
2019-11-28 08:52:02 +01:00
bruno DA SILVA
fe0bd1a4b8 n°524 - password policy
- translations added
 - fields are now visible in the detail view
 - minor translation modification for the User object
2019-11-28 08:52:02 +01:00
Molkobain
9fa510d2a8 Internal: PHPDoc and warning suppression 2019-11-27 20:40:39 +01:00
Molkobain
fd29986354 N°2000 - Fix blank page when displaying a synchronized object 2019-11-27 20:07:17 +01:00
Molkobain
8ec6bb4758 N°1666 - Fix missing scroll bar missing in modal window "Create a new field" from Request Template 2019-11-27 19:35:19 +01:00
Molkobain
f3306f5fb4 N°1616 - Fix truncated caselog entry with large HTML table or word 2019-11-27 19:05:37 +01:00
Molkobain
20683fdf50 N°1192 Fix transition form always redirecting to object no matter the navigation rule 2019-11-27 17:21:01 +01:00
Molkobain
603ae8c0e1 N°2272 Fix calls to DBObjectSet::OptimizeColumnLoad() in the portal (now requires ClassAlias to always be specified) 2019-11-27 17:21:01 +01:00
Eric
f1d0418e48 🐛 Fix error when no cache is configured 2019-11-27 16:02:46 +01:00
Eric
9c8c306df3 🐛 Fix DBSearch::Intersect (de-duplicate aliases) 2019-11-27 15:39:33 +01:00
Eric
d2543e9c67 🐛 Fix bad calls to OptimizeColumnLoad 2019-11-27 15:38:30 +01:00
Pierre Goiffon
55a0d910fa N°2490 MariaDB compat : changes after code review
* DEFAULT value unquoting is done with preg_replace now (clearer that we want to do a string replacement)
* DEFAULT value unquoting works even if DEFAULT is not the last keyword
* change test datasource for more readability (use double quotes when needed)
2019-11-27 11:51:47 +01:00
Pierre Goiffon
bd8144a67c 👷 Jenkins : config file is now picked by the unattended install
The problem was that we had an absolute path in the XML : changing it to the file name is sufficient ! The copy introduced in 443763de was unecessary.
2019-11-27 11:45:30 +01:00
Pierre Goiffon
004d1a7245 🎨 Rename constant 2019-11-27 10:15:24 +01:00
Pierre Goiffon
09fb99ed58 Rollback 2f431a0d : might not be a typo, we don't want to cause trouble close to a beta version O:) 2019-11-26 17:31:41 +01:00
Eric
ae8071f707 add unit tests for intersect 2019-11-26 17:24:23 +01:00
Eric
c1cf084e43 fix unit tests - Support Microsoft encoding of non breaking line in UTF-8 2019-11-26 16:32:19 +01:00
Eric
87c794b22e fix unit tests - Support Microsoft encoding of non breaking line in UTF-8 2019-11-26 15:44:17 +01:00
Molkobain
a382d6ad35 N°1192 Change "close rule" behaviour to redirect to homepage if browser doesn't let us close the window 2019-11-26 14:57:35 +01:00
Eric
2d86599a19 N°2519 - ev_timeout from "New" to "Escalated TTO" doesn't work 2019-11-26 13:55:26 +01:00
Pierre Goiffon
914971b30d 💚 Jenkins : Fix default config database name 2019-11-26 12:15:02 +01:00
Pierre Goiffon
443763de48 💚 Jenkins : copy default config after unattended install
The generated config file had too many default values, and not the wanted ones
2019-11-26 12:09:03 +01:00
Stephen Abello
ff3c7ebe54 N°971 Portal: Fix Browse brick n:n level links in tree and mosaic display 2019-11-26 11:39:25 +01:00
Stephen Abello
c0f82f25a3 N°956 Portal: Increase robustness 💪 2019-11-26 11:39:25 +01:00
Eric
f90381d412 Support Microsoft encoding of non breaking line in UTF-8 2019-11-26 08:57:47 +01:00
bruno DA SILVA
d367d2e864 n°524 - password policy
💚 fix CI regression (data provider no longer include classes with side effect)
2019-11-25 18:02:25 +01:00
bruno DA SILVA
9d20eba2ad 2574 - enable Password expiry
- Extensibility: The UserLocal now provide the fields needed for an extension to be able to properly handle the expiration of the password
2019-11-25 17:37:34 +01:00
bruno DA SILVA
863746852f n°524 - password policy
💚 fix CI : tests must be runned into a separate process in order to eliminate side effects of mocking the config
2019-11-25 16:53:04 +01:00
bruno DA SILVA
f416f994c9 n°2371 deprecate \MetaModel::EnumLinksClasses and \MetaModel::EnumLinkingClasses
- phpdoc: move title the to beginning of the block
2019-11-25 16:35:46 +01:00
bruno DA SILVA
70dfbbc15e n°524 - password policy
- The code now uses the standard extension method (using interfaces)
 - the metamodel can now filter on iModuleExtension in order to leverage extensions modularity (see MetaModel::EnumPlugins second param)
 - during the setup, there is no pawsord policy control
 - there is now a default policy
 - new (more precie) translation reflecting the default policy
 - fix CI?
2019-11-25 16:25:38 +01:00
Molkobain
85932eab98 N°1192 Fix crash with default parameters of the rule 2019-11-25 15:33:23 +01:00
Pierre Goiffon
0ee77d8c88 N°2163 DB*Tracked methods : modifications after review with Romain
Previous commit : 24eb82d1
Use \CMDBObject::SetTrackInfo
Move \CMDBObject::SetCurrentChange calls at the top most level of the stacks
Restore old behaviors that were removed in previous commit
2019-11-25 14:58:59 +01:00
Molkobain
2f2d9547b7 N°2603 - Portal: Fix crash when having comments in some parts of the XML 2019-11-25 12:38:34 +01:00
Molkobain
32b065708b N°1192 Add some ready-to-use navigation rules to the standard portal (and comments) 2019-11-25 09:45:31 +01:00
Molkobain
18285df154 Internal: Fix typo 2019-11-22 18:44:27 +01:00
Molkobain
b1b6c9f426 N°1192 Introduce navigation_rules in the end-users portal 2019-11-22 18:44:27 +01:00
Molkobain
ff884533f9 Internal: Add utils::ToCamelCase($sInput) function 2019-11-22 18:44:27 +01:00
Molkobain
417e80fe8d N°1192 Deprecate usage of <submit> and <cancel> tags in action rules 2019-11-22 18:44:27 +01:00
Pierre Goiffon
c203e6c7be Fix utils::StartsWith when needle bigger that value 2019-11-22 14:43:33 +01:00
bruno DA SILVA
730a0d1c98 n°524 - password policy
💚 fix CI : tests must be runned into a separate process in order to eliminate side effects of mocking the config
2019-11-22 14:38:36 +01:00
bruno DA SILVA
d9b374f723 n°524 - password policy
💚 fix CI regression (previous tests are sometimes incompatible with the default password policy)
2019-11-22 14:14:44 +01:00
bruno DA SILVA
b9cb692504 n°524 - password policy
bugfix: no rule does work properly
2019-11-22 12:31:14 +01:00
bruno DA SILVA
23fc4bb4f7 n°524 - password policy 2019-11-22 12:23:00 +01:00
Pierre Goiffon
4ae035dd51 🔧 Modify visual vertical guides setting 2019-11-22 11:42:43 +01:00
Pierre Goiffon
3a791162c5 setup module browsing perf improvement
When a module descriptor file is found, do not dig anymore in subdirectories
2nd fix, should be better than previous one (4042a12d reverted with 5ebc290b)
2019-11-21 17:44:04 +01:00
Pierre Goiffon
06791b06c4 Fix utils::EndsWith when needle bigger that value 2019-11-21 11:57:24 +01:00
Eric
5ebc290b94 Revert Setup : only scan necessary dirs for extensions 2019-11-21 11:37:22 +01:00
Pierre Goiffon
675221a15e N°2490 Setup/toolkit : no longer generates useless ALTER TABLE queries on MariaDB >= 10.2
* case insensitive SQL data type comparison
* some options have also case differences (example 'int(11) unsigned')
* DEFAULT 'NULL' added by MariaDB on all nullable fields
* default values are always surrounded with single quotes on MariaDB

This is a Combodo implementation of PR #91
2019-11-21 11:24:14 +01:00
Pierre Goiffon
2f431a0d14 🐛 Fix SynchroAttLinkSet.attribute_qualifier default value
Old typo (in a galaxy far, far away) : 1e688706
2019-11-21 10:44:54 +01:00
Molkobain
fd4e41950c N°2092 Portal: Fix missing scrollbar in tall form modals 2019-11-20 15:41:11 +01:00
Molkobain
41d5ae704a PHPDoc 2019-11-20 15:41:11 +01:00
Molkobain
83fc069bf4 Portal: Improve callback calls in CombodoPortalToolbox 2019-11-20 15:41:11 +01:00
Pierre Goiffon
32c5cd245b N°2533 Check modules manual install dir on Setup for iTop products 2019-11-20 12:04:54 +01:00
Molkobain
a259be9033 N°2311 Fix focus set to the "login" input field when pressing "tab" key 2019-11-20 12:00:52 +01:00
Molkobain
fbbdee242a Portal: Update code to use the CombodoPortalToolbox.OpenModal() helper 2019-11-20 11:38:42 +01:00
Molkobain
4a12635ea5 Portal: Introduce "CombodoPortalToolbox", helpers to ease JS manipulations especially through the iPopupMenuExtension.
- CombodoPortalToolbox.CloseAllModals() : Close all modal on the page
- CombodoPortalToolbox.OpenUrlInModal(sTargetUrl, bCloseOtherModals) : Open an URL in a modal, typically opening an object form
- CombodoPortalToolbox.OpenModal(oOptions) : Generic method to open modals in the portal with various options
2019-11-20 11:37:39 +01:00
Molkobain
db7278e9c1 🐛 Fix compiler crashing on setup due to coment in XML 2019-11-19 17:59:20 +01:00
Molkobain
10056aa4ca ✏️ Fix typos in comments 2019-11-19 17:33:07 +01:00
Pierre Goiffon
bb566df432 📝 WizardSteps documentation v2
With an ascii art schema
Thanks to http://asciiflow.com/
2019-11-19 16:31:26 +01:00
Pierre Goiffon
4042a12d39 Setup : only scan necessary dirs for extensions
We were browsing the whole hierarchy but only the root module dir was needed
This could be slow (especially when developing with a .git dir)
2019-11-19 15:27:06 +01:00
Pierre Goiffon
5ae4f9ade8 📝 WizardSteps documentation 2019-11-19 15:21:27 +01:00
Molkobain
1636f9839c Updating Symfony lib and dependencies: forgot a few files + composer.lock 2019-11-18 18:08:40 +01:00
Molkobain
c76cccd2e7 Updating Symfony lib and dependencies:
Package operations: 2 installs, 23 updates, 0 removals
  - Updating psr/log (1.1.0 => 1.1.2)
  - Updating symfony/debug (v3.4.30 => v3.4.35)
  - Updating symfony/console (v3.4.30 => v3.4.35)
  - Updating symfony/dotenv (v3.4.30 => v3.4.35)
  - Updating symfony/routing (v3.4.30 => v3.4.35)
  - Updating symfony/finder (v3.4.30 => v3.4.35)
  - Updating symfony/filesystem (v3.4.30 => v3.4.35)
  - Installing symfony/polyfill-util (v1.12.0)
  - Installing symfony/polyfill-php56 (v1.12.0)
  - Updating symfony/http-foundation (v3.4.30 => v3.4.35)
  - Updating symfony/event-dispatcher (v3.4.30 => v3.4.35)
  - Updating symfony/http-kernel (v3.4.30 => v3.4.35)
  - Updating symfony/config (v3.4.30 => v3.4.35)
  - Updating symfony/dependency-injection (v3.4.30 => v3.4.35)
  - Updating symfony/class-loader (v3.4.30 => v3.4.35)
  - Updating symfony/cache (v3.4.30 => v3.4.35)
  - Updating symfony/framework-bundle (v3.4.30 => v3.4.35)
  - Updating twig/twig (v1.42.2 => v1.42.4)
  - Updating symfony/twig-bridge (v3.4.30 => v3.4.35)
  - Updating symfony/twig-bundle (v3.4.30 => v3.4.35)
  - Updating symfony/yaml (v3.4.30 => v3.4.35)
  - Updating symfony/stopwatch (v3.4.30 => v3.4.35)
  - Updating symfony/var-dumper (v3.4.30 => v3.4.35)
  - Updating symfony/web-profiler-bundle (v3.4.30 => v3.4.35)
  - Updating symfony/css-selector (v3.4.30 => v3.4.35)
2019-11-18 18:04:32 +01:00
Eric
532eb466a1 N°1436 - Access control updated for grant_by_profile categories of classes -
Fix access to internal classes from the core engine
2019-11-18 15:36:42 +01:00
Pierre Goiffon
e8879a0455 🎨 Code formatting 2019-11-18 15:29:03 +01:00
Pierre Goiffon
ef5b4e212c N°2371 deprecate \MetaModel::EnumLinksClasses and \MetaModel::EnumLinkingClasses 2019-11-18 10:20:18 +01:00
Pierre Goiffon
24eb82d140 N°2361 Deprecate DB*Tracked methods
* update methods PHPDoc
* DBInsertTracked update callers
* DBInsertTrackedNoReload update callers
* DBUpdateTracked update callers
* DBDeleteTracked update callers
2019-11-15 17:56:04 +01:00
Pierre Goiffon
cdc8edb56b Fix backup regression "Undefined class constant 'DEFAULT_MODULE_SETTING_TIME'"
Was introduced in PR #89, woops
2019-11-15 16:44:38 +01:00
Pierre Goiffon
7235c63445 Abstract implementation for iScheduledProcess (#89)
* 📝 little PHPDoc in BackupExec
* ♻️ Create a extendable implementation of iScheduledProcess
* create AbstractWeeklyScheduledProcess
* move schedule methods to the new abstract class
* create ProcessInvalidConfigException
* in cron.php skip abstract class
2019-11-15 14:41:00 +01:00
Pierre Goiffon
fd3b33b04b N°2586 Test for iTopDesignFormat 2019-11-14 18:07:17 +01:00
Pierre Goiffon
e8815e5653 N°1283 Add migration script 2019-11-14 18:04:22 +01:00
Pierre Goiffon
551b9a3b76 \MFDocument::saveXML : $options were not passed to the callee 2019-11-14 18:04:22 +01:00
bruno DA SILVA
1c6b639992 n°1617 - iTop Fence
various improvement both in iTop and in the extension.
2019-11-14 17:02:52 +01:00
bruno DA SILVA
6fb7587d95 🔧 write the tooling methods enabling migration to/from iTop 2.7 2019-11-14 16:59:08 +01:00
Eric
3953e74cb4 🎨 refactor approot 2019-11-14 15:43:29 +01:00
Pierre Goiffon
a8f616bba7 N°2577 Setup : remove prefix for table prefix collapsible section 2019-11-14 14:46:58 +01:00
bruno DA SILVA
560eb5e071 🔧 write the tooling methods enabling migration to/from iTop 2.7 2019-11-14 12:15:30 +01:00
Eric
c665bb4761 💚 Fix unit tests 2019-11-14 09:37:39 +01:00
Denis Flaven
36584092e5 (Experimental) Export a DBSearch as an array/JSON structure. 2019-11-13 18:03:58 +01:00
Eric
30430bb7dc N°2135 - Setup callbacks for MTP 2019-11-13 17:33:56 +01:00
Eric
fdf5cff12a N°2135 - Setup callbacks for MTP 2019-11-13 15:45:33 +01:00
Eric
4816b2b0fe N°2311 - Authentication extensibility in iTop (login on specific pages and traces) 2019-11-13 15:08:34 +01:00
Eric
9c808bf2ed N°2240 - Supportability - Maintenance mode 2019-11-13 13:50:48 +01:00
Eric
7a12c2c615 N°2240 - Supportability - Maintenance mode 2019-11-13 12:00:50 +01:00
Eric
149bc9f4ef fix typo 2019-11-13 11:41:40 +01:00
Stephen Abello
b91183e9ec N°1986 Portal: Fix read-only forms from da5ccaa to work with auto-generated ones 2019-11-13 11:19:26 +01:00
Eric
b67639f9ec N°2249 - Supportability - Updater module 2019-11-13 11:08:08 +01:00
Eric
cdbcc9ce8c N°2249 - Supportability - Updater module 2019-11-13 10:42:30 +01:00
Pierre Goiffon
6c7d094921 N°2577 Setup : table prefix option is hidden also on iTop first install
Previous commit 3e785687 was hidding it only on iTop update
2019-11-12 08:54:29 +01:00
Stephen Abello
23466f6e00 📝 typo in PHPDoc 2019-11-08 17:13:15 +01:00
bruno DA SILVA
08c1f4f072 autoload rework
- bootstrap.inc.php is now included by approot.inc.php
 - remove all unescessaries includes of bootstrap.inc.php
 - in bootstrap.inc.php autoload can be bypassed using a feature flag because "why not"
2019-11-08 16:51:57 +01:00
Pierre Goiffon
1194c5c7fe 🎨 sla-computation : fix PHPDoc + format code 2019-11-08 15:30:47 +01:00
Eric
f63fb16233 N°2135 - Setup callbacks for MTP 2019-11-08 14:05:24 +01:00
Eric
a4143df36a N°2240 - Supportability - Maintenance mode 2019-11-07 16:45:52 +01:00
Pierre Goiffon
3e78568755 N°2577 Setup : table prefix option is now hidden by default
Should be used only by a few portion of users
2019-11-07 16:34:25 +01:00
Eric
9b14cd7633 N°2240 - Supportability - Maintenance mode 2019-11-07 15:23:42 +01:00
Eric
2b2488f376 N°2240 - Supportability - Maintenance mode 2019-11-07 15:21:48 +01:00
Pierre Goiffon
fd77554cb7 N°2555 action_rule : fix add_to_list regression
Loop was removed in 5c483efd but we need it !
Sample rule that needs such a loop :
				<action_rule id="N2555_multiple_results_addtolist" _delta="define">
					<source_oql>SELECT Person WHERE id > 0</source_oql>
					<presets>
						<preset id="1">add_to_list(id, contacts_list)</preset>
					</presets>
				</action_rule>
2019-11-07 14:56:39 +01:00
Eric
2ee3d27ba8 N°2240 - Supportability - Maintenance mode (revert) 2019-11-07 14:15:34 +01:00
Eric
af24f46803 N°2249 - Supportability - Updater module 2019-11-07 13:24:48 +01:00
Eric
da1684a8b9 N°2249 - Supportability - Updater module 2019-11-07 13:14:20 +01:00
Eric
5e7ae930c5 N°2240 - Supportability - Maintenance mode 2019-11-07 12:36:35 +01:00
Stephen Abello
541226356c 📝 typo in PHPDoc 2019-11-07 11:38:08 +01:00
Eric
a30345c96c N°2249 - Supportability - Updater module 2019-11-07 10:00:05 +01:00
Eric
d035130d00 N°2240 - Supportability - Maintenance mode 2019-11-07 09:16:06 +01:00
Pierre Goiffon
7d8181c44f N°2576 Fix "invalid numeric value" when inserting/updating AttributeDecimal
Was happening on certain configurations with a non EN-US user locale
2019-11-06 18:15:40 +01:00
bruno DA SILVA
45536cf957 🐛 fix regression introduced by the PR n°98
the realpath removed the trailing / wich is required
2019-11-06 10:00:55 +01:00
Stephen Abello
da5ccaaa85 N°1986 Portal: Forms with only transition buttons are now read-only 2019-11-05 12:17:54 +01:00
jbostoen
7c773991e7 Version 20191104-1550
* fix setup crashing due to realpath() returning lowercase path on Windows
2019-11-05 08:55:41 +01:00
bruno DA SILVA
bf976e5b8f typo (bis)
ahhh!
2019-11-04 15:07:47 +01:00
bruno DA SILVA
d9ad3f5e98 typo & unused variable removal
thank you @Hipska !
2019-11-04 15:02:19 +01:00
Eric
9054dcb9ff N°2517 - Supportability : system report (user name) 2019-11-04 12:06:49 +01:00
bruno DA SILVA
57116ef054 1627 - Ticket ref sometimes duplicate
This code is a drop in replacement based on  an abstract counter based on an abstract keyValue store.
The counter can be
 - class based (in this case the counter is initialized on max(id) + 1
 - key based (in this case the counter starts at 0)

Important: on both cases the counter is no more kept aligned with the primary key.

This lead to a MySQL8 compatible implementation.
2019-11-04 11:50:36 +01:00
bruno DA SILVA
c6f5b8b1f9 1627 - Ticket ref sometimes duplicate
This code is a drop in replacement based on  an abstract counter based on an abstract keyValue store.
The counter can be
 - class based (in this case the counter is initialized on max(id) + 1
 - key based (in this case the counter starts at 0)

Important: on both cases the counter is no more kept aligned with the primary key.

This lead to a MySQL8 compatible implementation.
2019-11-04 11:50:36 +01:00
Pierre Goiffon
9e015ba59a 📝 UI better log on catch 2019-11-04 09:22:43 +01:00
Pierre Goiffon
6144cfad3d 📝 Link between Dict::Format and TemplateString 2019-10-31 10:35:48 +01:00
Stephen Abello
3844a18b86 N°971 Portal: Allow n:n links for Browse Brick's levels 2019-10-30 16:41:58 +01:00
Stephen Abello
e88c6e9583 📝 typo in PHPDoc 2019-10-30 16:41:58 +01:00
Pierre Goiffon
6793fb2a35 N°2293 update PHPDoc on callbacks 2019-10-30 16:26:30 +01:00
bruno DA SILVA
4834c326aa 2498 - restrict access to assets into env-*
- allow static html into extensions/ and datamodels/
 - allow direct access to php into env-* for legacy code taht do not use exec.php
2019-10-30 15:46:33 +01:00
Pierre Goiffon
e6167adefd N°2518 ACE Editor : SQL mode 2019-10-30 10:11:33 +01:00
Pierre Goiffon
a8c3756ba7 Rename licenses file
Fix typo in file name
2019-10-30 10:11:33 +01:00
Pierre Goiffon
34b47f0239 N°2518 update licenses to reflect ACE editor moved from itop-config to iTop core 2019-10-30 10:11:33 +01:00
bruno DA SILVA
0d13d9eabe 2498 - restrict access to assets into env-*
- allow static content within datamodels/ and extensions/ (reason: the setup make use of images within this directory)
 - simplified .htaccess and web.content generation during the compilation
 - it now also allow fonts
2019-10-30 09:44:28 +01:00
Pierre Goiffon
358adb2109 📝 Some PHPDoc complement 2019-10-28 16:19:30 +01:00
odain
92285b55b6 add few tests on OQL group by 2019-10-28 15:50:53 +01:00
Pierre Goiffon
dda91be6d1 N°2555 action_rules : an invalid rule won't prevent anymore others to execute
This blocking scenario was added in 5c483efd
2019-10-25 15:56:26 +02:00
Eric
bec4dbafd2 N°2315 - Login screen extensibility API refactor 2019-10-25 14:35:24 +02:00
Eric
dcb46990c2 N°1436 - Search retrieve users belonging to not allowed Org 2019-10-25 10:31:47 +02:00
Pierre Goiffon
fe03342b6f 🌐 Fix typo
SF#1812, many thanks Lars Scheibling !
2019-10-25 09:37:22 +02:00
Eric
ee037acd34 N°2315 - Login screen extensibility API refactor 2019-10-25 08:32:29 +02:00
Pierre Goiffon
d4a696cb6b N°2555 Specific exception for invalid action_rules 2019-10-24 18:05:58 +02:00
Pierre Goiffon
5c483efd15 N°2555 action_rule performance
* do not execute scope_oql that have no conditions
* pick the first result only
2019-10-24 17:24:09 +02:00
Pierre Goiffon
9aeba1df9b N°2555 New \DBSearch::GetFirstResult method 2019-10-24 17:24:09 +02:00
bruno DA SILVA
e98683ae1c fix regression introduced in the carbon branch 2019-10-24 16:19:07 +02:00
Eric
c552e73d20 N°2315 - Login screen extensibility API refactor 2019-10-24 14:56:01 +02:00
Stephen Abello
1851163cee N°1881 Portal: Show confirmation dialog when closing forms with unsaved data 2019-10-24 10:51:49 +02:00
Pierre Goiffon
3667f95b7c N°2558 center is back in sanitizer white list
Reverts 4450d6af (2.5.0)
Was causing troubles when integrating emails
2019-10-24 10:20:47 +02:00
Eric
b6796d2742 N°679 - Database inconsistency during INSERT
N°2499
2019-10-24 09:00:56 +02:00
Eric
047983cb91 🎨 Login screen extensibility 2019-10-23 17:27:04 +02:00
Eric
8455abdfe9 N°2315 - Markup extensibility: interface refactor 2019-10-23 16:49:00 +02:00
Eric
b7c3fbb176 💚 Refactor unit tests 2019-10-23 16:41:28 +02:00
Eric
5642552f9a N°1888 - Filter search with another search 2019-10-23 12:56:02 +02:00
Eric
6f6b654dba N°1113 - Global search only searchable attributes 2019-10-23 10:24:37 +02:00
Pierre Goiffon
c8b791efd3 Merge remote-tracking branch 'origin/itop-carbon' into develop
# Conflicts:
#	application/utils.inc.php
#	setup/ajax.dataloader.php
2019-10-22 18:27:13 +02:00
Pierre Goiffon
52fd58cd93 Remove "s" JQueryUI resizable handle override
Better to override locally O:)
2019-10-22 16:45:25 +02:00
Pierre Goiffon
66d638e224 💄 N°2518 New JQueryUI "s" handler style 2019-10-22 16:06:32 +02:00
Pierre Goiffon
16c4f18a81 N°2518 fix log call is crashing when invalid log_filename_builder_impl value set in config 2019-10-22 15:15:40 +02:00
Pierre Goiffon
cd6104ddb3 N°2518 If switching to log file rotation, rename setup/error legacy files 2019-10-22 15:08:48 +02:00
Pierre Goiffon
4fe7cd5adc 🎨 Config file code formating 2019-10-22 15:08:48 +02:00
Eric
3f59141407 N°1114 - config-itop.php access rights enforcement 2019-10-22 15:02:51 +02:00
Pierre Goiffon
8b37f503c7 N°1455 change hidden obsolete data message 2019-10-22 11:16:32 +02:00
Eric
7c9353d299 N°1888 - Circumvention of the restriction of rights by organization 2019-10-22 10:49:22 +02:00
Eric
dfc901ffa4 1355 - [Security] Password Autocomplete in Browser 2019-10-22 10:31:57 +02:00
Eric
611bf3035f N°1113 - AttributePassword content searchable in Global Search
The global search now avoid AttributePassword type of attributes
2019-10-22 09:56:09 +02:00
Eric
35bb2da6bd N°1114 - config-itop.php access rights enforcement 2019-10-21 18:14:44 +02:00
Eric
53e034ce4f 💚 Fix unit tests 2019-10-21 16:37:56 +02:00
Eric
cd4db1db06 💚 Fix unit tests 2019-10-21 16:32:43 +02:00
Pierre Goiffon
b1dbddffb9 N°2518 Integrating ACE in iTop 2019-10-17 19:21:30 +02:00
Pierre Goiffon
221c10aa9b itop-config : syntax highlighting for JS 2019-10-17 17:35:41 +02:00
bruno DA SILVA
15ecd7bccf itop-portal-base: .env.local is no more versioned 2019-10-17 16:47:18 +02:00
Eric
0d8dd0dc17 N°2517 - Supportability - file System integrity 2019-10-17 16:00:14 +02:00
Eric
ec986e0fbc N°2517 - Supportability - file System integrity 2019-10-17 15:55:33 +02:00
Eric
f0e0c73e9b N°2517 - Supportability - file System integrity 2019-10-17 15:51:41 +02:00
bruno DA SILVA
d9a24d2e14 2498 - restrict access to assets into env-*
iis bugfix: the configuration is now valid
2019-10-17 15:08:30 +02:00
Eric
93618f974d 💚 Fix unit tests 2019-10-17 12:45:50 +02:00
Eric
4dfc217992 N°2517 - Supportability - OQL Explain 2019-10-17 12:21:12 +02:00
Eric
5a1a6cf6f0 💚 Fix unit tests 2019-10-17 12:19:23 +02:00
Eric
36b325f71d N°2517 - Supportability - OQL Explain 2019-10-17 11:06:31 +02:00
bruno DA SILVA
74a3712116 n°2311 - prenvent cas logo to be fullscreen during the login page loading 2019-10-17 10:53:35 +02:00
Eric
1fe7eb6cf4 🎨 Fix Login CSS colors for ie 2019-10-17 10:46:47 +02:00
Pierre Goiffon
0d0f8e9ffc 💚 N°2538 Fix test
Was broken since ce207e5c
2019-10-17 10:45:12 +02:00
Stephen Abello
0a2063ce69 N°2060: Fix data-localizer and archive mode initialization for Symfony portal 2019-10-17 10:12:40 +02:00
Pierre Goiffon
ce207e5c56 Restore old APPROOT var init
Rollback change in 607d355c
2019-10-17 10:09:21 +02:00
bruno DA SILVA
f22eaae457 ✏️ fix a typo 2019-10-17 10:00:35 +02:00
Eric
fbc5280add 💚 Fix unit tests 2019-10-17 09:23:32 +02:00
bruno DA SILVA
65512ca984 2498 - restrict access to module's assets
- into env-*
 - into datamodels
 - into extensions
2019-10-16 18:01:33 +02:00
Pierre Goiffon
385b4f8d4a 🎨 \utils::RealPath Move var init next to its use 2019-10-16 17:33:49 +02:00
Pierre Goiffon
f65f22f333 N°2538 check path validity little improvements
* ajax-backup : change code to be more readable
* does a realpath() call on basepath to avoid troubles when havin '/' on Windows
2019-10-16 11:37:50 +02:00
Pierre Goiffon
607d355c61 N°2538 enforce generic method to check path validity
Now uses realpath() and StartsWith
2019-10-16 11:13:19 +02:00
Pierre Goiffon
29c30c1f89 🎨 Code format 2019-10-16 11:13:19 +02:00
Stephen Abello
2ff771c16a N°2311: Fix change password page, correctly display buttons with long string 2019-10-16 10:43:20 +02:00
Pierre Goiffon
5e641f2273 N°2538 generic method to check path validity 2019-10-15 18:41:07 +02:00
Eric
d52254bbf0 🎨 Make some room in the menu 2019-10-15 12:10:16 +02:00
bruno DA SILVA
a97c8be31a 2498 - restrict access to assets into env-*
this is done by adding a .htaccess file on a per module basis.
NB: if there is already a .htaccess file, it is kept as it, so you can see this commit as adding a "default" htaccess.
2019-10-15 11:46:18 +02:00
bruno DA SILVA
9c067e5645 💡 type an @return for better code completion 2019-10-15 11:46:18 +02:00
bruno DA SILVA
24d6857069 👌 comiled PHP files have no more spaces before the PHP open tag. 2019-10-15 11:46:18 +02:00
Eric
ed9259df9e 🐛 Fix access to change password page
🎨 Code cleanup
2019-10-15 11:43:47 +02:00
Eric
75794fb4d9 Fix count with Archive mode 2019-10-15 09:50:33 +02:00
Pierre Goiffon
4c386da7d2 📝 Fix typo (thanks @jbostoen !) 2019-10-15 08:44:47 +02:00
Denis Flaven
abbd2e64c9 Fixed the doc generation and some typos in the README 2019-10-14 16:44:43 +02:00
Pierre Goiffon
300a723fca 📝 Add some @var PHPDoc for iQueryModifier calls 2019-10-11 18:09:00 +02:00
Eric
ddf42d0358 Access right on display explain search 2019-10-11 17:08:35 +02:00
Eric
88be0d7638 N°2261 - Log KPI not available in lnk window 2019-10-11 16:27:01 +02:00
Stephen Abello
e26428a0eb Fix visual glitch on portal's modal-backdrops 2019-10-11 16:08:19 +02:00
Eric
7b36852d7a N°2261 - Log KPI not available in lnk window 2019-10-11 15:56:32 +02:00
bruno DA SILVA
d1eb674314 n°1617 - meets iTop fence requirements 2019-10-09 18:53:40 +02:00
Pierre Goiffon
4afed39b0e N°2529 Fix charset sent by logout page 2019-10-09 18:07:08 +02:00
Stephen Abello
c1460cfdc7 N°2142 Portal: Fix list tabs and on charts click when a Manage brick has a chart as default display mode 2019-10-09 17:15:07 +02:00
Vincent Dumas
85a94ee1e7 Fix products setup icons hyperlinks
The 3 icons at the end of the Setup were pointing to broken url links
2019-10-09 15:36:25 +02:00
Eric
68895551b2 N°2517 - Supportability - system report (Added cron user) 2019-10-09 12:11:17 +02:00
Stephen Abello
eece09e5ed N°2311: Avoid new SSO buttons to flicker on page loading 2019-10-09 10:21:38 +02:00
Eric
0dd1f26b39 N°2311 - Authentication extensibility in iTop 2019-10-08 15:23:24 +02:00
Eric
1b958a3c4d N°2240 - Supportability - Maintenance mode 2019-10-08 15:07:34 +02:00
Eric
a1d23cddc5 N°2248 - Supportability - Integrity module 2019-10-08 09:29:49 +02:00
Pierre Goiffon
14c25e3d9b 🎨 SetupPage code formatting 2019-10-08 08:42:41 +02:00
Pierre Goiffon
c3915ee48e N°2518 Implementation to rotate logs on a weekly basis 2019-10-08 08:42:41 +02:00
Pierre Goiffon
21ff03e28f N°2518 Possibiliy to rotate log files based on days
See the 'log_filename_builder_impl' config parameter
2019-10-08 08:42:41 +02:00
Pierre Goiffon
2c8887398d 🎨 Log classes : PHPDoc & fix wrong self:: uses 2019-10-08 08:42:41 +02:00
Eric
f51cd65b1f N°2249 - Supportability - Updater module 2019-10-07 17:44:17 +02:00
Stephen Abello
dbb5a5191b N°1146 Portal: Correctly display external field targeting enum field 2019-10-07 12:04:14 +02:00
Pierre Goiffon
e9844aed45 Merge branch 'support/2.6.2' into develop 2019-10-07 09:37:03 +02:00
Eric
aaf6289953 N°2249 - Supportability - Updater module 2019-10-04 18:26:21 +02:00
Eric
b0d0223821 N°2249 - Supportability - Updater module 2019-10-04 18:03:27 +02:00
Pierre Goiffon
f271606e5e N°729 Update DBObject::Prefill* methods PHPDoc 2019-10-04 11:09:16 +02:00
Eric
23a9bae391 N°2249 - Supportability - Updater module 2019-10-03 15:31:23 +02:00
Eric
b7c795c313 N°2240 - Supportability - Maintenance mode 2019-10-02 10:18:07 +02:00
Eric
46c553fbad N°2249 - Supportability - Updater module 2019-10-02 08:39:32 +02:00
Pierre Goiffon
fc5bbfbed2 N°2269 fix obsolete icon color in lists 2019-10-01 18:10:45 +02:00
Eric
afe760a8bc N°2240 - Supportability - Maintenance mode 2019-10-01 13:53:34 +02:00
Vincent Dumas
7e78c35d23 N°2479: fix typo in user message 2019-09-30 18:30:03 +02:00
Vincent Dumas
56f0e95a22 Fix typo in a comment 2019-09-30 17:05:43 +02:00
Eric
7f9024465f N°2311 - Refactor Login FSM for errors 2019-09-30 15:10:29 +02:00
Eric
75dc11b882 N°2311 - Refactor Login FSM for errors 2019-09-30 13:45:50 +02:00
Eric
db0a5bd071 N°2240 - Supportability - Maintenance mode 2019-09-27 18:00:09 +02:00
Eric
64434f8065 🎨 remove warnings 2019-09-27 17:14:04 +02:00
Eric
044623309c N°2240 - Supportability - Maintenance mode 2019-09-27 17:13:25 +02:00
Pierre Goiffon
a54695b2e0 🎨 Some InlineImage comment / formatting 2019-09-27 16:11:42 +02:00
Eric
7acb53a22f N°2311 - Refactor Login FSM for errors 2019-09-27 13:12:00 +02:00
Vincent Dumas
a2d05e8119 Fix typo on French message when object not found (#92) 2019-09-27 11:25:48 +02:00
Pierre Goiffon
dfcebfcbea 🎨 Remove useless consecutive call 2019-09-27 09:24:20 +02:00
Eric
3f165c9803 N°2456 - Deadlock during concurrent updates 2019-09-26 18:18:52 +02:00
Eric
85971ea9f3 N°2272 - OQL performance (hierarchical keys) 2019-09-26 08:30:57 +02:00
Eric
ff3ec219ef N°2272 - OQL performance (empty class alias) 2019-09-25 17:43:20 +02:00
Eric
e0374dd186 N°2272 - OQL performance (unit tests) 2019-09-25 14:39:12 +02:00
Eric
51ee3b31cb N°2272 - OQL performance (SQL Generation) 2019-09-25 10:57:35 +02:00
Eric
496ea830c5 N°2272 - OQL performance (unit tests) 2019-09-24 13:20:55 +02:00
Eric
1e911b5094 N°2272 - OQL performance (SQL Generation) 2019-09-24 11:40:08 +02:00
Eric
6073be25de N°2272 - OQL performance (OQL class tree optimizer) 2019-09-19 13:44:15 +02:00
Eric
93a736e42a N°2272 - OQL performance (OQL class tree wip) 2019-09-19 13:44:15 +02:00
Eric
128afc8a56 N°2272 - OQL performance (comments) 2019-09-19 13:44:15 +02:00
Stephen Abello
a8d5630030 N°967 Portal: Browse brick actions are now correctly ordered even without a rank tag 2019-09-19 10:53:42 +02:00
Pierre Goiffon
d83a256b9d N°2293 DBUpdate changes finalisation
* ListChanges are back where they were (extra precaution to prevent AfterUpdate callback impl regressions)
* aChanges reset is done after the reentrance test
2019-09-17 15:06:47 +02:00
Pierre Goiffon
5af33ffe0a N°2293 Saves changes in DBObjet::DBUpdate, just before the AfterUpdate call
This will allow to get changes made in ComputeValues, OnUpdate, etc
2019-09-17 11:59:17 +02:00
Pierre Goiffon
ffd37d7802 🎨 cmdbAbstract : add missing visibility keywords for some function 2019-09-13 11:32:31 +02:00
Eric
4ccd842bdf N°2272 - OQL performance (unit tests) 2019-09-13 10:35:41 +02:00
Eric
f186c9e242 N°2272 - OQL performance (code refactor) 2019-09-13 08:39:50 +02:00
Pierre Goiffon
4e66c9fc23 N°2478 clearer comment 2019-09-12 15:52:13 +02:00
Pierre Goiffon
99e21652a0 🎨 clarify \Config::UpdateIncludes with $sModulesDir=null 2019-09-12 09:54:06 +02:00
Pierre Goiffon
24a0cc2f64 N°2478 Fix install not working anymore when having no env-* 2019-09-12 09:29:24 +02:00
Pierre Goiffon
e9dee86b7c Remove unecessary require() calls in utils class
We still need manual require() for LoginForm and associated
2019-09-11 18:03:44 +02:00
Pierre Goiffon
42d7901828 🎨 some code formatting in utils class 2019-09-11 17:51:23 +02:00
Pierre Goiffon
7f156e961d N°2478 Fix unattended install
* remove require() calls (now we have an autoloader \o/)
* change cache policy in utils::GetConfig
* set config in utils class from ApplicationInstaller
2019-09-11 16:41:50 +02:00
bruno DA SILVA
d71b3b1893 N°1455 - obsolescence: show hint in the search bar 2019-09-10 15:45:57 +02:00
Pierre Goiffon
cb1488c17f 👷 Jenkins : no composer install needed anymore 2019-09-10 14:28:35 +02:00
Eric
e13bcba89a N°2311 - Login Page extensibility (constant used for application name) 2019-09-10 13:42:37 +02:00
Eric
7d8e8df0c5 N°2272 - OQL performance (fix 2.5 regression) 2019-09-10 13:06:47 +02:00
Pierre Goiffon
0e5c0ff46d 👷 Jenkins : fix toolkit unzip 2019-09-10 12:06:28 +02:00
Pierre Goiffon
67bff3e19d Jenlinks : change toolkit URL (http to https) 2019-09-10 11:46:55 +02:00
Eric
19d9c69fb8 N°2311 - Login Page extensibility (CSS reworked) 2019-09-10 08:40:28 +02:00
Eric
cb772a9527 N°2311 - Login Page extensibility (CAS button) 2019-09-06 17:54:02 +02:00
Eric
ee621c1b92 N°2311 - Login Page extensibility 2019-09-06 17:40:29 +02:00
Eric
20aa1bfdd6 cleanup warnings 2019-09-06 15:06:08 +02:00
Eric
9c52f6b949 N°2272 - OQL performance (add finalclass on all intermediate tables) 2019-09-06 14:56:37 +02:00
Eric
0f890ad228 N°2272 - OQL performance (Expression cache is configurable) 2019-09-06 14:30:42 +02:00
Eric
aac6ab0fc6 N°2272 - OQL performance (testability) 2019-09-06 14:30:42 +02:00
Eric
3fde778c0c N°2311 - Login Page extensibility 2019-09-06 14:30:42 +02:00
bruno DA SILVA
348bdbdc0d typo 2019-09-05 16:38:40 +02:00
Eric
3e9223a0bc N°2311 - Preferences extensibility 2019-09-02 17:55:55 +02:00
Eric
a905a8a3c1 N°2311 - Dictionary 2019-09-02 11:39:06 +02:00
Eric
b2ab07aa69 N°2311 - Login Page extensibility 2019-08-30 15:07:51 +02:00
Eric
9bd1da95e0 N°2456 - Deadlock during concurrent updates 2019-08-27 09:34:50 +02:00
Eric
83c0df2157 N°2456 - Deadlock during concurrent updates 2019-08-26 15:50:40 +02:00
Eric
8d7c64be66 N°2455 - Wrong Request Template query validation
Avoid blocking a form if a RequestTemplate reference a bad attribute (e.g. :this->id)
2019-08-23 17:30:54 +02:00
Eric
0625a01a4f Force MySQL port to int (for MySQL connector) 2019-08-23 15:13:29 +02:00
Pierre Goiffon
208a8723ff 🎨 Code formatting for iApplicationObjectExtension 2019-08-23 10:24:48 +02:00
Pierre Goiffon
f4c2a9ca7d N°2293 Some PHPDoc (@since for changes availability) 2019-08-23 10:18:22 +02:00
Pierre Goiffon
c97fd63e6d N°2293 Object update hooks now have access to object changes
* new \cmdbAbstractObject::$m_aChanges for \iApplicationObjectExtension::OnDBUpdate calls
* calling ListChanges() from within \DBObject::AfterUpdate will now give the right informations
* update PHPDoc in iApplicationObjectExtension
2019-08-23 10:13:44 +02:00
Eric
58402cdda8 N°2311 - User Provisioning API documentation 2019-08-22 14:38:07 +02:00
Eric
59fa3e10a3 N°2311 - User Provisioning API 2019-08-22 14:00:54 +02:00
Eric
0831a427cc N°2311 - authent-cas compatibility with 2.6 configuration 2019-08-22 14:00:53 +02:00
Pierre Goiffon
08517f0c7e 📝 Some PHPDoc in ExternalKey field rendering 2019-08-22 11:01:59 +02:00
Eric
97e58c2d79 N°2311 - combodo-cas renamed authent-cas 2019-08-21 12:21:24 +02:00
Eric
6693ec48a0 N°2311 - Add combodo-cas 2019-08-21 10:46:58 +02:00
Eric
9a13d4ce04 N°2311 - Code cleanup 2019-08-20 18:04:44 +02:00
Pierre Goiffon
51bbe1f79d Handle nested transactions (#90)
* starting a new transaction will send nothing in the DB (only one global transaction : merge nested transactions)
* same for COMMIT or ROLLBACK if more than 1 transaction is opened
* transactions are kept inside \DBObject::DBInsertNoReload, but they can be disabled using config flag db_core_transactions_enabled=false (true by default, hidden by default)
2019-08-20 10:47:29 +02:00
Eric
5dd92ab506 N°2311 - Add logs to logout 2019-08-20 10:26:43 +02:00
Eric
7120201469 N°2311 - Extend logout/error page 2019-08-20 09:53:11 +02:00
Stephen Abello
046eeb03f2 N°1671 Portal: Fix Aggregate Brick when user profile is not allowed to see one of the sub-brick 2019-08-19 11:28:53 +02:00
Eric
ce22dc9309 N°2311 - HybridAuth Extension 2019-08-16 18:42:04 +02:00
Eric
953c9e588e N°2311 - CAS Extension 2019-08-16 17:39:48 +02:00
Eric
2ceb4068ad N°2311 - Refactor Login FSM Extensions 2019-08-16 17:39:48 +02:00
Eric
11f62063a6 N°2311 - Debug login FSM 2019-08-16 17:39:47 +02:00
Eric
7885d712a6 N°2311 - Authentication extensibility in iTop 2019-08-16 17:39:47 +02:00
Molkobain
a6ca282ff4 Internal: Remove unused function in portal form handler 2019-08-16 17:05:37 +02:00
Molkobain
8ef67dee3b N°1881.1 Portal: Add DOM attribute (and widget helper) on object form that fields have been touched 2019-08-16 17:02:40 +02:00
Molkobain
fb1b730bd5 N°2435.8 Manage TCPDF lib using composer 2019-08-16 10:38:30 +02:00
Stephen Abello
af9c45849e N°1320: Add option to show/hide linkedsets out of user's scopes in portal 2019-08-16 10:05:45 +02:00
Pierre Goiffon
a711a67f4c Fix throw inside transaction without rollback 2019-08-14 14:43:40 +02:00
Molkobain
b743b7e2fb N°2435.7 Manage ArchiveTar lib using composer 2019-08-14 14:06:56 +02:00
Molkobain
3db92359e5 N°2435.6 Add .gitignore to remove non necessary folders from dependancies (eg. examples, tests, docs, ...) 2019-08-14 14:06:56 +02:00
Stephen Abello
088f08b315 N°967 Portal: Browse brick actions are now ordered following a rank tag 2019-08-14 12:39:32 +02:00
Molkobain
71cd61dfe4 Internal: Remove ClassLoader affectation from bootstrap.inc.php as we don't use it yet. 2019-08-14 10:30:43 +02:00
Molkobain
947e26d864 Internal: Change how the bootstrap.inc.php file is included in endpoints (This completes commit ec095896) 2019-08-13 17:38:51 +02:00
Molkobain
e3995a130f PHPDoc 2019-08-13 17:25:04 +02:00
Molkobain
384641e274 N°895 Portal: Filter linkedsets on remote object scopes 2019-08-13 16:59:25 +02:00
Molkobain
0985415e11 N°2435.5 Manage SwiftMailer lib using composer 2019-08-13 14:09:16 +02:00
Molkobain
3e13c9e825 N°2435.4 Manage SwiftMailer lib using composer 2019-08-13 13:51:41 +02:00
Molkobain
ec09589646 N°2439 Add real autoloader for framework files (not modules) 2019-08-13 13:46:19 +02:00
Molkobain
83e3321a48 N°2435.3 Security hardening: Avoid direct access to lib directory 2019-08-13 10:52:15 +02:00
Molkobain
bb4c8ea52d N°2435.2 Manage SCSSPHP lib using composer 2019-08-13 10:50:54 +02:00
Molkobain
5960dc6245 N°2435.1 Portal: Split portal composer.json in 2
- Autoloader for portal files in the itop-portal-base module
- Dependencies moved to root composer.json
- Add autoloader for /core and /application content
2019-08-13 10:34:22 +02:00
Molkobain
ca92316e7d N°919 Portal: Make portal denial based on user profiles work again 2019-08-12 16:15:09 +02:00
Molkobain
b096472ccf PHPDoc 2019-08-12 11:45:33 +02:00
Molkobain
261498d225 Internal: Move expression cache files in a dedicated directory 2019-08-12 11:45:33 +02:00
Stephen Abello
320a6b8a16 N°2238 Portal: Track in object's history attachments addition and deletion 2019-08-09 15:37:52 +02:00
Stephen Abello
b3cadaf314 PHP doc + typo 2019-08-09 10:49:55 +02:00
Stephen Abello
660852115e Portal: Rename an endpoint with a typo 2019-08-09 10:49:55 +02:00
Stephen Abello
543e57ed7d N°2432 Portal: Manage and Browse brick filters now apply on subclasses fields in lazy mode 2019-08-09 10:49:55 +02:00
Pierre Goiffon
4d78b7ca13 📝 add comment on prefill API call 2019-08-08 09:44:17 +02:00
Pierre Goiffon
a32bdf3f2f 📝 fix phpdoc (see call in UI.php operation=new) 2019-08-07 18:10:20 +02:00
Pierre Goiffon
5382d2006c N°2429 change visibility of \DBObject::GetReferencingObjects internal method
In iTop, only called by \DBObject::MakeDeletionPlan which is private
Not called in our extensions
Not called/redefined in any client customization
2019-08-07 16:08:59 +02:00
Pierre Goiffon
ae1d60d11e 📝 little PHPDoc modification 2019-08-07 11:50:59 +02:00
Stephen Abello
e8c0bcfbb2 N°769 Portal: Add parameter to set default list length in ManageBrick and BrowseBrick 2019-08-07 10:28:25 +02:00
Molkobain
b8a04cb842 Create README.md 2019-08-07 10:12:46 +02:00
Pierre Goiffon
b4ffa8c045 📝 Fix wrong phpdoc 2019-08-06 15:27:32 +02:00
Pierre Goiffon
7e540f16f9 🎨 \DBObject::DBDeleteSingleObject : isolate exit condition at the top 2019-08-06 14:45:05 +02:00
Stephen Abello
e69275c6c5 N°956 Portal: Add an icon to copy object name and url next to the form title
* Add a generic utility to build iTop clipboard widget
* Can be used in portal, console and extensions
2019-08-06 12:29:18 +02:00
Stephen Abello
16c123df49 Trigger bootstrap modal loaded event in 66287757 refactor 2019-08-06 12:29:18 +02:00
Pierre Goiffon
446eee79fc 🎨 Unwrap useless else statement 2019-08-06 11:49:19 +02:00
Pierre Goiffon
cbc96d8a58 📝 Attachment : add some @var on object init 2019-08-05 11:04:26 +02:00
Stephen Abello
d2015b7d7b N°1232 Portal: Harmonize right checks for external url in forms 2019-08-02 11:04:32 +02:00
Stephen Abello
305b236f41 N°2060: Add portal's ContextTag lost in Symfony migration 2019-08-02 10:58:52 +02:00
Pierre Goiffon
e172bd13df N°2211 DataSynchro : remove DBUpdate() arguments for future 2.7.0 2019-08-01 17:04:01 +02:00
Stephen Abello
94cb4a2bb4 N°2060: Fix regression introduced in migration 2019-08-01 14:37:50 +02:00
Pierre Goiffon
7abbbf6b7b 📝 PHPDoc for BackgroundTask 2019-08-01 09:54:47 +02:00
Molkobain
66287757b3 Portal: Refactor creation of modal dialog through a common helper (CreatePortalModal(oOptions)) 2019-07-31 15:51:25 +02:00
Molkobain
661ecc57c5 PHPDoc 2019-07-31 15:51:25 +02:00
Molkobain
15f9f79a24 Fix unit test to be used in the ITSM Designer (Shame shame shame 🔔🙈) 2019-07-31 15:51:25 +02:00
Molkobain
286374fe7c N°1232 Portal: Allow external keys to be opened in object forms (only if user has permissions)
- Created new JS method to handle modals (bootstrap-portal-modal.js > CreatePortalModal)
- Moved from global modal hacks to the same file
2019-07-31 15:51:25 +02:00
Pierre Goiffon
ea288c2194 🌐 Fix english label
Many thanks @jbostoen who suggested the change in 60863c5fcf
2019-07-31 09:04:38 +02:00
Molkobain
927cd60ad2 N°1736.2 Fix sBrickSubtitle not being defined by default in most bricks 2019-07-30 17:41:09 +02:00
Molkobain
fb6e47e42a N°1736 Portal: Add option to display ManageBrick's current tab description as the brick subtitle
Actually, every brick can now display a subtitle if they populate the sBrickSubtitle variable for the template.
2019-07-30 17:19:07 +02:00
Pierre Goiffon
34d4f6b1f9 N°2240 add /.maintenance in ignore 2019-07-30 08:59:52 +02:00
Stephen Abello
f7170953fb N°2353: Typo in French dictionary 2019-07-29 15:33:48 +02:00
Pierre Goiffon
e80d52cc0f N°2416 fix datepicker not opening anymore
This was brought by PR #40 integration in 06592d7d37
2019-07-29 12:12:34 +02:00
Pierre Goiffon
75da1ce7a7 🎨 iTopWebPage : some syntax highlighting in HEREDOC JS 2019-07-29 11:09:33 +02:00
Pierre Goiffon
7894c872dc N°2414 Remove \DBObject::RegisterCallback
This was experimental and never used. The official way is to use iApplicationObjectExtension !
2019-07-26 16:24:06 +02:00
Pierre Goiffon
14b2d2ed4c 🔧 Update EditorConfig file with idea specific options
Available since PHPStorm 2019.2
@see https://blog.jetbrains.com/phpstorm/2019/07/phpstorm-2019-2-release/#editorconfig
2019-07-26 12:05:08 +02:00
Pierre Goiffon
a7b5077e0c N°2010 \SetupUtils::MYSQL_NOT_VALIDATED_VERSION is now empty 2019-07-25 17:33:41 +02:00
Pierre Goiffon
de2b88b707 📝 PHPDoc for archiving remove @api
Public API is currently under review, we shouldn't change the review perimeter !
2019-07-25 17:33:41 +02:00
Stephen Abello
130734bec7 Merge branch 'master' into develop
# Conflicts:
#	setup/backup.class.inc.php
2019-07-25 17:18:49 +02:00
Stephen Abello
db4c241cba N°680 Fix 'G', 'd', 'j' DateTime format in regexp generation 2019-07-25 15:12:44 +02:00
Pierre Goiffon
be09909976 📝 PHPDoc for archiving : rephrase for clarity
Thanks @bruno-ds !!
2019-07-24 17:04:10 +02:00
Molkobain
a6b1da393b N°2269 Font Awesome v5: Fix files integration in portal 2019-07-23 18:10:00 +02:00
Pierre Goiffon
501c20a34d 📝 Some PHPDoc on object archiving 2019-07-23 18:05:05 +02:00
Molkobain
b858ba3786 N°1268 Add support for abstract classes creation in browse brick
* Refactored parts of the create brick into the object controller
2019-07-23 11:45:33 +02:00
Molkobain
60863c5fcf 🌐 Fix English dictionary entries 2019-07-23 11:45:33 +02:00
Pierre Goiffon
1ee3f4a984 Merge remote-tracking branch 'origin/master' into develop 2019-07-22 15:59:21 +02:00
Molkobain
0205f150a3 N°902.3 Portal: Extract column sorting helper to a specific service 2019-07-22 11:45:31 +02:00
Pierre Goiffon
cdbdf580c8 📝 CONTRIBUTING : small changes
* security wasn't in bold
* more explanations on branches, ask to base always on develop
2019-07-22 11:34:48 +02:00
Pierre Goiffon
e4ba2b0828 N°2366 Remove unused iTopArchive class 2019-07-22 09:02:45 +02:00
Pierre Goiffon
28d00cc7c9 N°2366 Remove zip from mandatory PHP ext 2019-07-22 09:02:44 +02:00
Pierre Goiffon
b897da8f6f N°2404 remove charset/collation DB parameters
Are constants since N°1001 (iTop 2.5.0)
2019-07-19 16:58:25 +02:00
Pierre Goiffon
dc868b16ab N°2366 remove DBBackup::CreateZip
* remove method and its dependencies
* create \utils::GetFileMimeType
* in \DBBackup::DownloadBackup mime type isn't hardcoded anymore
2019-07-19 15:51:05 +02:00
Pierre Goiffon
ee2e109769 N°2269 Font Awesome v5 : kept old CSS name for compat 2019-07-19 10:43:58 +02:00
Pierre Goiffon
2b955ddd53 N°2269 Font Awesome v5 : move back lib from /lib to /css
Thanks to the team, yeah you're right, this wasn't a good idea (did because there is a way to use Font Awesome in JS, but we'll see if we do so in the future, for now we don't :) )
2019-07-19 10:16:22 +02:00
Molkobain
33cb4fd42b N°902.2 Portal: Add support for columns sorting in BrowseBrick's "lazy" mode
(And start refactoring in ManageBrick)
2019-07-18 12:11:09 +02:00
Pierre Goiffon
a03af7e9ef 🐛 N°2240 Fix startup.inc.php cannot be called alone anymore 2019-07-17 16:50:48 +02:00
Molkobain
90dbc35d41 N°902 Portal: Add support for columns sorting in ManageBrick's "lazy" mode 2019-07-17 15:40:44 +02:00
Molkobain
66e9fc2068 N°2396 Autocomplete: Harmonize accent handling 2019-07-17 15:40:43 +02:00
Molkobain
0a9b376684 N°2324 Remove legacy portal security check 2019-07-17 15:40:43 +02:00
Molkobain
83ba909c08 N°2112 Remove legacy end-user portal
- Accessing the /portal URL redirects to the new portal (/pages/exec.php?exec_module=itop-portal-base&...)
- Removed /itop_design/portals/portal[@id="legacy_portal"] from standard datamodel, adapt your XML accordingly
- Removed /itop_design/constants/constant[@id^="PORTAL_"] from standard datamodel, adapt your XML accordingly
- Removed PortalWebPage & TransactionException classes
- Added a warning in setup when no portal is selected
2019-07-17 15:40:43 +02:00
Pierre Goiffon
9ed33f16dd N°2269 Font Awesome v5 : fix new lines breaking code :(
Those regressions were introduced in a4743901
Saw with a JS error in schema.php
2019-07-17 11:02:26 +02:00
Pierre Goiffon
e9fdb61bb5 N°2269 Font Awesome v5 : remove unused CSS 2019-07-17 10:24:07 +02:00
Pierre Goiffon
073b1cd303 N°2018 Backup : fix version check for MySQL8
Now uses \CMDBSource::GetDBVersion instead of mysqldump -V
2019-07-16 18:05:31 +02:00
Pierre Goiffon
e712791f43 Merge remote-tracking branch 'origin/master' into develop 2019-07-16 17:45:24 +02:00
Pierre Goiffon
a4743901a3 N°2269 Font Awesome : update iTop for new v5 icons
* remove useless css in light-grey (weren't used)
* change icons class names from v4 to v5
2019-07-16 12:20:59 +02:00
Pierre Goiffon
ced9489643 N°2269 Add Font-Awesome v5.9.0
Also add v4-shims for compatibility. Will be removed with N°2393
2019-07-16 09:57:51 +02:00
Pierre Goiffon
0c45a0ca49 N°2269 Remove Font-Awesome v4 2019-07-16 09:57:51 +02:00
Pierre Goiffon
f3572e82ec N°2060 fix portal crash if css not yet compiled
Was using services.yaml parameters before they were defined
2019-07-16 09:57:30 +02:00
Pierre Goiffon
dd620022a8 📝 new iTop security policy (#85) 2019-07-16 08:47:30 +02:00
Molkobain
2237ec581c N°2323.7 Fix images display in browse brick as a list 2019-07-15 13:41:36 +02:00
Eric
a0cd70ae71 N°2240 - Supportability - Maintenance mode (setup) 2019-07-12 16:13:13 +02:00
Eric
80fce579a0 N°2240 - Supportability - Maintenance mode (soap message removed) 2019-07-12 15:35:20 +02:00
Pierre Goiffon
1313484ebe 💄 setup : update progress bar if error occurs 2019-07-12 11:14:53 +02:00
Pierre Goiffon
95aa541293 N°2150 Archive_Tar update : fix warnings on overloaded methods
In Archive_Tar the methods signatures did change... But the overrides were useless (same code or direct call to parent)
2019-07-12 10:34:23 +02:00
Molkobain
c4702f6a87 Merge remote-tracking branch 'origin/develop' into develop 2019-07-12 10:25:17 +02:00
Molkobain
5c0fc0bec5 N°2323.6 Reintegrate fixes in the new Symfony portal 2019-07-12 10:17:58 +02:00
Stephen Abello
d8de7b19cb N°2226: Add missing files for Scss v1.0.0 2019-07-12 10:13:00 +02:00
Molkobain
38640b01a8 Merge branch 'feature/b2060-migrate-silex-to-symfony' into develop
# Conflicts:
#	core/dbsearch.class.php
#	datamodels/2.x/itop-portal-base/module.itop-portal-base.php
#	datamodels/2.x/itop-portal-base/portal/src/controllers/userprofilebrickcontroller.class.inc.php
#	datamodels/2.x/itop-portal-base/portal/src/helpers/applicationhelper.class.inc.php
#	datamodels/2.x/itop-portal/module.itop-portal.php
2019-07-12 09:57:16 +02:00
Eric
a11e783867 N°2240 - Supportability - Maintenance mode (soap message) 2019-07-12 09:04:10 +02:00
Molkobain
8ca2fffa78 N°2060 [WIP] Initialisation of the portal application: Remove Silex framework files from embedded libs 2019-07-11 17:50:36 +02:00
Molkobain
3f3cbd17ed N°2060 [WIP] Initialisation of the portal application: Remove Silex portal files 2019-07-11 17:50:31 +02:00
Molkobain
5a18769336 N°2060 [WIP] Initialisation of the portal application: Make AggregatePageBrick work again 2019-07-11 17:45:43 +02:00
Molkobain
cd6fe171cd N°2060 [WIP] Initialisation of the portal application: Refactor way brick controllers forward actions between each others 2019-07-11 17:45:21 +02:00
Molkobain
ee45e546a8 N°2060 [WIP] Initialisation of the portal application: Code cleanup 2019-07-11 16:44:22 +02:00
Molkobain
c8be217a1d N°2060 [WIP] Initialisation of the portal application: Make CreateBrick work again 2019-07-11 16:04:06 +02:00
Molkobain
618df6de1d N°2060 [WIP] Initialisation of the portal application: Fix class extended by ObjectController 2019-07-11 16:03:44 +02:00
Pierre Goiffon
e6e79df8db N°2150 update Archive_Tar to 1.4.7
Now we don't have anymore some Combodo specific code inside the lib \o/
2019-07-11 14:30:30 +02:00
Eric
509ca47b36 N°2240 - Supportability - Maintenance mode 2019-07-11 12:04:11 +02:00
Eric
066353e1e7 N°2240 - Supportability - Maintenance mode 2019-07-11 12:00:15 +02:00
Eric
a6737afb2f N°2240 - Supportability - Maintenance mode 2019-07-11 10:22:39 +02:00
Molkobain
d5b3a62df5 N°2060 [WIP] Initialisation of the portal application: Code cleanup 2019-07-10 11:55:47 +02:00
Eric
7f82faefe1 N°679 - DB inconsistency protection 2019-07-10 11:49:44 +02:00
Molkobain
08731857e5 N°2060 [WIP] Initialisation of the portal application: Code cleanup 2019-07-10 11:45:47 +02:00
Molkobain
90062acc35 N°2060 [WIP] Initialisation of the portal application: Fix typo 2019-07-10 11:38:22 +02:00
Molkobain
030d912820 Code cleanup
- Format code accordingly to coding conventions
- Add / update PHPDoc all over the place
- Suppress most of the warnings that did not have a big impact on code's logic
2019-07-09 19:10:16 +02:00
Molkobain
9e9187b169 N°2060 [WIP] Initialisation of the portal application: Huge code cleanup
- Rename variables and methods in iTop files to match coding conventions
- Format code accordingly to coding conventions
- Add / update PHPDoc all over the place
- Suppress most of the warnings that did not have a big impact on code's logic
2019-07-09 19:08:40 +02:00
Molkobain
c1258d0527 N°2060 [WIP] Initialisation of the portal application:
- Fix attachment download: Controller's action was still using the Silex\Application object to return a response.
- Push all cleanup modifications as well by mistake...
2019-07-09 17:54:37 +02:00
Molkobain
b7039c81ba N°2060 [WIP] Initialisation of the portal application: Object's routes
- Fix autocomplete search route path was incorrect (missing parameters)
- Fix generic search route by removing the default controller as it didn't exist
- Remove regular search route as it was never used / implemented
2019-07-09 16:15:14 +02:00
Molkobain
7088b96c16 N°2060 [WIP] Initialisation of the portal application: Enable webprofiler for easier debug! 2019-07-08 16:59:46 +02:00
Molkobain
d31273dff5 N°2060 [WIP] Initialisation of the portal application: PHPDoc 2019-07-08 16:04:25 +02:00
Molkobain
85460ef6e2 N°2060 [WIP] Initialisation of the portal application:
- Remove old composer.json that was not necessary
- Add empty model.itop-portal-base.php file for future XML snippets to be loaded
- Increase module version number to 2.7.0
2019-07-08 15:49:07 +02:00
Molkobain
5ab059c404 N°2060 [WIP] Initialisation of the portal application:
- Simplify PortalUrlMaker to avoid necessity to copy most of the code. Drawback: BC break, check migration notes.
- Fix multiple portal instances (in the same running process)
- Refactor portal constants into env. vars
- Fix cache path for services (ScopeValidator & LifecycleValidator)
- Change evalution order of the portal id ($_ENV['PORTAL_ID'] > $_GET('portal_id'] > PORTAL_ID)
2019-07-08 15:44:39 +02:00
Molkobain
322ea1870d N°2060 [WIP] Initialisation of the portal application:
- Refactor kernel bootstrapping:
  - Make bin/console from SF work
  - Make iTopPortalEditUrlMaker / iTopPortalViewUrlMaker work again
- Add classmap to /application in composer.json
2019-07-05 15:53:05 +02:00
Molkobain
ab3024d98a N°2060 [WIP] Initialisation of the portal application: Restore ApplicationHelper.php history 2019-07-05 11:42:39 +02:00
Molkobain
d447c96385 N°2060 [WIP] Initialisation of the portal application: Temporary delete ApplicationHelper.php in order to restore history 2019-07-05 11:36:02 +02:00
Molkobain
e3ac4d1039 N°2060 [WIP] Initialisation of the portal application:
- Make ManageBrick work again!
- Make ObjectController::CreateFromFactory() work again
- Refactor object form rendering from Twig string (in memory) in the "object_form_handler" service
- Fix ApplicationHelper::GetLoadedListFromClass()
2019-07-05 11:30:08 +02:00
Molkobain
8fc4aa7240 N°2060 [WIP] Initialisation of the portal application: Fix template paths in ObjectController 2019-07-04 17:12:53 +02:00
Molkobain
aff9d8cbca N°2060 [WIP] Initialisation of the portal application:
- Fix object_brick.yaml actions path (Double slashes)
- Add declaration for "security_helper" service
- Refactor ObjectFormManager and ObjectFormHandlerHelper for SF
2019-07-04 17:06:58 +02:00
Molkobain
260c15c6b6 N°2060 [WIP] Initialisation of the portal application:
- Refactor of BrickCollection to store properties at the root level, hence having easier API
- Code cleanup (Coding conventions, PHPDoc)
- Extract ObjectController::HandleForm() into new "object_form_handler" service
- Migrate ObjectController and UserProfileBrickController to SF
- Remove route/action "Search hierarchy" from ObjectController as it was never implemented
2019-07-04 15:14:46 +02:00
Purple Grape
dab48146bf Update zh_cn.dict.itop-config-mgmt.php
translation correction
2019-07-03 08:42:10 +02:00
Molkobain
1115cdd2ec Portal: Fix sidebar menu entries being to narrow when only "Home" displayed 2019-07-01 22:33:15 +02:00
Molkobain
44673b9fd2 N°2060 [WIP] Initialisation of the portal application: Replace SF default UrlGenerator with our own 2019-07-01 17:50:25 +02:00
Molkobain
faf9b32176 N°2060 [WIP] Initialisation of the portal application 2019-07-01 17:47:45 +02:00
Molkobain
a93c1092fc N°2060 [WIP] Initialisation of the portal application:
- Refactor SecurityHelper into SF service (DI)
- Make BrowseBrick work (again!)
- Extract methods from BrowseBrickController to a dedicated service (BrowseBrickHelper)
2019-07-01 17:41:12 +02:00
Pierre Goiffon
6c81163d20 Merge remote-tracking branch 'origin/master' into develop 2019-07-01 17:30:21 +02:00
Molkobain
f71edbf45b N°2060 [WIP] Initialisation of the portal application: Refactor to make services 'combodo.current_user' and 'combodo.current_contact.photo_url' work 2019-06-28 17:26:30 +02:00
Molkobain
0d3e48475e N°2060 [WIP] Initialisation of the portal application: Code cleanup 2019-06-28 17:26:30 +02:00
Molkobain
ae8451e837 N°2060 [WIP] Initialisation of the portal application:
- Default env. is now production.
- Debug mode through url param. is now available like in Silex version
2019-06-28 17:26:24 +02:00
Molkobain
123e734046 N°2060 [WIP] Initialisation of the portal application: Fix file format (tab used instead of spaces) 2019-06-28 15:09:06 +02:00
Molkobain
008261e918 N°2060 [WIP] Initialisation of the portal application: Part of the "brick_collection" service refactoring 2019-06-28 15:08:30 +02:00
Molkobain
d388086baa N°2060 [WIP] Initialisation of the portal application: Fix composer.json file
- Reupgrade Symfony/* to v3.4.* instead of v3.4.12 thanks to symfony/polyfill-php70
- Remove "replace" key that was necessary for Flex
- Add "classmap" key to auload all classes from <itop>/core (eg. \ModuleDesign)
2019-06-28 15:07:12 +02:00
Stephen Abello
f7af705bb5 Fix scss and css errors 2019-06-28 14:25:25 +02:00
Stephen Abello
a827cb7546 N°2226: Upgrade ScssPHP to v1.0.0 2019-06-28 14:24:56 +02:00
Stephen Abello
c7fe6f388a N°2270: Upgrade bootstrap to v3.4.1 2019-06-28 14:22:35 +02:00
Molkobain
a04080a93e N°2060 [WIP] Initialisation of the portal application: Migrate routes to YAML format 2019-06-27 17:11:04 +02:00
Molkobain
04158f5589 N°2060 [WIP] Initialisation of the portal application: Fix of the composer.json file
- Temporary downgrade Symfony/* from v3.4.* to v3.4.12 because of a PHP7 dependency in Symfony/http-foundation
- Remove Flex as it was only compatible with PHP7
- Remove auto scripts relying on Flex (post update and post install)
- Rename rogue itop-portal-base/composer.json that should not be used (will be removed later)
2019-06-27 16:32:45 +02:00
Stephen Abello
6de6c38834 N°2268: Upgrade jQuery to v3.4.1 and jQuery migrate to v3.1.0. Remove version number from both libraries filename 2019-06-26 10:36:40 +02:00
Pierre Goiffon
a5745ba72d N°2345 privUITransactionFile : avoid create dir race condition 2019-06-26 10:17:47 +02:00
Molkobain
0867d8a3c4 N°2060 [WIP] Initialisation of the portal application 2019-06-25 11:58:38 +02:00
Stephen Abello
71f5d29cba N°2271: Upgrade CKEditor to v4.11.4 2019-06-24 15:52:26 +02:00
Eric
e68340273b Merge branch 'master' into develop
# Conflicts:
#	core/config.class.inc.php
#	core/htmlsanitizer.class.inc.php
#	css/css-variables.scss
#	css/light-grey.css
#	datamodels/2.x/version.xml
#	dictionaries/zh_cn.dictionary.itop.ui.php
#	synchro/synchrodatasource.class.inc.php
2019-06-20 16:11:38 +02:00
Eric
b0414748cb Typo 2019-06-13 11:55:10 +02:00
Pierre Goiffon
b1761e04b2 🎨 DataSynchro : remove some warnings, code formating
(cherry picked with small modifications from commit 26dcaa0ded : it was reverted on master as this branch contains a fix only version, ok to commit it on develop though)
2019-06-11 17:01:08 +02:00
Pierre Goiffon
d6b194b0aa 📝 Change back CONTRIBUTING file name to uppercase 2019-06-11 14:53:56 +02:00
Pierre Goiffon
50ed52bacc Fix ticket ref uniqueness rule declaration (many thanks @jbostoen !) 2019-06-11 09:08:36 +02:00
Thomas Casteleyn
daa906a697 Only set Ticket ref if not yet present via import or synchro (#82)
New non blocking uniqueness rule on Ticket.ref to warn when having ref duplicates
2019-06-10 11:28:24 +02:00
Pierre Goiffon
ecd8f40c0f 🔧 Create a .editorconfig
See https://editorconfig.org/
2019-06-07 15:22:21 +02:00
Pierre Goiffon
616c1b9b73 🔧 Update PhpStorm formatter 2019-06-07 15:21:59 +02:00
Pierre Goiffon
d24870e0ae Merge remote-tracking branch 'origin/master' into develop 2019-06-04 16:23:58 +02:00
Guy Couronné
b57c224052 📈 Add KPI on API Rest (#67) 2019-06-03 09:07:25 +02:00
Molkobain
895abde39c N°2060 [WIP] Renamed Silex portal dir before starting Symfony integration 2019-05-28 12:04:34 +02:00
Molkobain
b6418d95e7 Add PHPDoc for type hinting as iTop replaces \DOMDocument with \MFDocument 2019-05-28 10:36:18 +02:00
Pierre Goiffon
b7dc55604e 🎨 DataSynchro : rename DoJob1/2/3 methods 2019-05-23 11:19:18 +02:00
Pierre Goiffon
991bc359cb Merge remote-tracking branch 'origin/master' into develop 2019-05-23 10:52:34 +02:00
Molkobain
bc55bfbee1 N°2235 Enable notification placeholders in hyperlinks 2019-05-21 17:38:28 +02:00
Stephen Abello
e9119e95ac N°1164, SF#1491: Add code snippets with syntax highlighting to CaseLog/HTML fields 2019-05-17 15:59:01 +02:00
Molkobain
af332a34d6 ♻️ Make ticket reference generation working with new sub-classes (#78) 2019-05-17 11:21:24 +02:00
Molkobain
2d6251e5df 💄 Add warning message CSS class (like error message) 2019-05-15 17:53:48 +02:00
Pierre Goiffon
d9bf3339d2 linkswidget : remove dead (unreachable) code 2019-05-13 09:57:24 +02:00
Pierre Goiffon
b4ee5cd59c Merge branch 'master' into develop 2019-05-13 08:54:00 +02:00
Molkobain
91f410a85c 💄 Fix images being too large in icon selector (dashboards and Designer)
Note: The widget still needs a more aggressive refactoring to render nicely...
2019-05-02 16:42:21 +02:00
Pierre Goiffon
58ffd37f9e N°1283 Add option to open WebPageMenuNode in new window 2019-04-30 16:11:29 +02:00
Eric
0a48696cd8 Carbon: N°1855 - Fix: Cannot remove last 'dependencies' with UI
Note that multi-select value when no entry is selected is "" and not []
in order to be posted, so multi-select values are not always arrays.
2019-04-30 15:46:44 +02:00
Eric
2f71570390 Carbon: N°1855 - fix "depends on" displaying fields from children 2019-04-30 12:02:13 +02:00
Thomas Casteleyn
5c9d98d12c Fix cron crash when MySQL connection lost (#80) 2019-04-30 11:02:02 +02:00
Pierre Goiffon
15362df69a Merge branch 'master' into develop 2019-04-29 11:26:52 +02:00
Thomas Casteleyn
ab0c97621a Add support to optionally mention username in password reset mail (#76)
Can now use login in reset password email dict keys
* UI:ResetPwd-EmailSubject
* UI:ResetPwd-EmailBody
2019-04-29 11:12:19 +02:00
Molkobain
78b6c03af7 💡 Add some PHPDoc 2019-04-25 12:46:57 +02:00
Molkobain
22342cdc05 🐛 N°2184 Fix validation issue when several label fiels in a dashlet/designer form 2019-04-25 12:42:16 +02:00
Molkobain
dccdd84c25 ♻️ Fix unit tests for compatibility with CI 2019-04-17 14:52:58 +02:00
Guy Couronné
d4d16f43ac Add status.php for getting iTop's status (#56)
Allow for HAProxy and monitoring to get iTop's status
 Add tests for status

Signed-off-by: Guy Couronné <gcouronne:@sapiens.biz>
2019-04-17 09:21:45 +02:00
Molkobain
dcf4963e0c N°2152 Fix bad XML generation when adding a dashboard attribute on a new class 2019-04-16 17:15:15 +02:00
Pierre Goiffon
a773a4957a Merge remote-tracking branch 'origin/master' into develop
# Conflicts:
#	README.md
2019-04-10 16:26:37 +02:00
Eric
9ec36a76f6 Carbon: N°1589 - Check migration 2019-04-10 12:12:31 +02:00
Pierre Goiffon
5dc8283229 💡 Some doc for Config::GetModule* methods 2019-04-10 11:27:11 +02:00
Eric
09b470e6c7 Better output 2019-04-09 10:43:39 +02:00
Molkobain
40151c7a43 N°2147 Fix non working impact relation when based on default value 2019-04-05 16:25:26 +02:00
Molkobain
34c030b501 N°2070 Extend ModelFactory implementations to optionally check meta classes (PHP) along with regular XML classes 2019-04-05 15:48:29 +02:00
Pierre Goiffon
e9a2528b13 📝 CONTRIBUTING : use emoji codes instead of characters 2019-04-03 15:33:15 +02:00
Pierre Goiffon
e9d72bd022 💡 Fix some PhpDoc for \utils::DoPostRequest 2019-04-03 15:29:06 +02:00
Pierre Goiffon
b166686a15 📝 CONTRIBUTING : add a note on datamodel modifications (#68)
* %memo% CONTRIBUTING : suggest use SF tickets for default datamodel modifications
2019-04-02 09:02:02 +02:00
Molkobain
c59d3cc624 Fix unreachable log message on exception 2019-04-01 16:52:22 +02:00
Pierre Goiffon
ca95060b05 idea update for 2019.1 2019-03-29 16:38:02 +01:00
Pierre Goiffon
0451ae07c8 Merge remote-tracking branch 'origin/master' into develop
# Conflicts:
#	dictionaries/sk.dictionary.itop.core.php
2019-03-27 16:33:43 +01:00
Molkobain
3e55693bfa 👥 Add Martin Kincel to the contributors. Thanks for the slovak translations! 2019-03-27 11:34:32 +01:00
Molkobain
f5d0947b27 🌐 Add new language for main features thanks to Martin Kincel! 2019-03-27 11:33:08 +01:00
Pierre Goiffon
2da181a399 Combodo PHPStorm settings : some accessibility inspections are now weak warns instead of warns 2019-03-22 18:00:54 +01:00
Thomas Casteleyn
6e8bcf7b69 Make setup backup location and name similar as other backups (#61) 2019-03-22 16:02:17 +01:00
Pierre Goiffon
da6791d75f 💄 Setup wizard backup path : larger input widget 2019-03-22 15:38:18 +01:00
Pierre Goiffon
2a0928b4be Merge remote-tracking branch 'origin/master' into develop
# Conflicts:
#	css/css-variables.scss
#	css/light-grey.css
#	datamodels/2.x/version.xml
2019-03-21 17:46:30 +01:00
Thomas Casteleyn
9bb365e60d Added example php location argument 2019-03-20 10:14:54 +01:00
Thomas Casteleyn
b3c80e6ecf Added changes as requested 2019-03-20 10:14:54 +01:00
Thomas Casteleyn
e5c77f64aa Update cron.cmd to have better defaults and remove references to old php version 2019-03-20 10:14:54 +01:00
Pierre Goiffon
c313ed2efc Merge remote-tracking branch 'origin/master' into develop
# Conflicts:
#	composer.json
2019-03-19 11:18:18 +01:00
Thomas Casteleyn
d8f75495fe Don't display organization name in menu bar if it's the only one 2019-03-18 11:12:05 +01:00
Pierre Goiffon
2240743100 %memo% README : fix iTop Hub docs links (from 2.5.0 to latest) 2019-03-15 17:39:59 +01:00
Pierre Goiffon
a6a2410c50 Merge branch 'master' into develop
# Conflicts:
#	datamodels/2.x/itop-attachments/nl.dict.itop-attachments.php
2019-03-15 17:23:04 +01:00
Thomas Casteleyn
34751a52a8 Replaced first name by last name in default person list view 2019-03-15 16:16:59 +01:00
Lars Hippler
cb7c382b99 Secure the server: prevent the users from browsing/getting files from the conf directories.
With Apache, it is still a must to enable htaccess with the spec "AllowOverride All". The index.php files are here to prevent from browsing whatever the HTTP server config.
2019-03-15 14:32:43 +01:00
Pierre Goiffon
76c3f640db Merge remote-tracking branch 'origin/master' into develop 2019-03-08 14:35:35 +01:00
Eric
f5b56d9855 composer warnings 2019-03-08 09:10:35 +01:00
Pierre Goiffon
b25a8b4c9f 💡 add missing @var 2019-03-08 09:06:12 +01:00
Pierre Goiffon
7ad9b9dd08 🎨 Use finally instead of duplicating lines
see http://php.net/manual/fr/language.exceptions.php#language.exceptions.finally : finally was added in PHP 5.5
2019-03-07 16:03:51 +01:00
Pierre Goiffon
065895aa73 Merge remote-tracking branch 'origin/master' into develop
# Conflicts:
#	datamodels/2.x/itop-portal-base/zh_cn.dict.itop-portal-base.php
#	dictionaries/zh_cn.dictionary.itop.core.php
#	dictionaries/zh_cn.dictionary.itop.ui.php
2019-03-04 09:21:14 +01:00
Pierre Goiffon
06592d7d37 🐛 Fix datepicker locale not set correctly for ZH CN and PT BR
Reused code made by @annProg in PR #40, many thanks !
2019-02-27 12:53:37 +01:00
Pierre Goiffon
49e31ddb3d 🎨 REST service : change var names for new pagination params (thanks @jbostoen !) 2019-02-27 09:43:38 +01:00
Dennis Lassiter
fd55bdf9a8 Allow params "limit" and "page" in REST-API
PR #25, code author Dennis Lassiter, many thanks !
2019-02-26 17:06:44 +01:00
Pierre Goiffon
6eb3a243df Merge remote-tracking branch 'origin/master' into develop 2019-02-25 12:11:15 +01:00
Pierre Goiffon
b52e972a39 🐛 Fix login page in chinese instead of english
Introduced by PR #39 (commit 6ad27b43)
2019-02-22 09:54:56 +01:00
Pierre Goiffon
2d344e0209 Fix merge error again......... 2019-02-21 17:38:47 +01:00
Pierre Goiffon
519252efd4 Fix merge error (wooops) 2019-02-21 17:29:53 +01:00
Pierre Goiffon
e59e62fb1b Merge remote-tracking branch 'origin/master' into develop
# Conflicts:
#	core/expressioncache.class.inc.php
2019-02-21 17:24:37 +01:00
Pierre Goiffon
a35690d13c 📌 Identify & remove Combodo code from ArchiveTar lib 2019-02-21 17:07:31 +01:00
Pierre Goiffon
4857569813 🔧 PhpStorm settings : disallow php short open tags 2019-02-21 15:39:13 +01:00
Eric
acf80b4b92 Merge branch 'master' into develop 2019-02-15 17:44:59 +01:00
Eric
084d12bb45 Merge branch 'master' into develop 2019-02-14 10:58:42 +01:00
Eric
1587218c6d Merge tag 'N941-2' into develop
Tagging hotfix N941-2 N941-2
2019-02-14 09:48:50 +01:00
Eric
12d3e36887 Merge tag 'N941' into develop
Tagging hotfix N941 N941
2019-02-13 17:45:46 +01:00
Stephen Abello
456b51d7f8 Merge branch 'master' into develop 2019-02-13 15:03:50 +01:00
Eric
6f0effcc66 Merge tag 'N2016' into develop
Tagging hotfix N2016 N2016
2019-02-13 14:04:27 +01:00
Eric
3dd8f214bf Merge tag 'N2011' into develop
Tagging hotfix N2011 N2011
2019-02-13 12:49:27 +01:00
Eric
d3700ac9f8 Merge tag 'N1963' into develop
Tagging hotfix N1963 N1963
2019-02-13 11:01:42 +01:00
Pierre Goiffon
7aa5d84ff4 💡 Fix PHPDoc for \CMDBSource::GetSqlStringColumnDefinition 2019-02-07 15:06:57 +01:00
Molkobain
46e99bfb40 🐛 Fix notifications tab in objects no longer displaying items (regression introduced by a9bd5a8) 2019-02-07 14:06:06 +01:00
Molkobain
fb5f59e72e 🚨 Fix wrong method visiblity 2019-02-07 14:06:06 +01:00
Molkobain
8af1a53721 💡 PHPDoc 2019-02-07 14:06:06 +01:00
Pierre Goiffon
7034ffea39 N°2010 Fix case for information_schema column names
In MySQL 8, we need to use same case as column declaration, or use an alias
2019-02-07 11:17:19 +01:00
Pierre Goiffon
94ed0354c2 Merge branch 'master' into develop 2019-01-31 18:43:31 +01:00
Pierre Goiffon
2cf3408023 💡 add PhpDoc to AttributeImage methods 2019-01-29 11:08:01 +01:00
Molkobain
3b16d33775 N°1990 Fix setup crash when class has an empty zlist tag (eg. <details />)
Compiler crashed due to PHP warning being output depending on the error reporting level.
2019-01-29 10:36:17 +01:00
Pierre Goiffon
3ff6374ace Merge branch 'master' into develop 2019-01-28 16:04:44 +01:00
Pierre Goiffon
0ea2fed481 💡 fix phpdoc on \utils::GetCurrentModuleDir 2019-01-28 15:58:59 +01:00
Pierre Goiffon
6bbc543ac1 🚸 Change AttributeImage methods visibility to allow overrides 2019-01-28 13:56:20 +01:00
Eric
1ca4f993b0 💚 Fix apc-emulation 2019-01-24 18:07:50 +01:00
Eric Espié
44f448fec4 faster directory creation 2019-01-24 17:22:49 +01:00
Eric
abf7e65816 Avoid unnecessary warnings 2019-01-24 17:22:49 +01:00
Molkobain
55bce63cea Internal: Update compiled CSS file for administration console that seems to not have been committed correctly someday
Fixes:
* Browser dev. tools error about "data:0" on navigation menu
* Newsroom menu
2019-01-24 16:30:36 +01:00
Pierre Goiffon
710e5afe08 🔥 Remove iTopPDF::SetFontSize as there is TCPDF::SetFontSize 2019-01-23 17:36:05 +01:00
Pierre Goiffon
cbf37677cb 📝 README little improvements 2019-01-23 12:06:49 +01:00
Pierre Goiffon
efb98c6414 🔧 Fix invalid composer.json 2019-01-23 12:00:51 +01:00
Pierre Goiffon
01fbcb7044 🎨 replace TCPPDF:SetFont calls by iTopPDF::SetFontParams
This ensures that the same font is used in every caller
2019-01-23 11:46:52 +01:00
Pierre Goiffon
53d2f6320b 💡 Some comments on TCPPDF fonts 2019-01-23 11:44:23 +01:00
Pierre Goiffon
9d02da9d9c 🎨 PDF : new helper method to set only font size 2019-01-23 11:05:12 +01:00
Molkobain
a0841d76db 💄 Portal: Improve modal backdrop UX 2019-01-21 16:03:51 +01:00
Pierre Goiffon
e3c4d611c3 New InvalidConfigParamException
To be used for example in extensions like notify-on-expiration
2019-01-18 11:05:29 +01:00
Pierre Goiffon
79e8c48824 📝 README : update release section 2019-01-18 09:54:35 +01:00
Pierre Goiffon
9ef298608e 🎨 README : move links to corresponding sections 2019-01-18 09:54:35 +01:00
Eric
3ee8d5125b Support for extensions unit tests (scans env-production/*/test) 2019-01-15 11:52:05 +01:00
Eric
59c490fcea Add test for search with 'NOT LIKE' 2019-01-15 11:51:03 +01:00
Eric
b8b468195c PR#39 Fix support of expressions (friendlyname) in different languages context (use class name by language for the expression caches) 2019-01-15 11:24:48 +01:00
Pierre Goiffon
d873a5e68b Remove php ext from composer.json
Not really mandatory, can cause trouble when really using composer !
2019-01-15 09:18:58 +01:00
Eric
6ad27b43ab PR#39 Fix support of expressions (friendlyname) in different language contexts 2019-01-14 11:30:01 +01:00
purplegrape
1df19f65c4 small translation improvement for chinese
1 symbols should not be translated
2 small improvement
2019-01-11 17:31:36 +01:00
Pierre Goiffon
c22a20c1ef Finish readme_2.5.1 2019-01-10 10:29:18 +01:00
Pierre Goiffon
c140ab970e Finish 2.6.0
# Conflicts:
#	core/dbobject.class.php
#	install.txt
2019-01-09 17:27:07 +01:00
Pierre Goiffon
5723e9a77e 🎨 PDF : new helper method to set only font weight and size 2019-01-09 09:25:40 +01:00
Pierre Goiffon
bdedd83368 🔧 New "export_pdf_font" config param 2019-01-09 09:25:40 +01:00
Pierre Goiffon
2f5f92ddca Adding DroidSansFallback font to TCPDF
Modification proposed by @purplegrape with PR #49, many thanks !
2019-01-09 09:24:07 +01:00
Denis Flaven
87a98fe382 🐛 N°1946 - newsroom cache shared between users
The cache should be per user, even if two users share the same
machine/browser.
2019-01-08 15:16:50 +01:00
Stephen Abello
8894ff0fda N°1909: PHP 7.3 compatibility 2019-01-07 13:56:42 +01:00
Eric
488d2ed886 Debug OQL for search is accessible directly for the administrators 2019-01-07 09:43:44 +01:00
Molkobain
48f190447c 🐛 N°1939 REST/JSON: Fix must_exists flag for remote object of indirect linkedset 2019-01-04 17:36:26 +01:00
Duarte Sotto-Mayor Ribeirinho
63184d0bf5 Update link to always reflect latest version
This way there is no need for further updates of version number on link
2019-01-04 11:36:34 +01:00
Eric
a9bd5a8bb0 Avoid scalar values in OQL, replace them with variables 2019-01-02 17:41:56 +01:00
Eric
6c9850b8f6 1814 - Search with criteria : always add default criteria 2019-01-02 14:19:48 +01:00
Eric
e89b4e070c Security update 2019-01-02 10:11:03 +01:00
Pierre Goiffon
911d84d513 N°1885 add php-gd as a mandatory extension
(was made on release/2.6 branch but then rollbacked as this is an infrastructure change that needs to be in the release notes)
2018-12-26 11:05:25 +01:00
Pierre Goiffon
1a3f836a5a Merge remote-tracking branch 'origin/release/2.6' into develop
# Conflicts:
#	application/itopwebpage.class.inc.php
#	core/config.class.inc.php
#	css/css-variables.scss
#	css/light-grey.css
#	datamodels/2.x/itop-attachments/nl.dict.itop-attachments.php
#	datamodels/2.x/itop-incident-mgmt-itil/nl.dict.itop-incident-mgmt-itil.php
#	datamodels/2.x/version.xml
2018-12-21 10:26:17 +01:00
Pierre Goiffon
bb0e797cee Remove Config deprecated methods in v2.7 2018-11-27 15:48:47 +01:00
Molkobain
05d866f0f7 Add chifu1324 to the contributors list! Thanks ✌ 2018-11-13 13:46:29 +01:00
Denis Flaven
e7fbb2273d N°1718 Make attribute image zoomable 2018-11-09 16:56:26 +01:00
chifu1234
91f159841b Update metamodel.class.php
Update metamodel.class.php
2018-11-07 11:05:53 +01:00
Pierre Goiffon
905dba67c3 Some PhpDoc to document api (just a start !) 2018-11-05 17:15:44 +01:00
Thomas Casteleyn
676b83519a Fix typo Incident Impact 2018-11-05 09:43:32 +01:00
Molkobain
0e2c8ff220 Merge pull request #7 from Super-Visions/feature/dutch-dict
Another update for Dutch dictionary
2018-10-29 12:08:15 +01:00
Eric
e39a6b96bd Fixed execution warning in search (not visible in production) 2018-10-26 10:59:21 +02:00
Pierre Goiffon
da1268fc05 update versions 2018-10-24 10:35:01 +02:00
Molkobain
fb07d19a64 Merge branch 'develop' into feature/dutch-dict 2018-10-22 17:28:55 +02:00
Thomas Casteleyn
487e0c8769 Improved error message translation 2018-10-22 10:39:16 +02:00
Thomas Casteleyn
5ee125c593 Actually, kilo should be lowercase 2018-10-18 17:27:14 +02:00
Thomas Casteleyn
4876ae7c22 The use of Bytes instead of octets is more common in Dutch 2018-10-18 17:09:55 +02:00
Thomas Casteleyn
e9b04b923e Merge develop into feature/dutch-dict 2018-09-26 11:22:07 +02:00
Thomas Casteleyn
5d8b9fd4db Added Dutch dictionary for incident management 2018-09-20 16:39:37 +02:00
7095 changed files with 520257 additions and 295649 deletions

View File

@@ -1,8 +1,8 @@
# Phpdoc dokuwiki template
This directory contains a template rendering iTop phpdoc as wiki pages.
This directory contains a template for rendering iTop phpdoc as dokuwiki pages.
conventional tag that you should use:
Conventional tags that you should use:
* `@internal` : exclude from the documentation.
* `@api` : it means that a method is an api, thus it may be interacted with.
* `@see` : it points to another documented method
@@ -14,7 +14,7 @@ conventional tag that you should use:
## Special instructions
some tags where added :
Some iTop specific tags were added :
* `@api-advanced`: it means that a method is an `@api` but mark it also as "complex" to use
* `@overwritable-hook`: used to mark a method as "designed to be extended"
* `@extension-hook`: not used for now
@@ -23,7 +23,7 @@ some tags where added :
### known limitations:
#### `@see` tags must be very specific:
* always prefix class members with `ClassName::`
* always prefix class members (attributes or methods) with `ClassName::` (do not use self)
* for methods always suffix them with `()`,
* do not reference variables since they are not documented. If you have to, always prefix them with `$`
@@ -39,12 +39,12 @@ examples:
#### Do not use inline tags, they do not work properly, example:
```
/**
* This is a texts with ans inline tag {@see [FQSEN] [<description>]} it must never be used
* This is a texts with an inline tag {@see [FQSEN] [<description>]} it must never be used
*/
```
#### The `@example` tag must respect this very precise syntax
* the sentence in the first line (next to the tag) is the title, it must be enclose by double quotes
* the sentence in the first line (next to the tag) is the title, it must be enclosed by double quotes
* the following lines are the sample code.
* 💔 since we simply hack the official tag, this syntax must be respected carefully 💔
example:
@@ -82,14 +82,15 @@ Then, **for a method** of an eligible class:
## Installation
```
cd .doc
composer require phpdocumentor/phpdocumentor:~2 --dev
```
## Generation
`.doc/bin/build-doc-object-manipulation` and `.doc/bin/build-doc-extensions` contains examples of doc. generation, beware: they have to be called from iTop root directory:
`./bin/build-doc-object-manipulation` and `./bin/build-doc-extensions` contains examples of doc. generation, beware: they have to be called from the .doc directory:
```shell
cd /path/to/itop/
./.doc/bin/build-doc-object-manipulation
cd /path/to/itop/.doc
./bin/build-doc-object-manipulation
```
the resulting documentation is written into `data/phpdocumentor/output`
@@ -100,4 +101,3 @@ the resulting documentation is written into `data/phpdocumentor/output`
* the generated files have to be placed under an arbitrary directory of `[/path/to/dokuwiki]/data/pages`.
* the html has to be activated [config:htmlok](https://www.dokuwiki.org/config:htmlok)
* the generated files have to be in lowercase

View File

@@ -1,7 +1,6 @@
#!/bin/sh -x
rm -rf /tmp/phpdoc-twig-cache/ && rm -rf data/phpdocumentor/output/extensions/ && rm -rf data/phpdocumentor/temp/extensions/ && vendor/bin/phpdoc -c .doc/phpdoc-extensions.dist.xml -vvv
rm -rf /tmp/phpdoc-twig-cache/ && rm -rf data/phpdocumentor/output/extensions/ && rm -rf data/phpdocumentor/temp/extensions/ && .doc/vendor/bin/phpdoc -c .doc/phpdoc-extensions.dist.xml -vvv
# now wee need to lowercase every generated file because dokuwiki can't handle uppercase
cd data/phpdocumentor/output/extensions/
for i in $( ls | grep [A-Z] ); do mv -i $i `echo $i | tr 'A-Z' 'a-z'`; done
cd data/phpdocumentor/output/extensions/ && for i in $( ls | grep [A-Z] ); do mv -i $i `echo $i | tr 'A-Z' 'a-z'`; done

View File

@@ -1,8 +1,7 @@
#!/bin/sh -x
rm -rf /tmp/phpdoc-twig-cache/ && rm -rf data/phpdocumentor/output/objects-manipulation/ && rm -rf data/phpdocumentor/temp/objects-manipulation/ && vendor/bin/phpdoc -c .doc/phpdoc-objects-manipulation.dist.xml -vvv
rm -rf /tmp/phpdoc-twig-cache/ && rm -rf ../data/phpdocumentor/output/objects-manipulation/ && rm -rf ../data/phpdocumentor/temp/objects-manipulation/ && ./vendor/bin/phpdoc -c ./phpdoc-objects-manipulation.dist.xml -vvv
# now wee need to lowercase every generated file because dokuwiki can't handle uppercase
cd data/phpdocumentor/output/objects-manipulation/
for i in $( ls | grep [A-Z] ); do mv -i $i `echo $i | tr 'A-Z' 'a-z'`; done
cd ../data/phpdocumentor/output/objects-manipulation/ && for i in $( ls | grep [A-Z] ); do mv -i $i `echo $i | tr 'A-Z' 'a-z'`; done

6
.doc/composer.json Normal file
View File

@@ -0,0 +1,6 @@
{
"require-dev": {
"phpdocumentor/phpdocumentor": "~2",
"jms/serializer": "1.7.*"
}
}

3015
.doc/composer.lock generated Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -18,7 +18,7 @@
{{ structure.summary|raw }}
[[{{structureName}}|More informations]]
[[{{structureName}}|More information]]
</WRAP>{# group #}

View File

@@ -6,14 +6,14 @@ end_of_line = lf
indent_size = 4
indent_style = space
insert_final_newline = false
max_line_length = 140
max_line_length = 300
tab_width = 4
ij_continuation_indent_size = 8
ij_formatter_off_tag = @formatter:off
ij_formatter_on_tag = @formatter:on
ij_formatter_tags_enabled = false
ij_smart_tabs = false
ij_visual_guides = 80,120
ij_visual_guides = 300
ij_wrap_on_typing = true
[*.css]
@@ -90,7 +90,7 @@ ij_xml_attribute_wrap = normal
ij_xml_block_comment_at_first_column = true
ij_xml_keep_blank_lines = 2
ij_xml_keep_indents_on_empty_lines = false
ij_xml_keep_line_breaks = false
ij_xml_keep_line_breaks = true
ij_xml_keep_line_breaks_in_text = true
ij_xml_keep_whitespaces = false
ij_xml_keep_whitespaces_around_cdata = preserve
@@ -110,6 +110,7 @@ ij_shell_keep_column_alignment_padding = false
ij_shell_minify_program = false
ij_shell_redirect_followed_by_space = false
ij_shell_switch_cases_indented = false
ij_shell_use_unix_line_separator = true
[{*.cjs,*.js}]
indent_style = tab
@@ -279,7 +280,7 @@ ij_javascript_while_brace_force = always
ij_javascript_while_on_new_line = false
ij_javascript_wrap_comments = false
[{*.ctp,*.hphp,*.inc,*.module,*.php,*.php4,*.php5,*.phtml}]
[{*.ctp, *.hphp, *.inc, *.module, *.php, *.php4, *.php5, *.phtml}]
indent_style = tab
ij_continuation_indent_size = 4
ij_smart_tabs = true
@@ -288,8 +289,8 @@ ij_php_align_assignments = false
ij_php_align_class_constants = false
ij_php_align_group_field_declarations = false
ij_php_align_inline_comments = false
ij_php_align_key_value_pairs = false
ij_php_align_multiline_array_initializer_expression = false
ij_php_align_key_value_pairs = true
ij_php_align_multiline_array_initializer_expression = true
ij_php_align_multiline_binary_operation = false
ij_php_align_multiline_chained_methods = false
ij_php_align_multiline_extends_list = false
@@ -514,7 +515,7 @@ ij_json_wrap_long_lines = false
indent_style = tab
ij_smart_tabs = true
ij_visual_guides = none
ij_html_add_new_line_before_tags = body, div, p, form, h1, h2, h3
ij_html_add_new_line_before_tags = body,div,p,form,h1,h2,h3
ij_html_align_attributes = true
ij_html_align_text = false
ij_html_attribute_wrap = normal
@@ -541,7 +542,21 @@ ij_html_space_inside_empty_tag = false
ij_html_text_wrap = normal
ij_html_uniform_ident = false
[{*.yaml, *.yml}]
[{*.markdown,*.md}]
ij_visual_guides = none
ij_markdown_force_one_space_after_blockquote_symbol = true
ij_markdown_force_one_space_after_header_symbol = true
ij_markdown_force_one_space_after_list_bullet = true
ij_markdown_force_one_space_between_words = true
ij_markdown_keep_indents_on_empty_lines = false
ij_markdown_max_lines_around_block_elements = 1
ij_markdown_max_lines_around_header = 1
ij_markdown_max_lines_between_paragraphs = 1
ij_markdown_min_lines_around_block_elements = 1
ij_markdown_min_lines_around_header = 1
ij_markdown_min_lines_between_paragraphs = 1
[{*.yaml,*.yml}]
indent_size = 2
ij_visual_guides = none
ij_yaml_align_values_properties = do_not_align

48
.gitattributes vendored Normal file
View File

@@ -0,0 +1,48 @@
# Set the default behavior, in case people don't have core.autocrlf set.
* text=auto
# Explicitly declare text files you want to always be normalized and converted
# to native line endings on checkout.
*.bash text eol=lf
*.bat text eol=lf
*.cmd text eol=lf
*.css text eol=lf
*.scss text eol=lf
*.dist text eol=lf
.editorconfig text eol=lf
.env* text eol=lf
.gitignore text eol=lf
.htaccess text eol=lf
*.htm text eol=lf
*.html text eol=lf
*.ini text eol=lf
*.js text eol=lf
*.json text eol=lf
*.lock text eol=lf
*.md text eol=lf
*.php text eol=lf
*.php_cs text eol=lf
*.php8 text eol=lf
*.plex text eol=lf
*.sh text eol=lf
*.svg text eol=lf
*.ts text eol=lf
*.twig text eol=lf
*.txt text eol=lf
*.xml text eol=lf
*.xsd text eol=lf
*.yaml text eol=lf
*.yml text eol=lf
# Denote all files that are truly binary and should not be modified.
*.png binary
*.jpeg binary
*.jpg binary
*.gif binary
*.ico binary
*.pdf binary
*.swf binary
*.zip binary
*.ttf binary
*.woff binary
*.woff2 binary

83
.github/pull_request_template.md vendored Normal file
View File

@@ -0,0 +1,83 @@
<!--
IMPORTANT: Please follow the guidelines within this PR template before submitting it, it will greatly help us process your PR. 🙏
Any PRs not following the guidelines or with missing information will not be considered.
-->
## Base information
| Question | Answer
|---------------------------------------------------------------|--------
| Related to a SourceForge thead / Another PR / Combodo ticket? | <!-- Put the URL -->
| Type of change? | Bug fix / Enhancement / Translations
## Symptom (bug) / Objective (enhancement)
<!--
If it's a bug
- Explain the symptom in details
- If possible put error messages, logs or screenshots (you can paste image directly in this editor).
If it's an enhancement
- Describe what is blocking you, what is the objective with as much details as possible.
- Add screenshots if it's related to UI.
-->
## Reproduction procedure (bug)
<!--
Remove this section only if it's NOT a bug.
Otherwise, explain step by step how to reproduce the issue on a standard iTop Community.
If it requires a custom datamodel, provide the minimal XML delta to reproduce it on a standard iTop Community.
-->
1. On iTop x.y.z <!-- Put complete iTop version (eg. 3.1.0-2) -->
2. With PHP x.y.z <!-- Put complete PHP version (eg. 8.1.24) -->
2. First go there
2. Then do that
3. ...
4. Finally, see that...
## Cause (bug)
<!--
Remove this section only if it's NOT a bug.
Otherwise, explain what is the cause of the issue (where in the code and why)
-->
## Proposed solution (bug and enhancement)
<!--
Explain in details how you are proposing to solve this:
- What did you do in the code and why
- If you changed something in the UI, put before / after screenshots (you can paste image directly in this editor)
-->
## Checklist before requesting a review
<!--
Don't remove these lines, check them once done.
-->
- [ ] I have performed a self-review of my code
- [ ] I have tested all changes I made on an iTop instance
- [ ] I have added a unit test, otherwise I have explained why I couldn't
- [ ] Is the PR clear and detailed enough so anyone can understand digging in the code?
## Checklist of things to do before PR is ready to merge
<!--
Things that needs to be done in the PR before it can be considered as ready to be merged
Examples:
- Changes requested in the review
- Unit test to add
- Dictionary entries to translate
- ...
-->
- [ ] ...
- [ ] ...
- [ ] ...

43
.github/workflows/action.yml vendored Normal file
View File

@@ -0,0 +1,43 @@
name: Add PRs to Combodo PRs Dashboard
on:
pull_request_target:
types:
- opened
jobs:
add-to-project:
name: Add PR to Combodo Project
runs-on: ubuntu-latest
steps:
- name: Check if author is a member of the organization
id: check-membership
run: |
ORG="Combodo"
AUTHOR=$(jq -r .pull_request.user.login "$GITHUB_EVENT_PATH")
RESPONSE=$(curl -s -o /dev/null -w "%{http_code}" -H "Authorization: token ${{ secrets.PR_AUTOMATICALLY_ADD_TO_PROJECT }}" \
"https://api.github.com/orgs/$ORG/members/$AUTHOR")
if [ "$RESPONSE" == "404" ]; then
echo "project_url=https://github.com/orgs/Combodo/projects/5" >> $GITHUB_ENV
echo "is_member=false" >> $GITHUB_ENV
else
echo "project_url=https://github.com/orgs/Combodo/projects/4" >> $GITHUB_ENV
echo "is_member=true" >> $GITHUB_ENV
fi
- name: Add internal tag if member
if: env.is_member == 'true'
run: |
curl -X POST -H "Authorization: token ${{ secrets.PR_AUTOMATICALLY_ADD_TO_PROJECT }}" \
-H "Accept: application/vnd.github.v3+json" \
https://api.github.com/repos/Combodo/iTop/issues/${{ github.event.pull_request.number }}/labels \
-d '{"labels":["internal"]}'
env:
is_member: ${{ env.is_member }}
- name: Add PR to the appropriate project
uses: actions/add-to-project@v1.0.2
with:
project-url: ${{ env.project_url }}
github-token: ${{ secrets.PR_AUTOMATICALLY_ADD_TO_PROJECT }}

24
.gitignore vendored
View File

@@ -3,13 +3,17 @@
/toolkit
/env-*
# maintenance mode (N°2240)
/.maintenance
# composer reserver directory, from sources, populate/update using "composer install"
vendor/*
test/vendor/*
tests/*/vendor/*
# all conf but listing prevention
/conf/**
!/conf/.htaccess
!/conf/index.php
!/conf/web.config
# all datas but listing prevention
@@ -20,7 +24,9 @@ test/vendor/*
# iTop extensions
/extensions/**
!/extensions/.htaccess
!/extensions/readme.txt
!/extensions/web.config
# all logs but listing prevention
/log/**
@@ -28,14 +34,19 @@ test/vendor/*
!/log/index.php
!/log/web.config
# PHPUnit: Cache file, local XML working copies
/tests/php-unit-tests/.phpunit.result.cache
/tests/php-unit-tests/phpunit.xml
/tests/php-unit-tests/postbuild_integration.xml
# Jetbrains
/.idea/**
!/.idea/encodings.xml
!/.idea/codeStyles
!/.idea/codeStyles/*
!/.idea/inspectionProfiles
!/.idea/inspectionProfiles/*
!/.idea/IntelliLang.xml
# doc. generation
/.doc/vendor
#phpdocumentor temp file
ast.dump
@@ -126,4 +137,3 @@ local.properties
.cache-main
.scala_dependencies
.worksheet

15
.idea/IntelliLang.xml generated Normal file
View File

@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="LanguageInjectionConfiguration">
<injection language="InjectablePHP" injector-id="xml">
<display-name>iTop - Class method code</display-name>
<place><![CDATA[xmlTag().withLocalName(string().equalTo("code"))]]></place>
<xpath-condition>name(..) = 'method' and count(/itop_design) = 1</xpath-condition>
</injection>
<injection language="InjectablePHP" injector-id="xml">
<display-name>iTop - Snippet code</display-name>
<place><![CDATA[xmlTag().withLocalName(string().equalTo("snippet"))]]></place>
<xpath-condition>name(..) = 'snippets' and count(/itop_design) = 1</xpath-condition>
</injection>
</component>
</project>

View File

@@ -1,57 +0,0 @@
<component name="ProjectCodeStyleConfiguration">
<code_scheme name="Project" version="173">
<option name="LINE_SEPARATOR" value="&#10;" />
<option name="RIGHT_MARGIN" value="320" />
<HTMLCodeStyleSettings>
<option name="HTML_DO_NOT_INDENT_CHILDREN_OF" value="html,body,thead,tbody,tfoot,script,style" />
<option name="HTML_DO_NOT_ALIGN_CHILDREN_OF_MIN_LINES" value="4" />
</HTMLCodeStyleSettings>
<PHPCodeStyleSettings>
<option name="CONCAT_SPACES" value="false" />
<option name="PHPDOC_BLANK_LINE_BEFORE_TAGS" value="true" />
<option name="PHPDOC_BLANK_LINES_AROUND_PARAMETERS" value="true" />
<option name="PHPDOC_WRAP_LONG_LINES" value="true" />
<option name="LOWER_CASE_BOOLEAN_CONST" value="true" />
<option name="LOWER_CASE_NULL_CONST" value="true" />
<option name="BLANK_LINES_BEFORE_RETURN_STATEMENT" value="1" />
<option name="KEEP_RPAREN_AND_LBRACE_ON_ONE_LINE" value="true" />
<option name="PHPDOC_USE_FQCN" value="true" />
</PHPCodeStyleSettings>
<codeStyleSettings language="JavaScript">
<option name="BRACE_STYLE" value="2" />
<option name="ELSE_ON_NEW_LINE" value="true" />
<option name="IF_BRACE_FORCE" value="3" />
<indentOptions>
<option name="USE_TAB_CHARACTER" value="true" />
</indentOptions>
</codeStyleSettings>
<codeStyleSettings language="PHP">
<option name="RIGHT_MARGIN" value="320" />
<option name="BLANK_LINES_AFTER_PACKAGE" value="1" />
<option name="BRACE_STYLE" value="2" />
<option name="ELSE_ON_NEW_LINE" value="true" />
<option name="ALIGN_MULTILINE_PARAMETERS" value="false" />
<option name="SPACE_BEFORE_FOR_PARENTHESES" value="false" />
<option name="CALL_PARAMETERS_WRAP" value="1" />
<option name="METHOD_PARAMETERS_WRAP" value="1" />
<option name="METHOD_PARAMETERS_LPAREN_ON_NEXT_LINE" value="true" />
<option name="METHOD_PARAMETERS_RPAREN_ON_NEXT_LINE" value="true" />
<option name="ARRAY_INITIALIZER_WRAP" value="5" />
<option name="ARRAY_INITIALIZER_LBRACE_ON_NEXT_LINE" value="true" />
<option name="ARRAY_INITIALIZER_RBRACE_ON_NEXT_LINE" value="true" />
<option name="IF_BRACE_FORCE" value="3" />
<option name="DOWHILE_BRACE_FORCE" value="3" />
<option name="WHILE_BRACE_FORCE" value="3" />
<option name="FOR_BRACE_FORCE" value="3" />
<indentOptions>
<option name="USE_TAB_CHARACTER" value="true" />
<option name="SMART_TABS" value="true" />
</indentOptions>
</codeStyleSettings>
<codeStyleSettings language="XML">
<indentOptions>
<option name="USE_TAB_CHARACTER" value="true" />
</indentOptions>
</codeStyleSettings>
</code_scheme>
</component>

View File

@@ -1,5 +0,0 @@
<component name="ProjectCodeStyleConfiguration">
<state>
<option name="PREFERRED_PROJECT_CODE_STYLE" value="Combodo" />
</state>
</component>

6
.idea/encodings.xml generated
View File

@@ -1,6 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="Encoding" defaultCharsetForPropertiesFiles="UTF-8">
<file url="PROJECT" charset="UTF-8" />
</component>
</project>

View File

@@ -1,44 +0,0 @@
<component name="InspectionProjectProfileManager">
<profile version="1.0">
<option name="myName" value="Combodo" />
<inspection_tool class="InconsistentLineSeparators" enabled="true" level="WARNING" enabled_by_default="true" />
<inspection_tool class="MysqlParsingInspection" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="PhpIncludeInspection" enabled="true" level="WEAK WARNING" enabled_by_default="true" />
<inspection_tool class="PhpMethodParametersCountMismatchInspection" enabled="true" level="ERROR" enabled_by_default="true" />
<inspection_tool class="PhpTooManyParametersInspection" enabled="true" level="WARNING" enabled_by_default="true">
<option name="limit" value="7" />
</inspection_tool>
<inspection_tool class="PhpUndefinedClassInspection" enabled="true" level="WARNING" enabled_by_default="true">
<option name="DONT_REPORT_MULTI_RESOLVE" value="true" />
</inspection_tool>
<inspection_tool class="PhpUndefinedMethodInspection" enabled="true" level="WEAK WARNING" enabled_by_default="true" />
<inspection_tool class="PhpUnhandledExceptionInspection" enabled="true" level="WEAK WARNING" enabled_by_default="true" />
<inspection_tool class="PhpUnusedLocalVariableInspection" enabled="true" level="WEAK WARNING" enabled_by_default="true">
<option name="DONT_REPORT_INSIDE_LIST" value="true" />
</inspection_tool>
<inspection_tool class="PhpUnusedParameterInspection" enabled="true" level="WEAK WARNING" enabled_by_default="true">
<option name="DONT_REPORT_ABSTRACT_CLASS" value="true" />
</inspection_tool>
<inspection_tool class="SqlAddNotNullColumnInspection" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="SqlAmbiguousColumnInspection" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="SqlAutoIncrementDuplicateInspection" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="SqlCheckUsingColumnsInspection" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="SqlConstantConditionInspection" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="SqlDeprecateTypeInspection" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="SqlDerivedTableAliasInspection" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="SqlDialectInspection" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="SqlDropIndexedColumnInspection" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="SqlIdentifierInspection" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="SqlInsertValuesInspection" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="SqlNoDataSourceInspection" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="SqlNullComparisonInspection" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="SqlPostgresqlSelectFromProcedureInspection" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="SqlResolveInspection" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="SqlShouldBeInGroupByInspection" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="SqlSideEffectsInspection" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="SqlSignatureInspection" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="SqlStorageInspection" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="SqlTypeInspection" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="SqlUnusedVariableInspection" enabled="false" level="WARNING" enabled_by_default="false" />
</profile>
</component>

View File

@@ -1,19 +0,0 @@
<component name="InspectionProjectProfileManager">
<profile version="1.0">
<option name="myName" value="Project Default" />
<inspection_tool class="InconsistentLineSeparators" enabled="true" level="WARNING" enabled_by_default="true" />
<inspection_tool class="PhpIncludeInspection" enabled="true" level="WEAK WARNING" enabled_by_default="true" />
<inspection_tool class="PhpMethodParametersCountMismatchInspection" enabled="true" level="ERROR" enabled_by_default="true" />
<inspection_tool class="PhpTooManyParametersInspection" enabled="true" level="WARNING" enabled_by_default="true">
<option name="limit" value="7" />
</inspection_tool>
<inspection_tool class="PhpUndefinedClassInspection" enabled="true" level="WARNING" enabled_by_default="true">
<option name="DONT_REPORT_MULTI_RESOLVE" value="true" />
</inspection_tool>
<inspection_tool class="PhpUnhandledExceptionInspection" enabled="true" level="WEAK WARNING" enabled_by_default="true" />
<inspection_tool class="PhpUnusedParameterInspection" enabled="true" level="WEAK WARNING" enabled_by_default="true">
<option name="DONT_REPORT_ABSTRACT_CLASS" value="true" />
</inspection_tool>
<inspection_tool class="SqlNoDataSourceInspection" enabled="false" level="WARNING" enabled_by_default="false" />
</profile>
</component>

View File

@@ -1,6 +0,0 @@
<component name="InspectionProjectProfileManager">
<settings>
<option name="PROJECT_PROFILE" value="Combodo" />
<version value="1.0" />
</settings>
</component>

6
.make/README.md Normal file
View File

@@ -0,0 +1,6 @@
= Make Doc =
.make folder is meant to gather tools for releasing process. Maybe other new purposes will come as well....
== license ==
- updateLicenses.php: used to update community-licenses.xml easily based on composer.json files
- sortLicenceXml.php: used to sort licenses based on scope + product name

View File

@@ -0,0 +1,90 @@
<?php
$iBeginTime = time();
chdir(__DIR__);
$aCommands = [
'php composer/rmDeniedTestDir.php',
'php build/commands/setupCssCompiler.php',
// 'bash /tmp/gabuzomeu.sh',
];
$aFailedCommands=[];
foreach ($aCommands as $sCommand)
{
if (!ExecCommand($sCommand))
{
$aFailedCommands[] = $sCommand;
}
}
$iElapsed = time() - $iBeginTime;
if (count($aFailedCommands))
{
fwrite(STDERR, "\nafterBuild execution failed! (in ${iElapsed}s)\n");
fwrite(STDERR, "List of failling commands:\n - " . implode("\n - ", $aFailedCommands) . "\n");
exit(1);
}
echo "\nDone (${iElapsed}s)\n";
exit(0);
/**
* Executes a command and returns an array with exit code, stdout and stderr content
*
* @param string $cmd - Command to execute
*
* @return bool
* @throws \Exception
*/
function ExecCommand($cmd) {
$iBeginTime = time();
echo sprintf("command: %s", str_pad("$cmd ", 50));
$descriptorspec = array(
0 => array("pipe", "r"), // stdin
1 => array("pipe", "w"), // stdout
2 => array("pipe", "w"), // stderr
);
$process = proc_open($cmd, $descriptorspec, $pipes, __DIR__ . '/..', null);
$stdout = stream_get_contents($pipes[1]);
fclose($pipes[1]);
$stderr = stream_get_contents($pipes[2]);
fclose($pipes[2]);
$iCode = proc_close($process);
$bSuccess = (0 === $iCode);
$iElapsed = time() - $iBeginTime;
if (!$bSuccess) {
fwrite(STDERR, sprintf(
"\nCOMMAND FAILED! (%s) \n - status:%s \n - stderr:%s \n - stdout: %s\n - elapsed:%ss\n\n",
$cmd,
$iCode,
rtrim($stderr),
rtrim($stdout),
$iElapsed
));
}
else
{
echo "| elapsed:${iElapsed}s \n";
}
if (!empty($stderr))
{
fwrite(STDERR, "$stderr\n");
}
if (!empty($stdout))
{
echo "stdout :$stdout\n\n";
}
return $bSuccess;
}

View File

@@ -0,0 +1,51 @@
<?php
/**
* Copyright (C) 2010-2020 Combodo SARL
*
* This file is part of iTop.
*
* iTop is free software; you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* iTop 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 Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with iTop. If not, see <http: *www.gnu.org/licenses/>
*
*/
use Combodo\iTop\Composer\iTopComposer;
$iTopFolder = __DIR__."/../../../";
require_once("$iTopFolder/approot.inc.php");
require_once(APPROOT."/application/utils.inc.php");
if (PHP_SAPI !== 'cli')
{
throw new \Exception('This script can only run from CLI');
}
$sCssFile = APPROOT.'/css/setup.css';
if (file_exists($sCssFile))
{
fwrite(STDERR, "$sCssFile already exists (it should not), removing it.");
if (!unlink($sCssFile))
{
fwrite(STDERR, "Failed to remove $sCssFile, exiting.");
exit(1);
}
}
$sCssRelPath = utils::GetCSSFromSASS('css/setup.scss');
if (!file_exists($sCssFile))
{
fwrite(STDERR, "Failed to compile $sCssFile, exiting.");
exit(1);
}

View File

@@ -0,0 +1,98 @@
<?php
/**
* Copyright (C) 2010-2020 Combodo SARL
*
* This file is part of iTop.
*
* iTop is free software; you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* iTop 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 Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with iTop. If not, see <http: *www.gnu.org/licenses/>
*
*/
$iTopFolder = __DIR__ . "/../../" ;
require_once ("$iTopFolder/approot.inc.php");
$sApproot = APPROOT;
$aTrace = array();
$aParamsConfig = array(
'composer-path' => array(
'default' => 'composer.phar',
)
);
$aParamsConfigNotFound = array_flip(array_keys($aParamsConfig));
$aGivenArgs = $argv;
unset($aGivenArgs[0]);
$aParams = array();
foreach ($aParamsConfig as $sParam => $aConfig)
{
$bParamsFound = false;
foreach ($aGivenArgs as $sGivenArg)
{
if (preg_match("/--$sParam(?:=(?<value>.*))?$/", $sGivenArg, $aMatches))
{
$aParams[$sParam] =
isset($aMatches['value'])
? $aMatches['value']
: true
;
$bParamsFound = true;
unset($aGivenArgs[$sGivenArg]);
}
}
if ($bParamsFound)
{
unset($aParamsConfigNotFound[$sParam]);
}
}
foreach ($aParamsConfigNotFound as $sParamsConfigNotFound => $void)
{
if (isset($aParamsConfig[$sParamsConfigNotFound]['default']))
{
$aParams[$sParamsConfigNotFound] = $aParamsConfig[$sParamsConfigNotFound]['default'];
$aTrace[] = "\e[1;30mUsing default value '{$aParams[$sParamsConfigNotFound]}' for '$sParamsConfigNotFound'\e[0m\n";
continue;
}
die("Missing '$sParamsConfigNotFound'");
}
echo "This command aims at helping you find upgradable dependencies\n";
echo "\e[0;33mBeware of the version colored in orange, they probably introduce BC breaks!\e[0m\n";
$sCommand = "{$aParams['composer-path']} show -loD --working-dir=$sApproot --ansi";
$execCode = exec($sCommand, $output);
$sOutput = implode("\n", $output)."\n";
if (!$execCode)
{
echo "\e[41mFailed to execute '$sCommand'\e[0m\n";
echo "Trace: \n".implode("\n", $aTrace);
}
else
{
$iCountDepdendenciesFound = count($output);
$iCountBc = substr_count($sOutput, '[33m');
echo sprintf("Found \033[44m%d\033[0m upgradable dependencies, including \e[41m%s BC break\e[0m 😱 :\n\n", $iCountDepdendenciesFound, $iCountBc);
}
echo $sOutput;

View File

@@ -0,0 +1,73 @@
<?php
/**
* Copyright (C) 2010-2020 Combodo SARL
*
* This file is part of iTop.
*
* iTop is free software; you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* iTop 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 Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with iTop. If not, see <http: *www.gnu.org/licenses/>
*
*/
use Combodo\iTop\Composer\iTopComposer;
$iTopFolder = __DIR__ . "/../../" ;
require_once ("$iTopFolder/approot.inc.php");
require_once (APPROOT."/setup/setuputils.class.inc.php");
if (PHP_SAPI !== 'cli')
{
throw new \Exception('This script can only run from CLI');
}
clearstatcache();
$oiTopComposer = new iTopComposer();
$aDeniedButStillPresent = $oiTopComposer->ListDeniedButStillPresent();
echo "\n";
foreach ($aDeniedButStillPresent as $sDir)
{
if (false === iTopComposer::IsTestDir($sDir))
{
echo "ERROR found INVALID denied test dir: '$sDir'\n";
throw new \Exception("$sDir must end with /Test/ or /test/");
}
if (false === file_exists($sDir)) {
echo "INFO $sDir is in denied list, but not existing on disk => skipping !\n";
continue;
}
try {
SetupUtils::rrmdir($sDir);
echo "OK Remove denied test dir: '$sDir'\n";
}
catch (\Exception $e) {
echo "\nFAILED to remove denied test dir: '$sDir'\n";
}
}
$aAllowedAndDeniedDirs = array_merge(
$oiTopComposer->ListAllowedTestDir(),
$oiTopComposer->ListDeniedTestDir()
);
$aExistingDirs = $oiTopComposer->ListAllTestDir();
$aMissing = array_diff($aExistingDirs, $aAllowedAndDeniedDirs);
if (false === empty($aMissing)) {
echo "Some new tests dirs exists !\n"
.' They must be declared either in the allowed or denied list in '.iTopComposer::class." (see N°2651).\n"
.' List of dirs:'."\n".var_export($aMissing, true);
}

View File

@@ -0,0 +1,90 @@
#/bin/bash
#git diff --name-status 2.6.2..HEAD js |grep 'A\sjs/' |awk -F/ '{printf("lib/%s/%s\n",$2,$3)}'|sort |uniq >/tmp/toto
#git diff --name-status 2.6.2..HEAD lib |grep 'A\slib/' |awk -F/ '{printf("lib/%s/%s\n",$2,$3)}'|sort |uniq >/tmp/toto
function HELP(){
echo " Syntax: bash $0 /var/www/html/iTop"
}
if [ $# -eq 0 ]
then
echo "no iTop path provided"
HELP
exit 1
fi
iTopPath=$1
if [ ! -d $iTopPath ]
then
echo "$iTopPath is not an iTop path."
HELP
exit 1
fi
echo "<?xml version=\"1.0\"?>
<licenses>"
for subfolder in lib datamodels
do
for l in $(find $iTopPath/$subfolder/ -name composer.json|sed 's|/composer.json||')
do
if [ ! -d $l ]
then
continue
fi
if [ "$subfolder" == "datamodels" ]
then
if [ $(find $l -name module*.php|wc -l) -ne 0 -o $(echo "$l"|grep -c "itop-portal-base") -ne 0 ]
then
continue
fi
fi
dir=$(dirname $(dirname $l))
prod=$(echo $l| sed "s|$dir/||1")
echo $l $subfolder
lictype=$(cd $l && composer licenses --format json |jq .license[] |sed 's|\"||g')
authors=""
if [ -f $l/composer.json ]
then
author_nb=$(grep -c authors $l/composer.json|sed 's| ||g')
if [ "x$author_nb" != "x0" ]
then
OLDIFS=$IFS
IFS=$'\n'
for a in $(cat $l/composer.json |jq .authors[].name|sed 's|\"||g')
do
authors="$authors$a - "
done
authors="$authors#"
authors=$(echo $authors |sed 's| - #||')
IFS=$OLDIFS
fi
fi
lic=""
for licf in $(find $l -name LICEN*)
do
lic=$(cat $licf)
break
done
#if [ "x$lic" == "x" ]
#then
# echo "============== no license found $l"
#fi
echo " <license>
<product scope=\"$subfolder\">$prod</product>
<author>$authors</author>
<license_type>$lictype</license_type>
<text><![CDATA[
$lic
]]></text>
</license>"
done
done
echo "</licenses>"

View File

@@ -0,0 +1,64 @@
<?php
/**
* script used to sort license file (usefull for autogeneration)
* Example:
*/
$iTopFolder = __DIR__ . "/../../" ;
$xmlFilePath = $iTopFolder . "setup/licenses/community-licenses.xml";
$dom = new DOMDocument();
$dom->load($xmlFilePath);
$xp = new DOMXPath($dom);
$licenseList = $xp->query('/licenses/license');
$licenses = iterator_to_array($licenseList);
function get_scope($product_node)
{
$scope = $product_node->getAttribute("scope");
if ($scope === "")
{ //put iTop first
return "aaaaaaaaa";
}
return $scope;
}
function get_product_node($license_node)
{
foreach ($license_node->childNodes as $child)
{
if (is_a($child, 'DomElement') && $child->tagName === "product")
{
return $child;
}
}
return null;
}
function sort_by_product($a, $b)
{
$aProductNode = get_product_node($a);
$bProductNode = get_product_node($b);
$res = strcmp(get_scope($aProductNode), get_scope($bProductNode));
if ($res !== 0)
{
return $res;
}
//sort on node product name
return strcmp($aProductNode->nodeValue, $bProductNode->nodeValue);
}
usort($licenses, 'sort_by_product');
$newdom = new DOMDocument("1.0");
$newdom->formatOutput = true;
$root = $newdom->createElement("licenses");
$newdom->appendChild($root);
foreach ($licenses as $b) {
$node = $newdom->importNode($b,true);
$root->appendChild($newdom->importNode($b,true));
}
$newdom->save($xmlFilePath);

View File

@@ -0,0 +1,155 @@
<?php
/**
* script used to sort license file (useful for autogeneration)
*
* Requirements :
* * bash (on Windows, use Git Bash)
* * composer (if you use the phar version, mind to create a `Composer` alias !)
* * JQ command
* to install on Windows :
* `curl -L -o /usr/bin/jq.exe https://github.com/stedolan/jq/releases/latest/download/jq-win64.exe`
* this is a Windows port : https://stedolan.github.io/jq/
*
* Licenses sources :
* * `composer licenses --format json` (see https://getcomposer.org/doc/03-cli.md#licenses)
* * keep every existing nodes with `/licenses/license[11]/product/@scope` not in ['lib', 'datamodels']
* ⚠ If licenses were added manually, they might be removed by this tool ! Be very careful to check for the result before pushing !
*
* To launch, check requirements and run `php updateLicenses.php`
* The target license file path is in `$xmlFilePath`
*/
$iTopFolder = __DIR__."/../../";
$xmlFilePath = $iTopFolder."setup/licenses/community-licenses.xml";
$jqExec = shell_exec("jq -V"); // a param is mandatory otherwise the script will freeze
if ((null === $jqExec) || (false === $jqExec)) {
echo "/!\ JQ is required but cannot be launched :( \n";
echo "Check this script PHPDoc block for instructions\n";
die(-1);
}
function get_scope($product_node) {
$scope = $product_node->getAttribute("scope");
if ($scope === "") { //put iTop first
return "aaaaaaaaa";
}
return $scope;
}
function get_product_node($license_node)
{
foreach ($license_node->childNodes as $child)
{
if (is_a($child, 'DomElement') && $child->tagName === "product")
{
return $child;
}
}
return null;
}
function sort_by_product($a, $b)
{
$aProductNode = get_product_node($a);
$bProductNode = get_product_node($b);
$res = strcmp(get_scope($aProductNode), get_scope($bProductNode));
if ($res !== 0)
{
return $res;
}
//sort on node product name
return strcmp($aProductNode->nodeValue, $bProductNode->nodeValue);
}
function get_license_nodes($file_path)
{
$dom = new DOMDocument();
$dom->load($file_path);
$xp = new DOMXPath($dom);
$licenseList = $xp->query('/licenses/license');
$licenses = iterator_to_array($licenseList);
usort($licenses, 'sort_by_product');
return $licenses;
}
/** @noinspection SuspiciousAssignmentsInspection */
function fix_product_name(DOMNode &$oProductNode)
{
$sProductNameOrig = $oProductNode->nodeValue;
// sample : `C:\Dev\wamp64\www\itop-27\.make\license/../..//lib/symfony/polyfill-ctype`
$sProductNameFixed = remove_dir_from_string($sProductNameOrig, 'lib/');
// sample : `C:\Dev\wamp64\www\itop-27\.make\license/../..//datamodels/2.x/authent-cas/vendor/apereo/phpcas`
$sProductNameFixed = remove_dir_from_string($sProductNameFixed, 'vendor/');
$oProductNode->nodeValue = $sProductNameFixed;
}
function remove_dir_from_string($sString, $sNeedle)
{
if (strpos($sString, $sNeedle) === false) {
return $sString;
}
$sStringTmp = strstr($sString, $sNeedle);
$sStringFixed = str_replace($sNeedle, '', $sStringTmp);
// DEBUG trace O:)
// echo "$sNeedle = $sString => $sStringFixed\n";
return $sStringFixed;
}
$old_licenses = get_license_nodes($xmlFilePath);
//generate file with updated licenses
$generated_license_file_path = __DIR__."/provfile.xml";
echo "- Generating licences...";
exec("bash ".__DIR__."/gen-community-license.sh $iTopFolder > ".$generated_license_file_path);
echo "OK!\n";
echo "- Get licenses nodes...";
$new_licenses = get_license_nodes($generated_license_file_path);
unlink($generated_license_file_path);
foreach ($old_licenses as $b) {
$aProductNode = get_product_node($b);
if (get_scope($aProductNode) !== "lib" && get_scope($aProductNode) !== "datamodels") {
$new_licenses[] = $b;
}
}
usort($new_licenses, 'sort_by_product');
echo "OK!\n";
echo "- Overwritting Combodo license file...";
$new_dom = new DOMDocument("1.0");
$new_dom->formatOutput = true;
$root = $new_dom->createElement("licenses");
$new_dom->appendChild($root);
foreach ($new_licenses as $b) {
$node = $new_dom->importNode($b, true);
// N°3870 fix when running script in Windows
// fix should be in gen-community-license.sh but it is easier to do it here !
if (strncasecmp(PHP_OS, 'WIN', 3) === 0) {
$oProductNodeOrig = get_product_node($node);
fix_product_name($oProductNodeOrig);
}
$root->appendChild($node);
}
$new_dom->save($xmlFilePath);
echo "OK!\n";

View File

@@ -0,0 +1,77 @@
<?php
/**
* Usage :
* `php changelog.php 2.7.4`
*
* As argument is passed the git ref (tag name or sha1) we want to use as reference
*
* Outputs :
*
* 1. List of bugs as CSV :
* bug ref;link
* Example :
* <code>
* Bug_ref;Bug_URL;sha1
* 1234;https://support.combodo.com/pages/UI.php?operation=details&class=Bug&id=1234;949b213f9|b1ca1f263|a1271da74
* </code>
*
* 2. List of commits sha1/message without bug ref
* Example :
* <code>
* sha1;subject
* a6aa183e2;:bookmark: Prepare 2.7.5
* </code>
*/
if (count($argv) === 1) {
echo '⚠ You must pass the base tag/sha1 as parameter';
exit(1);
}
$sBaseReference = $argv[1];
//--- Get log
$sGitLogCommand = 'git log --decorate --pretty="%h;%s" --date-order --no-merges '.$sBaseReference.'..HEAD';
$sGitLogRaw = shell_exec($sGitLogCommand);
//--- Analyze log
$aGitLogLines = preg_split('/\n/', trim($sGitLogRaw));;
$aLogLinesWithBugRef = [];
$aLogLineNoBug = [];
foreach ($aGitLogLines as $sLogLine) {
$sBugRef = preg_match('/[nN]°(\d{3,4})/', $sLogLine, $aLineBugRef);
if (($sBugRef === false) || empty($aLineBugRef)) {
$aLogLineNoBug[] = $sLogLine;
continue;
}
$iBugId = $aLineBugRef[1];
$sSha = substr($sLogLine, 0, 9);
if (array_key_exists($iBugId, $aLogLinesWithBugRef)) {
$aBugShaRefs = $aLogLinesWithBugRef[$iBugId];
$aBugShaRefs[] = $sSha;
$aLogLinesWithBugRef[$iBugId] = $aBugShaRefs;
} else {
$aLogLinesWithBugRef[$iBugId] = [$sSha];
}
}
$aBugsList = array_keys($aLogLinesWithBugRef);
sort($aBugsList, SORT_NUMERIC);
//-- Output results
echo "# Bugs included\n";
echo "Bug_ref;Bug_URL;sha1\n";
foreach ($aBugsList as $sBugRef) {
$sShaRefs = implode('|', $aLogLinesWithBugRef[$sBugRef]);
echo "{$sBugRef};https://support.combodo.com/pages/UI.php?operation=details&class=Bug&id={$sBugRef};$sShaRefs\n";
}
echo "\n";
echo "# Logs line without bug referenced\n";
echo "sha1;subject\n";
foreach ($aLogLineNoBug as $sLogLine) {
echo "$sLogLine\n";
}

View File

@@ -27,6 +27,7 @@ $aFilesUpdaters = array(
new iTopVersionFileUpdater(),
new CssVariablesFileUpdater(),
new DatamodelsModulesFiles(),
new ConstantFileUpdater('ITOP_CORE_VERSION', 'approot.inc.php'),
);
if (count($argv) === 1)

View File

@@ -69,6 +69,40 @@ abstract class AbstractSingleFileVersionUpdater extends FileVersionUpdater
}
}
/**
* @since 2.7.7 3.0.1 3.1.0 N°4714
*/
class ConstantFileUpdater extends AbstractSingleFileVersionUpdater {
/** @var string */
private $sConstantName;
/**
* @param $sConstantName constant to search, for example `ITOP_CORE_VERSION`
* @param $sFileToUpdate file containing constant definition
*/
public function __construct($sConstantName, $sFileToUpdate)
{
$this->sConstantName = $sConstantName;
parent::__construct($sFileToUpdate);
}
/**
* @inheritDoc
*/
public function UpdateFileContent($sVersionLabel, $sFileContent, $sFileFullPath)
{
$sConstantSearchPattern = <<<REGEXP
/define\('{$this->sConstantName}', ?'[^']+'\);/
REGEXP;
return preg_replace(
$sConstantSearchPattern,
"define('{$this->sConstantName}', '{$sVersionLabel}');",
$sFileContent
);
}
}
class iTopVersionFileUpdater extends AbstractSingleFileVersionUpdater
{
public function __construct()

139
CONTRIBUTING.md Normal file
View File

@@ -0,0 +1,139 @@
# Contributing to iTop
You want to contribute to iTop? Many thanks to you! 🎉 👍
Here are some guidelines that will help us integrate your work!
## Contributions
### Subjects
You are welcome to create pull requests on any of those subjects:
* 🐛 bug fix
* 🌐 translation / i18n / l10n
If you want to implement a **new feature**, please [create a corresponding ticket](https://sourceforge.net/p/itop/tickets/new/) for review.
If you ever want to begin implementation, do so in a fork, and add a link to the corresponding commits in the ticket.
For all **security related subjects**, please see our [security policy](SECURITY.md).
All **datamodel modification** should be done in an extension. Beware that such change would
impact all existing customers, and could prevent them from
upgrading!
Combodo has a long experience of datamodel changes: they are very disruptive!
This is why we avoid them in iTop core, especially the changes on existing objects/fields.
If you have an idea you're sure would benefit to all of iTop users, you may
[create a corresponding ticket](https://sourceforge.net/p/itop/tickets/new/) to submit it, but be warned that there are lots of good
reasons to refuse such changes.
### 📄 License
iTop is distributed under the AGPL-3.0 license (see the [license.txt] file),
your code must comply with this license.
If you want to use another license, you may [create an extension][wiki new ext].
[license.txt]: https://github.com/Combodo/iTop/blob/develop/license.txt
[wiki new ext]: https://www.itophub.io/wiki/page?id=latest%3Acustomization%3Astart#by_writing_your_own_extension
## 🔀 iTop branch model
When we first start with Git, we were using the [GitFlow](https://nvie.com/posts/a-successful-git-branching-model/) branch model. As
there was some confusions about branches to use for current developed release and previous maintained release, and also because we were
using just a very few of the GitFlow commands, we decided to add just a little modification to this branch model : since april 2020
we don't have anymore a `master` branch.
Here are the branches we use and their meaning :
- `develop`: ongoing development version
- `release/*`: if present, that means we are working on a alpha/beta/rc version for shipping
- `support/*`: maintenance branches for older versions
For example, if no version is currently prepared for shipping we could have:
- `develop` containing future 2.8.0 version
- `support/2.7`: 2.7.x maintenance version
- `support/2.6`: 2.6.x maintenance version
- `support/2.5`: 2.5.x maintenance version
In this example, when 2.8.0-beta is shipped that will become:
- `develop`: future 2.9.0 version
- `release/2.8`: 2.8.0-beta
- `support/2.7`: 2.7.x maintenance version
- `support/2.6`: 2.6.x maintenance version
- `support/2.5`: 2.5.x maintenance version
And when 2.8.0 final will be out:
- `develop`: future 2.9.0 version
- `support/2.8`: 2.8.x maintenance version (will host developments for 2.8.1)
- `support/2.7`: 2.7.x maintenance version
- `support/2.6`: 2.6.x maintenance version
- `support/2.5`: 2.5.x maintenance version
Also note that we have a "micro-version" concept : each of those versions have a very small amount of modifications. They are made from
`support/*` branches as well. For example 2.6.2-1 and 2.6.2-2 were made from the `support/2.6.2` branch.
## Coding
### 🌐 Translations
A [dedicated page](https://www.itophub.io/wiki/page?id=latest%3Acustomization%3Atranslation) is available in the official wiki.
### Where to start ?
1. Create a fork from our repository (see [Working with forks - GitHub Help](https://help.github.com/en/github/collaborating-with-issues-and-pull-requests/working-with-forks))
2. Create a branch in this fork, based on the develop branch
3. Code !
Do create a dedicated branch for each modification you want to propose : if you don't it will be very hard to merge back your work !
Most of the time you should based your developments on the develop branch.
That may be different if you want to fix a bug, please use develop anyway and ask in your PR if rebase is possible.
### 🎨 PHP styleguide
Please follow [our guidelines](https://www.itophub.io/wiki/page?id=latest%3Acustomization%3Acoding_standards).
### ✅ Tests
Please create tests that covers as much as possible the code you're submitting.
Our tests are located in the `test/` directory, containing a PHPUnit config file : `phpunit.xml.dist`.
### Git Commit Messages
* Describe the functional change instead of the technical modifications
* Use the present tense ("Add feature" not "Added feature")
* Use the imperative mood ("Move cursor to..." not "Moves cursor to...")
* Limit the first line to 72 characters or less
* Please start the commit message with an applicable emoji code (following the [Gitmoji guide](https://gitmoji.dev/)).
Beware to use the code (for example `:bug:`) and not the character (🐛) as Unicode support in git clients is very poor for now...
Emoji examples :
* 🌐 `:globe_with_meridians:` for translations
* 🎨 `:art:` when improving the format/structure of the code
* ⚡️ `:zap:` when improving performance
* 🐛 `:bug:` when fixing a bug
* 🔥 `:fire:` when removing code or files
* 💚 `:green_heart:` when fixing the CI build
*`:white_check_mark:` when adding tests
* 🔒 `:lock:` when dealing with security
* ⬆️ `:arrow_up:` when upgrading dependencies
* ⬇️ `:arrow_down:` when downgrading dependencies
* ♻️ `:recycle:` code refactoring
* 💄 `:lipstick:` Updating the UI and style files.
## 👥 Pull request
When your code is working, please:
* squash as much as possible your commits,
* rebase your branch on our repo last commit,
* create a pull request.
Detailed procedure to work on fork and create PR is available [in GitHub help pages](https://help.github.com/articles/creating-a-pull-request-from-a-fork/).

8
Jenkinsfile vendored
View File

@@ -1,6 +1,14 @@
def infra
node(){
properties([
buildDiscarder(
logRotator(
daysToKeepStr: "28",
numToKeepStr: "500")
)
])
checkout scm
infra = load '/var/lib/jenkins/workspace/itop-test-infra_master/src/Infra.groovy'

View File

@@ -36,21 +36,44 @@ iTop also offers mass import tools and web services to integrate with your IT
## Resources
- [iTop Forums][1]: for support request
- [iTop Forums][1]: community support
- [iTop Tickets][2]: for feature requests and bug reports
- [Releases download][3]
- [iTop documentation][4] for iTop and official extensions
- [iTop extensions][5] for discovering and installing extensions
- [Documentation][4] covering both iTop and its official extensions
- [iTop Hub][5] : discover and install extensions !
# About Us
[1]: https://sourceforge.net/p/itop/discussion/
[2]: https://sourceforge.net/p/itop/tickets/
[3]: https://sourceforge.net/projects/itop/files/itop/
[4]: https://www.itophub.io/wiki
[5]: https://store.itophub.io/en_US/
[10]: https://www.itophub.io/wiki/page?id=latest%3Adatamodel%3Astart#configuration_management_cmdb
[11]: https://www.itophub.io/wiki/page?id=latest%3Adatamodel%3Astart#ticketing
[12]: https://www.itophub.io/wiki/page?id=latest%3Adatamodel%3Astart#service_management
[13]: https://www.itophub.io/wiki/page?id=latest%3Adatamodel%3Astart#change_management
[14]: https://www.itophub.io/wiki/page?id=latest%3Aimplementation%3Astart#service_level_agreements_and_targets
[15]: https://www.itophub.io/wiki/page?id=latest%3Auser%3Aactions#relations
[16]: https://www.itophub.io/wiki/page?id=latest%3Auser%3Abulk_modify#uploading_data
[17]: https://www.itophub.io/wiki/page?id=latest%3Aadmin%3Aaudit
[18]: https://www.itophub.io/wiki/page?id=latest%3Aadvancedtopics%3Adata_synchro_overview
## About Us
iTop development is sponsored, led and supported by [Combodo][0].
[0]: https://www.combodo.com
# Contributors
## Contributors
We would like to give a special thank you to the people from the community who contributed to this project, including:
### Names
- Alves, David
- Beck, Pedro
- Bilger, Jean-François
@@ -60,6 +83,7 @@ We would like to give a special thank you to the people from the community who c
- Casteleyn, Thomas
- Castro, Randall Badilla
- Colantoni, Maria Laura
- Couronné, Guy
- Dvořák, Lukáš
- Goethals, Stefan
- Gumble, David
@@ -69,15 +93,17 @@ We would like to give a special thank you to the people from the community who c
- Konečný, Kamil
- Kunin, Vladimir
- Lassiter, Dennis
- Lazcano, Federico
- Lucas, Jonathan
- Malik, Remie
- Rosenke, Stephan
- Malik, Remie
- Mindêllo de Andrade, Lucas (a.k.a @rokam)
- Rosenke, Stephan
- Seki, Shoji
- Shilov, Vladimir
- Tulio, Marco
- Turrubiates, Miguel
#### Aliases
### Aliases
- chifu1234
- cprobst
- Karkoff1212
@@ -88,45 +114,8 @@ We would like to give a special thank you to the people from the community who c
- theBigOne
- ulmerspatz
#### Companies
### Companies
- Hardis
- ITOMIG
- Pimkie
[0]: https://www.combodo.com
[1]: https://sourceforge.net/p/itop/discussion/
[2]: https://sourceforge.net/p/itop/tickets/
[3]: https://sourceforge.net/projects/itop/files/itop/
[4]: https://www.itophub.io/wiki
[5]: https://store.itophub.io/en_US/
[10]: https://www.itophub.io/wiki/page?id=2_5_0%3Adatamodel%3Astart#configuration_management_cmdb
[11]: https://www.itophub.io/wiki/page?id=2_5_0%3Adatamodel%3Astart#ticketing
[12]: https://www.itophub.io/wiki/page?id=2_5_0%3Adatamodel%3Astart#service_management
[13]: https://www.itophub.io/wiki/page?id=2_5_0%3Adatamodel%3Astart#change_management
[14]: https://www.itophub.io/wiki/page?id=2_5_0%3Aimplementation%3Astart#service_level_agreements_and_targets
[15]: https://www.itophub.io/wiki/page?id=2_5_0%3Auser%3Aactions#relations
[16]: https://www.itophub.io/wiki/page?id=2_5_0%3Auser%3Abulk_modify#uploading_data
[17]: https://www.itophub.io/wiki/page?id=2_5_0%3Aadmin%3Aaudit
[18]: https://www.itophub.io/wiki/page?id=2_5_0%3Aadvancedtopics%3Adata_synchro_overview
[50]: https://www.itophub.io/wiki/page?id=2_4_0:release:change_log
[51]: https://www.itophub.io/wiki/page?id=2_4_0:release:2_4_whats_new
[52]: https://www.itophub.io/wiki/page?id=2_4_0:install:230_to_240_migration_notes
[53]: https://sourceforge.net/projects/itop/files/itop/2.4.1
[54]: https://www.itophub.io/wiki/page?id=2_5_0:release:change_log
[55]: https://www.itophub.io/wiki/page?id=2_5_0:release:2_5_whats_new
[56]: https://www.itophub.io/wiki/page?id=2_5_0:install:240_to_250_migration_notes
[57]: https://sourceforge.net/projects/itop/files/itop/2.5.1
[58]: https://www.itophub.io/wiki/page?id=2_6_0:release:change_log
[59]: https://www.itophub.io/wiki/page?id=2_6_0:release:2_6_whats_new
[60]: https://www.itophub.io/wiki/page?id=2_6_0:install:250_to_260_migration_notes
[61]: https://sourceforge.net/projects/itop/files/itop/2.6.3

36
SECURITY.md Normal file
View File

@@ -0,0 +1,36 @@
# 🔒 Reporting vulnerabilities
We take all security bugs seriously. Thank you for improving the security of iTop! We appreciate your efforts and
responsible disclosure and will make every effort to acknowledge your contributions.
## ✉️ How to report
### iTop vulnerabilities
Please send a procedure to reproduce iTop vulnerabilities to [itop-security@combodo.com](mailto:itop-security@combodo.com).
You can send us a standard "given / then / when" report, including iTop version, impacts, and maybe installed modules or data if they are
needed to reproduce.
### Dependencies vulnerabilities
Report security bugs in third-party modules to the person or team maintaining the module, and notify us of this report by sending an email
to [itop-security@combodo.com](mailto:itop-security@combodo.com).
## 📆 Disclosure Policy
Report sent to us will be acknowledged within the week.
Then, a Combodo developer will be assigned to the reported issue and will:
* confirm the problem and determine the affected iTop versions
* audit the code to search any potential similar problems
* try to find a workaround if any
* create fixes for all releases still under maintenance
* send you the commit(s) for review
* send you the next version(s) that will contain the fix, and the estimated release dates
Security issues always take precedence over bug fixes and feature work.
The assignee will keep you informed of the resolution progress, and may ask you for additional information or guidance.

View File

@@ -121,20 +121,15 @@ class UserRightsMatrix extends UserRightsAddOnAPI
public function CreateAdministrator($sAdminUser, $sAdminPwd, $sLanguage = 'EN US')
{
// Maybe we should check that no other user with userid == 0 exists
CMDBObject::SetTrackInfo('Initialization');
$oUser = new UserLocal();
$oUser->Set('login', $sAdminUser);
$oUser->Set('password', $sAdminPwd);
$oUser->Set('contactid', 1); // one is for root !
$oUser->Set('language', $sLanguage); // Language was chosen during the installation
// Create a change to record the history of the User object
$oChange = MetaModel::NewObject("CMDBChange");
$oChange->Set("date", time());
$oChange->Set("userinfo", "Initialization");
$iChangeId = $oChange->DBInsert();
// Now record the admin user object
$iUserId = $oUser->DBInsertTrackedNoReload($oChange, true /* skip security */);
$iUserId = $oUser->DBInsertNoReload();
$this->SetupUser($iUserId, true);
return true;
}

View File

@@ -1,27 +1,20 @@
<?php
// Copyright (C) 2010-2013 Combodo SARL
//
// This file is part of iTop.
//
// iTop is free software; you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// iTop 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 Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with iTop. If not, see <http://www.gnu.org/licenses/>
/**
* UserRightsProfile
* User management Module, basing the right on profiles and a matrix (similar to UserRightsMatrix, but profiles and other decorations have been added)
* Copyright (C) 2013-2020 Combodo SARL
*
* @copyright Copyright (C) 2010-2012 Combodo SARL
* @license http://opensource.org/licenses/AGPL-3.0
* This file is part of iTop.
*
* iTop is free software; you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* iTop 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 Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
*/
define('ADMIN_PROFILE_NAME', 'Administrator');
@@ -30,7 +23,7 @@ define('PORTAL_PROFILE_NAME', 'Portal user');
class UserRightsBaseClassGUI extends cmdbAbstractObject
{
// Whenever something changes, reload the privileges
protected function AfterInsert()
{
UserRights::FlushPrivileges();
@@ -80,7 +73,7 @@ class URP_Profiles extends UserRightsBaseClassGUI
}
protected static $m_aCacheProfiles = null;
public static function DoCreateProfile($sName, $sDescription)
{
if (is_null(self::$m_aCacheProfiles))
@@ -92,7 +85,7 @@ class URP_Profiles extends UserRightsBaseClassGUI
{
self::$m_aCacheProfiles[$oProfile->Get('name')] = $oProfile->GetKey();
}
}
}
$sCacheKey = $sName;
if (isset(self::$m_aCacheProfiles[$sCacheKey]))
@@ -103,10 +96,10 @@ class URP_Profiles extends UserRightsBaseClassGUI
$oNewObj->Set('name', $sName);
$oNewObj->Set('description', $sDescription);
$iId = $oNewObj->DBInsertNoReload();
self::$m_aCacheProfiles[$sCacheKey] = $iId;
self::$m_aCacheProfiles[$sCacheKey] = $iId;
return $iId;
}
function GetGrantAsHtml($oUserRights, $sClass, $sAction)
{
$bGrant = $oUserRights->GetProfileActionGrant($this->GetKey(), $sClass, $sAction);
@@ -123,7 +116,7 @@ class URP_Profiles extends UserRightsBaseClassGUI
return '<span style="background-color: #ffdddd;">'.Dict::S('UI:UserManagement:ActionAllowed:No').'</span>';
}
}
function DoShowGrantSumary($oPage)
{
if ($this->GetRawName() == "Administrator")
@@ -135,7 +128,7 @@ class URP_Profiles extends UserRightsBaseClassGUI
// Note: for sure, we assume that the instance is derived from UserRightsProfile
$oUserRights = UserRights::GetModuleInstance();
$aDisplayData = array();
foreach (MetaModel::GetClasses('bizmodel,grant_by_profile') as $sClass)
{
@@ -144,12 +137,12 @@ class URP_Profiles extends UserRightsBaseClassGUI
{
$bGrant = $oUserRights->GetClassStimulusGrant($this->GetKey(), $sClass, $sStimulusCode);
if ($bGrant === true)
{
{
$aStimuli[] = '<span title="'.$sStimulusCode.': '.htmlentities($oStimulus->GetDescription(), ENT_QUOTES, 'UTF-8').'">'.htmlentities($oStimulus->GetLabel(), ENT_QUOTES, 'UTF-8').'</span>';
}
}
$sStimuli = implode(', ', $aStimuli);
$aDisplayData[] = array(
'class' => MetaModel::GetName($sClass),
'read' => $this->GetGrantAsHtml($oUserRights, $sClass, 'r'),
@@ -161,7 +154,7 @@ class URP_Profiles extends UserRightsBaseClassGUI
'stimuli' => $sStimuli,
);
}
$aDisplayConfig = array();
$aDisplayConfig['class'] = array('label' => Dict::S('UI:UserManagement:Class'), 'description' => Dict::S('UI:UserManagement:Class+'));
$aDisplayConfig['read'] = array('label' => Dict::S('UI:UserManagement:Action:Read'), 'description' => Dict::S('UI:UserManagement:Action:Read+'));
@@ -179,7 +172,7 @@ class URP_Profiles extends UserRightsBaseClassGUI
parent::DisplayBareRelations($oPage, $bEditMode);
if (!$bEditMode)
{
$oPage->SetCurrentTab(Dict::S('UI:UserManagement:GrantMatrix'));
$oPage->SetCurrentTab('UI:UserManagement:GrantMatrix');
$this->DoShowGrantSumary($oPage);
}
}
@@ -221,7 +214,7 @@ class URP_Profiles extends UserRightsBaseClassGUI
* @param $aReasons array To store the reasons why the attribute is read-only (info about the synchro replicas)
* @param $sTargetState string The target state in which to evalutate the flags, if empty the current state will be used
* @return integer Flags: the binary combination of the flags applicable to this attribute
*/
*/
public function GetAttributeFlags($sAttCode, &$aReasons = array(), $sTargetState = '')
{
$iFlags = parent::GetAttributeFlags($sAttCode, $aReasons, $sTargetState);
@@ -404,7 +397,7 @@ class URP_UserOrg extends UserRightsBaseClassGUI
{
if (!UserRights::IsLoggedIn() || UserRights::IsAdministrator()) { return; }
$oUser = UserRights::GetUserObject();
$oUser = UserRights::GetUserObject();
$oAddon = UserRights::GetModuleInstance();
$aOrgs = $oAddon->GetUserOrgs($oUser, '');
if (count($aOrgs) > 0)
@@ -432,38 +425,38 @@ class UserRightsProfile extends UserRightsAddOnAPI
UR_ACTION_BULK_DELETE => 'bd',
);
/**
* @var array $aUsersProfilesList Cache of users' profiles. Hash array of user ID => [profile ID => profile friendlyname, profile ID => profile friendlyname, ...]
* @since 2.7.10 3.0.4 3.1.1 3.2.0 N°6887
*/
private $aUsersProfilesList = [];
// Installation: create the very first user
public function CreateAdministrator($sAdminUser, $sAdminPwd, $sLanguage = 'EN US')
{
CMDBObject::SetTrackInfo('Initialization');
$oChange = CMDBObject::GetCurrentChange();
$iContactId = 0;
// Support drastic data model changes: no organization class (or not writable)!
if (MetaModel::IsValidClass('Organization') && !MetaModel::IsAbstract('Organization'))
{
$oOrg = new Organization();
$oOrg = MetaModel::NewObject('Organization');
$oOrg->Set('name', 'My Company/Department');
$oOrg->Set('code', 'SOMECODE');
$iOrgId = $oOrg->DBInsertTrackedNoReload($oChange, true /* skip security */);
$iOrgId = $oOrg->DBInsertNoReload();
// Support drastic data model changes: no Person class (or not writable)!
if (MetaModel::IsValidClass('Person') && !MetaModel::IsAbstract('Person'))
{
$oContact = new Person();
$oContact = MetaModel::NewObject('Person');
$oContact->Set('name', 'My last name');
$oContact->Set('first_name', 'My first name');
if (MetaModel::IsValidAttCode('Person', 'org_id'))
{
$oContact->Set('org_id', $iOrgId);
}
if (MetaModel::IsValidAttCode('Person', 'phone'))
{
$oContact->Set('phone', '+00 000 000 000');
}
$oContact->Set('email', 'my.email@foo.org');
$iContactId = $oContact->DBInsertTrackedNoReload($oChange, true /* skip security */);
$iContactId = $oContact->DBInsertNoReload();
}
}
@@ -482,14 +475,12 @@ class UserRightsProfile extends UserRightsAddOnAPI
if (is_object($oAdminProfile))
{
$oUserProfile = new URP_UserProfile();
//$oUserProfile->Set('userid', $iUserId);
$oUserProfile->Set('profileid', $oAdminProfile->GetKey());
$oUserProfile->Set('reason', 'By definition, the administrator must have the administrator profile');
//$oUserProfile->DBInsertTrackedNoReload($oChange, true /* skip security */);
$oSet = DBObjectSet::FromObject($oUserProfile);
$oUser->Set('profile_list', $oSet);
}
$iUserId = $oUser->DBInsertTrackedNoReload($oChange, true /* skip security */);
$iUserId = $oUser->DBInsertNoReload();
return true;
}
@@ -536,7 +527,7 @@ class UserRightsProfile extends UserRightsAddOnAPI
$oSearch->AllowAllData();
$oCondition = new BinaryExpression(new FieldExpression('userid'), '=', new VariableExpression('userid'));
$oSearch->AddConditionExpression($oCondition);
$oUserOrgSet = new DBObjectSet($oSearch, array(), array('userid' => $iUser));
while ($oUserOrg = $oUserOrgSet->Fetch())
{
@@ -572,7 +563,7 @@ class UserRightsProfile extends UserRightsAddOnAPI
/**
* @param $oUser User
* @return array
* @return bool
*/
public function IsAdministrator($oUser)
{
@@ -582,16 +573,22 @@ class UserRightsProfile extends UserRightsAddOnAPI
/**
* @param $oUser User
* @return array
* @return bool
*/
public function IsPortalUser($oUser)
{
// UserRights caches the list for us
return UserRights::HasProfile(PORTAL_PROFILE_NAME, $oUser);
}
/**
* @param $oUser User
* @return bool
*
* @return array
* @throws \ArchivedObjectException
* @throws \CoreException
* @throws \CoreUnexpectedValue
* @throws \MySQLException
*/
public function ListProfiles($oUser)
{
@@ -655,14 +652,20 @@ class UserRightsProfile extends UserRightsAddOnAPI
// load and cache permissions for the current user on the given class
//
$iUser = $oUser->GetKey();
$aTest = @$this->m_aObjectActionGrants[$iUser][$sClass][$iActionCode];
if (is_array($aTest)) return $aTest;
if (isset($this->m_aObjectActionGrants[$iUser][$sClass][$iActionCode])){
$aTest = $this->m_aObjectActionGrants[$iUser][$sClass][$iActionCode];
if (is_array($aTest)) return $aTest;
}
$sAction = self::$m_aActionCodes[$iActionCode];
$bStatus = null;
// Cache user's profiles
if(false === array_key_exists($iUser, $this->aUsersProfilesList)){
$this->aUsersProfilesList[$iUser] = UserRights::ListProfiles($oUser);
}
// Call the API of UserRights because it caches the list for us
foreach(UserRights::ListProfiles($oUser) as $iProfile => $oProfile)
foreach($this->aUsersProfilesList[$iUser] as $iProfile => $oProfile)
{
$bGrant = $this->GetProfileActionGrant($iProfile, $sClass, $sAction);
if (!is_null($bGrant))
@@ -788,11 +791,16 @@ class UserRightsProfile extends UserRightsAddOnAPI
// Note: this code is VERY close to the code of IsActionAllowed()
$iUser = $oUser->GetKey();
// Cache user's profiles
if(false === array_key_exists($iUser, $this->aUsersProfilesList)){
$this->aUsersProfilesList[$iUser] = UserRights::ListProfiles($oUser);
}
// Note: The object set is ignored because it was interesting to optimize for huge data sets
// and acceptable to consider only the root class of the object set
$bStatus = null;
// Call the API of UserRights because it caches the list for us
foreach(UserRights::ListProfiles($oUser) as $iProfile => $oProfile)
foreach($this->aUsersProfilesList[$iUser] as $iProfile => $oProfile)
{
$bGrant = $this->GetClassStimulusGrant($iProfile, $sClass, $sStimulusCode);
if (!is_null($bGrant))
@@ -821,9 +829,10 @@ class UserRightsProfile extends UserRightsAddOnAPI
}
/**
* Find out which attribute is corresponding the the dimension 'owner org'
* returns null if no such attribute has been found (no filtering should occur)
*/
* @param string $sClass
* @return string|null Find out which attribute is corresponding the dimension 'owner org'
* returns null if no such attribute has been found (no filtering should occur)
*/
public static function GetOwnerOrganizationAttCode($sClass)
{
$sAttCode = null;

View File

@@ -1,27 +1,20 @@
<?php
// Copyright (C) 2010-2013 Combodo SARL
//
// This file is part of iTop.
//
// iTop is free software; you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// iTop 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 Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with iTop. If not, see <http://www.gnu.org/licenses/>
/**
* UserRightsProfile
* User management Module, basing the right on profiles and a matrix (similar to UserRightsMatrix, but profiles and other decorations have been added)
* Copyright (C) 2013-2020 Combodo SARL
*
* @copyright Copyright (C) 2010-2012 Combodo SARL
* @license http://opensource.org/licenses/AGPL-3.0
* This file is part of iTop.
*
* iTop is free software; you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* iTop 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 Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
*/
define('ADMIN_PROFILE_NAME', 'Administrator');
@@ -321,7 +314,7 @@ class URP_Profiles extends UserRightsBaseClassGUI
parent::DisplayBareRelations($oPage, $bEditMode);
if (!$bEditMode)
{
$oPage->SetCurrentTab(Dict::S('UI:UserManagement:GrantMatrix'));
$oPage->SetCurrentTab('UI:UserManagement:GrantMatrix');
$this->DoShowGrantSumary($oPage);
}
}
@@ -533,36 +526,34 @@ class UserRightsProfile extends UserRightsAddOnAPI
public function CreateAdministrator($sAdminUser, $sAdminPwd, $sLanguage = 'EN US')
{
// Create a change to record the history of the User object
/** @var \CMDBChange $oChange */
$oChange = MetaModel::NewObject("CMDBChange");
$oChange->Set("date", time());
$oChange->Set("userinfo", "Initialization");
$iChangeId = $oChange->DBInsert();
$iContactId = 0;
// Support drastic data model changes: no organization class (or not writable)!
if (MetaModel::IsValidClass('Organization') && !MetaModel::IsAbstract('Organization'))
{
$oOrg = new Organization();
$oOrg = MetaModel::NewObject('Organization');
$oOrg->Set('name', 'My Company/Department');
$oOrg->Set('code', 'SOMECODE');
$iOrgId = $oOrg->DBInsertTrackedNoReload($oChange, true /* skip security */);
$oOrg::SetCurrentChange($oChange);
$iOrgId = $oOrg->DBInsertNoReload();
// Support drastic data model changes: no Person class (or not writable)!
if (MetaModel::IsValidClass('Person') && !MetaModel::IsAbstract('Person'))
{
$oContact = new Person();
$oContact = MetaModel::NewObject('Person');
$oContact->Set('name', 'My last name');
$oContact->Set('first_name', 'My first name');
if (MetaModel::IsValidAttCode('Person', 'org_id'))
{
$oContact->Set('org_id', $iOrgId);
}
if (MetaModel::IsValidAttCode('Person', 'phone'))
{
$oContact->Set('phone', '+00 000 000 000');
}
$oContact->Set('email', 'my.email@foo.org');
$iContactId = $oContact->DBInsertTrackedNoReload($oChange, true /* skip security */);
$oContact::SetCurrentChange($oChange);
$iContactId = $oContact->DBInsertNoReload();
}
}
@@ -581,14 +572,13 @@ class UserRightsProfile extends UserRightsAddOnAPI
if (is_object($oAdminProfile))
{
$oUserProfile = new URP_UserProfile();
//$oUserProfile->Set('userid', $iUserId);
$oUserProfile->Set('profileid', $oAdminProfile->GetKey());
$oUserProfile->Set('reason', 'By definition, the administrator must have the administrator profile');
//$oUserProfile->DBInsertTrackedNoReload($oChange, true /* skip security */);
$oSet = DBObjectSet::FromObject($oUserProfile);
$oUser->Set('profile_list', $oSet);
}
$iUserId = $oUser->DBInsertTrackedNoReload($oChange, true /* skip security */);
$oUser::SetCurrentChange($oChange);
$iUserId = $oUser->DBInsertNoReload();
return true;
}
@@ -614,10 +604,10 @@ class UserRightsProfile extends UserRightsAddOnAPI
/**
* Read and cache organizations allowed to the given user
*
* @param $oUser
* @param $sClass (not used here but can be used in overloads)
* @param User $oUser
* @param string $sClass (not used here but can be used in overloads)
*
* @return array
* @return array keys of the User allowed org
* @throws \CoreException
* @throws \Exception
*/
@@ -717,7 +707,7 @@ class UserRightsProfile extends UserRightsAddOnAPI
public function LoadCache()
{
if (!is_null($this->m_aProfiles)) return;
if (!is_null($this->m_aProfiles)) return false;
// Could be loaded in a shared memory (?)
$oKPI = new ExecutionKPI();

View File

@@ -1,27 +1,20 @@
<?php
// Copyright (C) 2010-2012 Combodo SARL
//
// This file is part of iTop.
//
// iTop is free software; you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// iTop 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 Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with iTop. If not, see <http://www.gnu.org/licenses/>
/**
* UserRightsProjection
* User management Module, basing the right on profiles and a matrix (similar to UserRightsProfile, but enhanced with dimensions and projection of classes and profile over the dimensions)
* Copyright (C) 2013-2020 Combodo SARL
*
* @copyright Copyright (C) 2010-2012 Combodo SARL
* @license http://opensource.org/licenses/AGPL-3.0
* This file is part of iTop.
*
* iTop is free software; you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* iTop 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 Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
*/
define('ADMIN_PROFILE_ID', 1);
@@ -153,7 +146,7 @@ class URP_Profiles extends UserRightsBaseClass
parent::DisplayBareRelations($oPage, $bEditMode);
if (!$bEditMode)
{
$oPage->SetCurrentTab(Dict::S('UI:UserManagement:GrantMatrix'));
$oPage->SetCurrentTab('UI:UserManagement:GrantMatrix');
$this->DoShowGrantSumary($oPage);
}
}
@@ -593,25 +586,12 @@ class UserRightsProjection extends UserRightsAddOnAPI
$oChange = MetaModel::NewObject("CMDBChange");
$oChange->Set("date", time());
$oChange->Set("userinfo", "Initialization");
$iChangeId = $oChange->DBInsert();
$oOrg = new Organization();
$oOrg->Set('name', 'My Company/Department');
$oOrg->Set('code', 'SOMECODE');
// $oOrg->Set('status', 'implementation');
//$oOrg->Set('parent_id', xxx);
$iOrgId = $oOrg->DBInsertTrackedNoReload($oChange, true /* skip strong security */);
// Location : optional
//$oLocation = new bizLocation();
//$oLocation->Set('name', 'MyOffice');
//$oLocation->Set('status', 'implementation');
//$oLocation->Set('org_id', $iOrgId);
//$oLocation->Set('severity', 'high');
//$oLocation->Set('address', 'my building in my city');
//$oLocation->Set('country', 'my country');
//$oLocation->Set('parent_location_id', xxx);
//$iLocationId = $oLocation->DBInsertNoReload();
$oOrg::SetCurrentChange($oChange);
$iOrgId = $oOrg->DBInsertNoReload();
$oContact = new Person();
$oContact->Set('name', 'My last name');
@@ -619,24 +599,24 @@ class UserRightsProjection extends UserRightsAddOnAPI
//$oContact->Set('status', 'available');
$oContact->Set('org_id', $iOrgId);
$oContact->Set('email', 'my.email@foo.org');
//$oContact->Set('phone', '');
//$oContact->Set('location_id', $iLocationId);
//$oContact->Set('employee_number', '');
$iContactId = $oContact->DBInsertTrackedNoReload($oChange, true /* skip security */);
$oContact::SetCurrentChange($oChange);
$iContactId = $oContact->DBInsertNoReload();
$oUser = new UserLocal();
$oUser->Set('login', $sAdminUser);
$oUser->Set('password', $sAdminPwd);
$oUser->Set('contactid', $iContactId);
$oUser->Set('language', $sLanguage); // Language was chosen during the installation
$iUserId = $oUser->DBInsertTrackedNoReload($oChange, true /* skip security */);
$oUser::SetCurrentChange($oChange);
$iUserId = $oUser->DBInsertNoReload();
// Add this user to the very specific 'admin' profile
$oUserProfile = new URP_UserProfile();
$oUserProfile->Set('userid', $iUserId);
$oUserProfile->Set('profileid', ADMIN_PROFILE_ID);
$oUserProfile->Set('reason', 'By definition, the administrator must have the administrator profile');
$oUserProfile->DBInsertTrackedNoReload($oChange, true /* skip security */);
$oUserProfile::SetCurrentChange($oChange);
$oUserProfile->DBInsertNoReload();
return true;
}

View File

@@ -1,27 +1,20 @@
<?php
// Copyright (C) 2010-2018 Combodo SARL
//
// This file is part of iTop.
//
// iTop is free software; you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// iTop 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 Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with iTop. If not, see <http://www.gnu.org/licenses/>
/**
* Simple web page with no includes, header or fancy formatting, useful to
* generate HTML fragments when called by an AJAX method
* Copyright (C) 2013-2020 Combodo SARL
*
* @copyright Copyright (C) 2010-2017 Combodo SARL
* @license http://opensource.org/licenses/AGPL-3.0
* This file is part of iTop.
*
* iTop is free software; you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* iTop 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 Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
*/
require_once(APPROOT."/application/webpage.class.inc.php");
@@ -30,7 +23,7 @@ class ajax_page extends WebPage implements iTabbedPage
{
/**
* Jquery style ready script
* @var Hash
* @var array
*/
protected $m_sReadyScript;
protected $m_oTabs;
@@ -48,10 +41,8 @@ class ajax_page extends WebPage implements iTabbedPage
parent::__construct($s_title, $bPrintable);
$this->m_sReadyScript = "";
//$this->add_header("Content-type: text/html; charset=utf-8");
$this->add_header('Cache-control: no-cache, no-store, must-revalidate');
$this->add_header('Pragma: no-cache');
$this->add_header('Expires: 0');
$this->add_header('X-Frame-Options: deny');
$this->no_cache();
$this->add_http_headers();
$this->m_oTabs = new TabManager();
$this->sContentType = 'text/html';
$this->sContentDisposition = 'inline';
@@ -60,56 +51,77 @@ class ajax_page extends WebPage implements iTabbedPage
utils::InitArchiveMode();
}
/**
* Disabling sending the header so that resource won't be blocked by CORB. See parent method documentation.
* @return void
* @since 2.7.10 3.0.4 3.1.2 3.2.0 N°4368 method creation
*/
public function add_xcontent_type_options()
{
// Nothing to do !
}
/**
* @inheritDoc
* @throws \Exception
*/
public function AddTabContainer($sTabContainer, $sPrefix = '')
{
$this->add($this->m_oTabs->AddTabContainer($sTabContainer, $sPrefix));
}
public function AddToTab($sTabContainer, $sTabLabel, $sHtml)
/**
* @inheritDoc
* @throws \Exception
*/
public function AddToTab($sTabContainer, $sTabCode, $sHtml)
{
$this->add($this->m_oTabs->AddToTab($sTabContainer, $sTabLabel, $sHtml));
$this->add($this->m_oTabs->AddToTab($sTabContainer, $sTabCode, $sHtml));
}
/**
* @inheritDoc
*/
public function SetCurrentTabContainer($sTabContainer = '')
{
return $this->m_oTabs->SetCurrentTabContainer($sTabContainer);
}
public function SetCurrentTab($sTabLabel = '')
{
return $this->m_oTabs->SetCurrentTab($sTabLabel);
}
/**
* Add a tab which content will be loaded asynchronously via the supplied URL
*
* Limitations:
* Cross site scripting is not not allowed for security reasons. Use a normal tab with an IFRAME if you want to pull content from another server.
* Static content cannot be added inside such tabs.
*
* @param string $sTabLabel The (localised) label of the tab
* @param string $sUrl The URL to load (on the same server)
* @param boolean $bCache Whether or not to cache the content of the tab once it has been loaded. flase will cause the tab to be reloaded upon each activation.
* @since 2.0.3
* @inheritDoc
*/
public function AddAjaxTab($sTabLabel, $sUrl, $bCache = true)
public function SetCurrentTab($sTabCode = '', $sTabTitle = null)
{
$this->add($this->m_oTabs->AddAjaxTab($sTabLabel, $sUrl, $bCache));
return $this->m_oTabs->SetCurrentTab($sTabCode, $sTabTitle);
}
/**
* @inheritDoc
* @throws \Exception
*/
public function AddAjaxTab($sTabCode, $sUrl, $bCache = true, $sTabTitle = null)
{
$this->add($this->m_oTabs->AddAjaxTab($sTabCode, $sUrl, $bCache, $sTabTitle));
}
/**
* @inheritDoc
*/
public function GetCurrentTab()
{
return $this->m_oTabs->GetCurrentTab();
}
public function RemoveTab($sTabLabel, $sTabContainer = null)
/**
* @inheritDoc
*/
public function RemoveTab($sTabCode, $sTabContainer = null)
{
$this->m_oTabs->RemoveTab($sTabLabel, $sTabContainer);
$this->m_oTabs->RemoveTab($sTabCode, $sTabContainer);
}
/**
* Finds the tab whose title matches a given pattern
* @return mixed The name of the tab as a string or false if not found
* @inheritDoc
*/
public function FindTab($sPattern, $sTabContainer = null)
{
@@ -122,21 +134,23 @@ class ajax_page extends WebPage implements iTabbedPage
* that we are using this is not supported... TO DO upgrade
* the whole jquery bundle...
*/
public function SelectTab($sTabContainer, $sTabLabel)
public function SelectTab($sTabContainer, $sTabCode)
{
$this->add_ready_script($this->m_oTabs->SelectTab($sTabContainer, $sTabLabel));
$this->add_ready_script($this->m_oTabs->SelectTab($sTabContainer, $sTabCode));
}
/**
* @param string $sHtml
*/
public function AddToMenu($sHtml)
{
$this->m_sMenu .= $sHtml;
}
/**
* Echoes the content of the whole page
* @return void
*/
public function output()
/**
* @inheritDoc
*/
public function output()
{
if (!empty($this->sContentType))
{
@@ -217,8 +231,11 @@ PrepareWidgets();
EOF
);
}
$s_captured_output = $this->ob_get_clean_safe();
if (($this->sContentType == 'text/html') && ($this->sContentDisposition == 'inline'))
$this->outputCollapsibleSectionInit();
$oKPI = new ExecutionKPI();
$s_captured_output = $this->ob_get_clean_safe();
if (($this->sContentType == 'text/html') && ($this->sContentDisposition == 'inline'))
{
// inline content != attachment && html => filter all scripts for malicious XSS scripts
echo self::FilterXSS($this->s_content);
@@ -288,10 +305,16 @@ EOF
echo self::FilterXSS($s_captured_output);
}
$oKPI->ComputeAndReport('Echoing');
if (class_exists('DBSearch'))
{
DBSearch::RecordQueryTrace();
}
if (class_exists('ExecutionKPI'))
{
ExecutionKPI::ReportStats();
}
}
/**
@@ -304,7 +327,11 @@ EOF
{
}
public function add($sHtml)
/**
* @inheritDoc
* @throws \Exception
*/
public function add($sHtml)
{
if (($this->m_oTabs->GetCurrentTabContainer() != '') && ($this->m_oTabs->GetCurrentTab() != ''))
{
@@ -317,10 +344,9 @@ EOF
}
/**
* Records the current state of the 'html' part of the page output
* @return mixed The current state of the 'html' output
*/
public function start_capture()
* @inheritDoc
*/
public function start_capture()
{
$sCurrentTabContainer = $this->m_oTabs->GetCurrentTabContainer();
$sCurrentTab = $this->m_oTabs->GetCurrentTab();
@@ -336,13 +362,10 @@ EOF
}
}
/**
* Returns the part of the html output that occurred since the call to start_capture
* and removes this part from the current html output
* @param $offset mixed The value returned by start_capture
* @return string The part of the html output that was added since the call to start_capture
*/
public function end_capture($offset)
/**
* @inheritDoc
*/
public function end_capture($offset)
{
if (is_array($offset))
{
@@ -363,11 +386,9 @@ EOF
}
/**
* Add any text or HTML fragment (identified by an ID) at the end of the body of the page
* This is useful to add hidden content, DIVs or FORMs that should not
* be embedded into each other.
* @inheritDoc
*/
public function add_at_the_end($s_html, $sId = '')
public function add_at_the_end($s_html, $sId = '')
{
if ($sId != '')
{
@@ -375,27 +396,27 @@ EOF
}
$this->s_deferred_content .= $s_html;
}
/**
* Adds a script to be executed when the DOM is ready (typical JQuery use)
* NOT implemented in this version of the class.
* @return void
*/
* @inheritDoc
*/
public function add_ready_script($sScript)
{
$this->m_sReadyScript .= $sScript."\n";
}
/**
* Cannot be called in this context, since Ajax pages do not share
* any context with the calling page !!
* @inheritDoc
*/
public function GetUniqueId()
{
assert(false);
return 0;
}
/**
* @inheritDoc
*/
public static function FilterXSS($sHTML)
{
return str_ireplace(array('<script', '</script>'), array('<!-- <removed-script', '</removed-script> -->'), $sHTML);

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -31,11 +31,9 @@ class CSVPage extends WebPage
{
function __construct($s_title) {
parent::__construct($s_title);
$this->add_header("Content-type: text/plain; charset=utf-8");
$this->add_header('Cache-control: no-cache, no-store, must-revalidate');
$this->add_header('Pragma: no-cache');
$this->add_header('Expires: 0');
$this->add_header('X-Frame-Options: deny');
$this->add_header("Content-type: text/plain; charset=".self::PAGES_CHARSET);
$this->no_cache();
$this->add_http_headers();
//$this->add_header("Content-Transfer-Encoding: binary");
}

View File

@@ -1,20 +1,21 @@
<?php
// Copyright (C) 2010-2017 Combodo SARL
//
// This file is part of iTop.
//
// iTop is free software; you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// iTop 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 Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with iTop. If not, see <http://www.gnu.org/licenses/>
/**
* Copyright (C) 2013-2019 Combodo SARL
*
* This file is part of iTop.
*
* iTop is free software; you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* iTop 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 Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
*/
require_once(APPROOT.'application/dashboardlayout.class.inc.php');
require_once(APPROOT.'application/dashlet.class.inc.php');
@@ -24,21 +25,33 @@ require_once(APPROOT.'core/modelreflection.class.inc.php');
*
* A user editable dashboard page
*
* @copyright Copyright (C) 2010-2017 Combodo SARL
* @license http://opensource.org/licenses/AGPL-3.0
*/
abstract class Dashboard
{
/** @var string $sTitle*/
protected $sTitle;
/** @var bool $bAutoReload */
protected $bAutoReload;
/** @var float|int $iAutoReloadSec */
protected $iAutoReloadSec;
/** @var string $sLayoutClass */
protected $sLayoutClass;
/** @var array $aWidgetsData */
protected $aWidgetsData;
/** @var \DOMNode|null $oDOMNode */
protected $oDOMNode;
/** @var string $sId */
protected $sId;
/** @var array $aCells */
protected $aCells;
/** @var \ModelReflection $oMetaModel */
protected $oMetaModel;
/**
* Dashboard constructor.
*
* @param string $sId
*/
public function __construct($sId)
{
$this->sTitle = '';
@@ -51,7 +64,7 @@ abstract class Dashboard
}
/**
* @param $sXml
* @param string $sXml
*
* @throws \Exception
*/
@@ -64,7 +77,10 @@ abstract class Dashboard
restore_error_handler();
$this->FromDOMDocument($oDoc);
}
/**
* @param \DOMDocument $oDoc
*/
public function FromDOMDocument(DOMDocument $oDoc)
{
$this->oDOMNode = $oDoc->getElementsByTagName('dashboard')->item(0);
@@ -160,9 +176,10 @@ abstract class Dashboard
protected function InitDashletFromDOMNode($oDomNode)
{
$sId = $oDomNode->getAttribute('id');
$sDashletType = $oDomNode->getAttribute('xsi:type');
// Test if dashlet can be instanciated, otherwise (uninstalled, broken, ...) we display a placeholder
// Test if dashlet can be instantiated, otherwise (uninstalled, broken, ...) we display a placeholder
$sClass = static::GetDashletClassFromType($sDashletType);
/** @var \Dashlet $oNewDashlet */
$oNewDashlet = new $sClass($this->oMetaModel, $sId);
@@ -172,7 +189,13 @@ abstract class Dashboard
return $oNewDashlet;
}
static function SortOnRank($aItem1, $aItem2)
/**
* @param array $aItem1
* @param array $aItem2
*
* @return int
*/
public static function SortOnRank($aItem1, $aItem2)
{
return ($aItem1['rank'] > $aItem2['rank']) ? +1 : -1;
}
@@ -200,6 +223,10 @@ abstract class Dashboard
}
}
/**
* @return string
* @throws \Exception
*/
public function ToXml()
{
$oDoc = new DOMDocument();
@@ -268,7 +295,9 @@ abstract class Dashboard
}
}
/**
* @param array $aParams
*/
public function FromParams($aParams)
{
$this->sLayoutClass = $aParams['layout_class'];
@@ -305,42 +334,85 @@ abstract class Dashboard
{
}
/**
* @return mixed
*/
public function GetId()
{
return $this->sId;
}
/**
* Return a sanitize ID for usages in XML/HTML attributes
*
* @return string
* @since 2.7.0
*/
public function GetSanitizedId()
{
return utils::Sanitize($this->GetId(), '', 'element_identifier');
}
/**
* @return string
*/
public function GetLayout()
{
return $this->sLayoutClass;
}
/**
* @param string $sLayoutClass
*/
public function SetLayout($sLayoutClass)
{
$this->sLayoutClass = $sLayoutClass;
}
/**
* @return string
*/
public function GetTitle()
{
return $this->sTitle;
}
/**
* @param string $sTitle
*/
public function SetTitle($sTitle)
{
$this->sTitle = $sTitle;
}
/**
* @return bool
*/
public function GetAutoReload()
{
return $this->bAutoReload;
}
/**
* @param bool $bAutoReload
*/
public function SetAutoReload($bAutoReload)
{
$this->bAutoReload = $bAutoReload;
}
/**
* @return float|int
*/
public function GetAutoReloadInterval()
{
return $this->iAutoReloadSec;
}
/**
* @param bool $iAutoReloadSec
*/
public function SetAutoReloadInterval($iAutoReloadSec)
{
$this->iAutoReloadSec = max(MetaModel::GetConfig()->Get('min_reload_interval'), (int)$iAutoReloadSec);
@@ -356,12 +428,13 @@ abstract class Dashboard
$this->aCells[] = array($oDashlet);
}
/**
* @param \WebPage $oPage *
* @param array $aExtraParams
*
* @throws \ReflectionException
*/
/**
* @param \WebPage $oPage *
* @param array $aExtraParams
*
* @throws \ReflectionException
* @throws \Exception
*/
public function RenderProperties($oPage, $aExtraParams = array())
{
// menu to pick a layout and edit other properties of the dashboard
@@ -449,17 +522,32 @@ EOF
}
/**
* @param \iTopWebPage $oPage
* @param \WebPage $oPage
* @param bool $bEditMode
* @param array $aExtraParams
* @param bool $bCanEdit
*/
public function Render($oPage, $bEditMode = false, $aExtraParams = array(), $bCanEdit = true)
{
if (!array_key_exists('dashboard_div_id', $aExtraParams))
{
$aExtraParams['dashboard_div_id'] = utils::Sanitize($this->GetId(), '', 'element_identifier');
}
$oPage->add('<div class="dashboard-title-line"><div class="dashboard-title">'.htmlentities(Dict::S($this->sTitle), ENT_QUOTES, 'UTF-8', false).'</div></div>');
$oLayout = new $this->sLayoutClass;
/** @var \DashboardLayoutMultiCol $oLayout */
$oLayout = new $this->sLayoutClass();
foreach($this->aCells as $iCellIdx => $aDashlets)
{
foreach($aDashlets as $oDashlet)
{
$aDashletCoordinates = $oLayout->GetDashletCoordinates($iCellIdx);
$this->PrepareDashletForRendering($oDashlet, $aDashletCoordinates, $aExtraParams);
}
}
$oLayout->Render($oPage, $this->aCells, $bEditMode, $aExtraParams);
if (!$bEditMode)
{
@@ -468,6 +556,12 @@ EOF
}
}
/**
* @param \WebPage $oPage
*
* @throws \ReflectionException
* @throws \Exception
*/
public function RenderDashletsSelection(WebPage $oPage)
{
// Toolbox/palette to drag and drop dashlets
@@ -485,25 +579,31 @@ EOF
$oPage->add('</div>');
$oPage->add_ready_script("$('.dashlet_icon').draggable({helper: 'clone', appendTo: 'body', zIndex: 10000, revert:'invalid'});");
}
/**
* @param \WebPage $oPage
* @param array $aExtraParams
*/
public function RenderDashletsProperties(WebPage $oPage, $aExtraParams = array())
{
// Toolbox/palette to edit the properties of each dashlet
$oPage->add('<div class="ui-widget-content ui-corner-all"><div class="ui-widget-header ui-corner-all" style="text-align:center; padding: 2px;">'.Dict::S('UI:DashboardEdit:DashletProperties').'</div>');
/** @var \DashboardLayoutMultiCol $oLayout */
$oLayout = new $this->sLayoutClass();
$oPage->add('<div id="dashlet_properties" style="text-align:center">');
foreach($this->aCells as $aCell)
foreach($this->aCells as $iCellIdx => $aCell)
{
/** @var \Dashlet $oDashlet */
foreach($aCell as $oDashlet)
{
$sId = $oDashlet->GetID();
if ($oDashlet->IsVisible())
{
$oPage->add('<div class="dashlet_properties" id="dashlet_properties_'.$sId.'" style="display:none">');
$oPage->add('<div class="dashlet_properties" id="dashlet_properties_'.$oDashlet->GetID().'" style="display:none">');
$oForm = $oDashlet->GetForm();
$this->SetFormParams($oForm, $aExtraParams);
$oForm->RenderAsPropertySheet($oPage, false, '.itop-dashboard');
$oForm->RenderAsPropertySheet($oPage, false, '.itop-dashboard');
$oPage->add('</div>');
}
}
@@ -545,7 +645,10 @@ EOF
return $aDashlets;
}
/**
* @return int|mixed
*/
protected function GetNewDashletId()
{
$iNewId = 0;
@@ -560,14 +663,32 @@ EOF
return $iNewId + 1;
}
/**
* Prepare dashlet for rendering (eg. change its ID or another processing).
* Meant to be overloaded.
*
* @param \Dashlet $oDashlet
* @param array $aCoordinates
* @param array $aExtraParams
*
* @return void
*/
abstract protected function PrepareDashletForRendering(Dashlet $oDashlet, $aCoordinates, $aExtraParams = array());
/**
* @param $oForm
* @param \DesignerForm $oForm
* @param array $aExtraParams
*
* @return mixed
*/
abstract protected function SetFormParams($oForm, $aExtraParams = array());
/**
* @param string $sType
* @param \ModelFactory|null $oFactory
*
* @return string
*/
public static function GetDashletClassFromType($sType, $oFactory = null)
{
if (is_subclass_of($sType, 'Dashlet'))
@@ -578,45 +699,90 @@ EOF
}
/**
* @return mixed
* N°2634: we must have a unique id per dashlet!
* To avoid collision with other dashlets with the same ID we prefix it with row/cell id
* Collisions typically happen with extensions.
*
* @param boolean $bIsCustomized
* @param string $sDashboardDivId
* @param int $iRow
* @param int $iCol
* @param string $sDashletOrigId
*
* @return string
*
* @since 2.7.0 N°2735
*/
public function GetId()
public static function GetDashletUniqueId($bIsCustomized, $sDashboardDivId, $iRow, $iCol, $sDashletOrigId)
{
return $this->sId;
if(strpos($sDashletOrigId, '_ID_row') !== false)
{
return $sDashletOrigId;
}
$sDashletId = $sDashboardDivId."_ID_row".$iRow."_col".$iCol."_".$sDashletOrigId;
if ($bIsCustomized)
{
$sDashletId = 'CUSTOM_'.$sDashletId;
}
return $sDashletId;
}
}
/**
* Class RuntimeDashboard
*/
class RuntimeDashboard extends Dashboard
{
protected $bCustomized;
/** @var string $sDefinitionFile */
private $sDefinitionFile = '';
/** @var null $sReloadURL */
private $sReloadURL = null;
/** @var bool $bCustomized */
protected $bCustomized;
/**
* @inheritDoc
*/
public function __construct($sId)
{
parent::__construct($sId);
$this->bCustomized = false;
$this->oMetaModel = new ModelReflectionRuntime();
$this->bCustomized = false;
}
/**
* @return bool
* @since 2.7.0
*/
public function GetCustomFlag()
{
return $this->bCustomized;
}
/**
* @param bool $bCustomized
* @since 2.7.0
*/
public function SetCustomFlag($bCustomized)
{
$this->bCustomized = $bCustomized;
}
/**
* @param \DesignerForm $oForm
*
* @param array $aExtraParams
*
* @inheritDoc
* @throws \Exception
*/
protected function SetFormParams($oForm, $aExtraParams = array())
{
$oForm->SetSubmitParams(utils::GetAbsoluteUrlAppRoot().'pages/ajax.render.php', array('operation' => 'update_dashlet_property', 'extra_params' => $aExtraParams));
}
/**
* @inheritDoc
* @throws \Exception
*/
public function Save()
{
$sXml = $this->ToXml();
@@ -632,7 +798,7 @@ class RuntimeDashboard extends Dashboard
}
else
{
// No such customized dasboard for the current user, let's create a new record
// No such customized dashboard for the current user, let's create a new record
$oUserDashboard = new UserDashboard();
$oUserDashboard->Set('user_id', UserRights::GetUserId());
$oUserDashboard->Set('menu_code', $this->sId);
@@ -642,7 +808,18 @@ class RuntimeDashboard extends Dashboard
$oUserDashboard->DBWrite();
utils::PopArchiveMode();
}
/**
* @throws \ArchivedObjectException
* @throws \CoreCannotSaveObjectException
* @throws \CoreException
* @throws \CoreUnexpectedValue
* @throws \DeleteException
* @throws \MissingQueryArgument
* @throws \MySQLException
* @throws \MySQLHasGoneAwayException
* @throws \OQLException
*/
public function Revert()
{
$oUDSearch = new DBObjectSearch('UserDashboard');
@@ -669,6 +846,7 @@ class RuntimeDashboard extends Dashboard
* @throws \MissingQueryArgument
* @throws \MySQLException
* @throws \MySQLHasGoneAwayException
* @throws \Exception
*/
public static function GetDashboard($sDashboardFile, $sDashBoardId)
{
@@ -714,10 +892,7 @@ class RuntimeDashboard extends Dashboard
}
/**
* @param \iTopWebPage $oPage
* @param bool $bEditMode
* @param array $aExtraParams (class and id of the current object
*
* @inheritDoc
* @throws \Exception
*/
public function Render($oPage, $bEditMode = false, $aExtraParams = array(), $bCanEdit = true)
@@ -747,7 +922,7 @@ class RuntimeDashboard extends Dashboard
if (!$bEditMode && !$oPage->IsPrintableVersion())
{
$sId = $this->GetId();
$sDivId = preg_replace('/[^a-zA-Z0-9_]/', '', $sId);
$sDivId = utils::Sanitize($sId, '', 'element_identifier');
if ($this->GetAutoReload())
{
$sFile = addslashes($this->GetDefinitionFile());
@@ -810,7 +985,7 @@ EOF
protected function RenderSelector($oPage, $aAjaxParams = array())
{
$sId = $this->GetId();
$sDivId = preg_replace('/[^a-zA-Z0-9_]/', '', $sId);
$sDivId = utils::Sanitize($sId, '', 'element_identifier');
$sExtraParams = json_encode($aAjaxParams);
$sSelectorHtml = '<div class="dashboard-selector">';
@@ -852,6 +1027,9 @@ EOF
);
}
/**
* @return bool
*/
protected function HasCustomDashboard()
{
try
@@ -880,7 +1058,7 @@ EOF
{
$oPage->add_linked_script(utils::GetAbsoluteUrlAppRoot().'js/jquery.iframe-transport.js');
$oPage->add_linked_script(utils::GetAbsoluteUrlAppRoot().'js/jquery.fileupload.js');
$sEditMenu = "<div id=\"DashboardMenu\"><ul><li><img src=\"../images/pencil-menu.png\"><ul>";
$sEditMenu = "<div id=\"DashboardMenu\"><ul><li><i class=\"top-right-icon icon-additional-arrow fas fa-pencil-alt\"></i><ul>";
$aActions = array();
$sFile = addslashes($this->sDefinitionFile);
@@ -940,9 +1118,7 @@ EOF
}
/**
* @param \WebPage $oPage
*
* @throws \ReflectionException
* @inheritDoc
*/
public function RenderProperties($oPage, $aExtraParams = array())
{
@@ -978,7 +1154,7 @@ EOF
/**
* @param \iTopWebPage $oPage
* @param \WebPage $oPage
*
* @param array $aExtraParams
*
@@ -998,9 +1174,11 @@ EOF
{
$aRenderParams = $aExtraParams;
}
$aRenderParams['dashboard_div_id'] = $aExtraParams['dashboard_div_id'];
$sJSExtraParams = json_encode($aExtraParams);
$oPage->add('<div id="dashboard_editor">');
$oPage->add('<div class="ui-layout-center">');
$this->SetCustomFlag(true);
$this->Render($oPage, true, $aRenderParams);
$oPage->add('</div>');
$oPage->add('<div class="ui-layout-east">');
@@ -1015,12 +1193,12 @@ EOF
$sOkButtonLabel = Dict::S('UI:Button:Save');
$sCancelButtonLabel = Dict::S('UI:Button:Cancel');
$sId = addslashes($this->sId);
$sLayoutClass = addslashes($this->sLayoutClass);
$sId = json_encode($this->sId);
$sLayoutClass = json_encode($this->sLayoutClass);
$sAutoReload = $this->bAutoReload ? 'true' : 'false';
$sAutoReloadSec = (string) $this->iAutoReloadSec;
$sTitle = addslashes($this->sTitle);
$sFile = addslashes($this->GetDefinitionFile());
$sTitle = json_encode($this->sTitle);
$sFile = json_encode($this->GetDefinitionFile());
$sUrl = utils::GetAbsoluteUrlAppRoot().'pages/ajax.render.php';
$sReloadURL = $this->GetReloadURL();
@@ -1029,7 +1207,7 @@ EOF
$sAutoApplyConfirmationMessage = addslashes(Dict::S('UI:AutoApplyConfirmationMessage'));
$oPage->add_ready_script(
<<<EOF
<<<JS
window.bLeavingOnUserAction = false;
$('#dashboard_editor').dialog({
@@ -1072,10 +1250,15 @@ $('#dashboard_editor').dialog({
});
$('#dashboard_editor .ui-layout-center').runtimedashboard({
dashboard_id: '$sId', layout_class: '$sLayoutClass', title: '$sTitle',
auto_reload: $sAutoReload, auto_reload_sec: $sAutoReloadSec,
submit_to: '$sUrl', submit_parameters: {operation: 'save_dashboard', file: '$sFile', extra_params: $sJSExtraParams, reload_url: '$sReloadURL'},
render_to: '$sUrl', render_parameters: {operation: 'render_dashboard', file: '$sFile', extra_params: $sJSExtraParams, reload_url: '$sReloadURL'},
dashboard_id: $sId,
layout_class: $sLayoutClass,
title: $sTitle,
auto_reload: $sAutoReload,
auto_reload_sec: $sAutoReloadSec,
submit_to: '$sUrl',
submit_parameters: {operation: 'save_dashboard', file: $sFile, extra_params: $sJSExtraParams, reload_url: '$sReloadURL'},
render_to: '$sUrl',
render_parameters: {operation: 'render_dashboard', file: $sFile, extra_params: $sJSExtraParams, reload_url: '$sReloadURL'},
new_dashlet_parameters: {operation: 'new_dashlet'}
});
@@ -1114,11 +1297,18 @@ window.onbeforeunload = function() {
}
// return nothing ! safer for IE
};
EOF
JS
);
$oPage->add_ready_script("");
}
/**
* @param string|null $sOQL
*
* @return \DesignerForm
* @throws \DictExceptionMissingString
* @throws \ReflectionException
*/
public static function GetDashletCreationForm($sOQL = null)
{
$oAppContext = new ApplicationContext();
@@ -1229,6 +1419,9 @@ EOF
/**
* @param \WebPage $oPage
* @param $sOQL
*
* @throws \DictExceptionMissingString
* @throws \ReflectionException
*/
public static function GetDashletCreationDlgFromOQL($oPage, $sOQL)
{
@@ -1244,7 +1437,7 @@ EOF
$sCancelButtonLabel = Dict::S('UI:Button:Cancel');
$oPage->add_ready_script(
<<<EOF
<<<JS
$('#dashlet_creation_dlg').dialog({
width: 600,
modal: true,
@@ -1273,7 +1466,7 @@ $('#dashlet_creation_dlg').dialog({
],
close: function() { $(this).remove(); }
});
EOF
JS
);
}
@@ -1285,6 +1478,29 @@ EOF
return $this->sDefinitionFile;
}
/**
* @param string $sDashboardFileRelative can also be an absolute path (compatibility with old URL)
*
* @return string full path to the Dashboard file
* @throws \SecurityException if path isn't under approot
* @uses utils::RealPath()
* @since 2.7.8 3.0.3 3.1.0 N°4449 remove FPD
*/
public static function GetDashboardFileFromRelativePath($sDashboardFileRelative)
{
if (utils::RealPath($sDashboardFileRelative, APPROOT)) {
// compatibility with old URL containing absolute path !
return $sDashboardFileRelative;
}
$sDashboardFile = APPROOT.$sDashboardFileRelative;
if (false === utils::RealPath($sDashboardFile, APPROOT)) {
throw new SecurityException('Invalid dashboard file !');
}
return $sDashboardFile;
}
/**
* @param string $sDefinitionFile
*/
@@ -1293,13 +1509,105 @@ EOF
$this->sDefinitionFile = $sDefinitionFile;
}
/**
* @return string|null
*/
public function GetReloadURL()
{
return $this->sReloadURL;
}
/**
* @param string $sReloadURL
*/
public function SetReloadURL($sReloadURL)
{
$this->sReloadURL = $sReloadURL;
}
}
/**
* @inheritDoc
*/
protected function PrepareDashletForRendering(Dashlet $oDashlet, $aCoordinates, $aExtraParams = array())
{
$sDashletIdOrig = $oDashlet->GetID();
$sDashboardSanitizedId = $this->GetSanitizedId();
$sDashletIdNew = static::GetDashletUniqueId($this->GetCustomFlag(), $sDashboardSanitizedId, $aCoordinates[1], $aCoordinates[0], $sDashletIdOrig);
$oDashlet->SetID($sDashletIdNew);
$this->UpdateDashletUserPrefs($oDashlet, $sDashletIdOrig, $aExtraParams);
}
/**
* Migrate dashlet specific prefs to new format
* Before 2.7.0 we were using the same for dashboard menu or dashboard attributes, standard or custom :
* <alias>-<class>|Dashlet<idx_dashlet>
* Since 2.7.0 it is the following, with a "CUSTOM_" prefix if necessary :
* * dashboard menu : <dashboard_id>_IDrow<row_idx>-col<col_idx>-<dashlet_idx>
* * dashboard attribute : <class>__<attcode>_IDrow<row_idx>-col<col_idx>-<dashlet_idx>
*
* @param \Dashlet $oDashlet
* @param string $sDashletIdOrig
*
* @param array $aExtraParams
*
* @since 2.7.0 N°2735
*/
private function UpdateDashletUserPrefs(Dashlet $oDashlet, $sDashletIdOrig, array $aExtraParams)
{
$bIsDashletWithListPref = ($oDashlet instanceof DashletObjectList);
if (!$bIsDashletWithListPref)
{
return;
}
/** @var \DashletObjectList $oDashlet */
$bDashletIdInNewFormat = ($sDashletIdOrig === $oDashlet->GetID());
if ($bDashletIdInNewFormat)
{
return;
}
$sNewPrefKey = $this->GetDashletObjectListAppUserPreferencesPrefix($oDashlet, $aExtraParams, $oDashlet->GetID());
$sPrefValueForNewKey = appUserPreferences::GetPref($sNewPrefKey, null);
$bHasPrefInNewFormat = ($sPrefValueForNewKey !== null);
if ($bHasPrefInNewFormat)
{
return;
}
$sOldPrefKey = $this->GetDashletObjectListAppUserPreferencesPrefix($oDashlet, $aExtraParams, $sDashletIdOrig);
$sPrefValueForOldKey = appUserPreferences::GetPref($sOldPrefKey, null);
$bHasPrefInOldFormat = ($sPrefValueForOldKey !== null);
if (!$bHasPrefInOldFormat)
{
return;
}
appUserPreferences::SetPref($sNewPrefKey, $sPrefValueForOldKey);
appUserPreferences::UnsetPref($sOldPrefKey);
}
/**
* @param \DashletObjectList $oDashlet
* @param array $aExtraParams
* @param string $sDashletId
*
* @return string
* @since 2.7.0
*/
private function GetDashletObjectListAppUserPreferencesPrefix(DashletObjectList $oDashlet, $aExtraParams, $sDashletId)
{
$sDataTableId = Dashlet::APPUSERPREFERENCES_PREFIX.$sDashletId;
$aClassAliases = array();
try{
$oFilter = $oDashlet->GetDBSearch($aExtraParams);
$aClassAliases = $oFilter->GetSelectedClasses();
}
catch (Exception $e)
{
//on error, return default value
return null;
}
return DataTableSettings::GetAppUserPreferenceKey($aClassAliases, $sDataTableId);
}
}

View File

@@ -26,14 +26,17 @@
abstract class DashboardLayout
{
public function __construct()
{
}
abstract public function Render($oPage, $aDashlets, $bEditMode = false);
/**
* @param int $iCellIdx
*
* @return array Containing 2 scalars: Col number and row number (starting from 0)
* @since 2.7.0
*/
abstract public function GetDashletCoordinates($iCellIdx);
static public function GetInfo()
public static function GetInfo()
{
return array(
'label' => '',
@@ -51,7 +54,7 @@ abstract class DashboardLayoutMultiCol extends DashboardLayout
{
$this->iNbCols = 1;
}
protected function TrimCell($aDashlets)
{
$aKeys = array_reverse(array_keys($aDashlets));
@@ -61,7 +64,7 @@ abstract class DashboardLayoutMultiCol extends DashboardLayout
{
/** @var \Dashlet $oDashlet */
$oDashlet = $aDashlets[$aKeys[$idx]];
if ($oDashlet->IsVisible())
if ($oDashlet::IsVisible())
{
$bNoVisibleFound = false;
}
@@ -110,20 +113,21 @@ abstract class DashboardLayoutMultiCol extends DashboardLayout
{
// Trim the list of cells to remove the invisible/empty ones at the end of the array
$aCells = $this->TrimCellsArray($aCells);
$oPage->add('<table style="width:100%;table-layout:fixed;"><tbody>');
$iCellIdx = 0;
$fColSize = 100 / $this->iNbCols;
$sStyle = $bEditMode ? 'border: 1px #ccc dashed; width:'.$fColSize.'%;' : 'width: '.$fColSize.'%;';
$sClass = $bEditMode ? 'layout_cell edit_mode' : 'dashboard';
$iNbRows = ceil(count($aCells) / $this->iNbCols);
for($iRows = 0; $iRows < $iNbRows; $iRows++)
{
$oPage->add('<tr>');
$oPage->add("<tr data-dashboard-row-index=\"$iRows\">");
for($iCols = 0; $iCols < $this->iNbCols; $iCols++)
{
$sCellClass = ($iRows == $iNbRows-1) ? $sClass.' layout_last_used_rank' : $sClass;
$oPage->add("<td style=\"$sStyle\" class=\"$sCellClass\" data-dashboard-cell-index=\"$iCellIdx\">");
$oPage->add("<td style=\"$sStyle\" class=\"$sCellClass\" data-dashboard-column-index=\"$iCols\" data-dashboard-cell-index=\"$iCellIdx\">");
if (array_key_exists($iCellIdx, $aCells))
{
$aDashlets = $aCells[$iCellIdx];
@@ -132,7 +136,7 @@ abstract class DashboardLayoutMultiCol extends DashboardLayout
/** @var \Dashlet $oDashlet */
foreach($aDashlets as $oDashlet)
{
if ($oDashlet->IsVisible())
if ($oDashlet::IsVisible())
{
$oDashlet->DoRender($oPage, $bEditMode, true /* bEnclosingDiv */, $aExtraParams);
}
@@ -155,10 +159,10 @@ abstract class DashboardLayoutMultiCol extends DashboardLayout
if ($bEditMode) // Add one row for extensibility
{
$sStyle = 'style="border: 1px #ccc dashed; width:'.$fColSize.'%;" class="layout_cell edit_mode layout_extension" data-dashboard-cell-index="'.$iCellIdx.'"';
$oPage->add('<tr>');
$oPage->add("<tr data-dashboard-row-index=\"$iRows\">");
for($iCols = 0; $iCols < $this->iNbCols; $iCols++)
{
$oPage->add("<td $sStyle>");
$oPage->add("<td $sStyle data-dashboard-column-index=\"$iCols\">");
$oPage->add('&nbsp;');
$oPage->add('</td>');
}
@@ -166,6 +170,17 @@ abstract class DashboardLayoutMultiCol extends DashboardLayout
}
$oPage->add('</tbody></table>');
}
/**
* @inheritDoc
*/
public function GetDashletCoordinates($iCellIdx)
{
$iColNumber = (int) $iCellIdx % $this->iNbCols;
$iRowNumber = (int) floor($iCellIdx / $this->iNbCols);
return array($iColNumber, $iRowNumber);
}
}
class DashboardLayoutOneCol extends DashboardLayoutMultiCol

View File

@@ -26,6 +26,9 @@ require_once(APPROOT.'application/forms.class.inc.php');
*/
abstract class Dashlet
{
/** @var string */
const APPUSERPREFERENCES_PREFIX = 'Dashlet';
protected $oModelReflection;
protected $sId;
protected $bRedrawNeeded;
@@ -252,7 +255,7 @@ abstract class Dashlet
catch(OqlException $e)
{
$oPage->add('<div class="dashlet-content">');
$oPage->p($e->GetUserFriendlyDescription());
$oPage->p(utils::HtmlEntities($e->GetUserFriendlyDescription()));
$oPage->add('</div>');
}
catch(Exception $e)
@@ -456,17 +459,21 @@ EOF
$sAttType = $aTargetAttCodes[$sTargetAttCode];
$sExtFieldAttCode = $sTargetAttCode;
}
if (is_a($sAttType, 'AttributeLinkedSet', true))
{
continue;
}
if (is_a($sAttType, 'AttributeFriendlyName', true))
{
continue;
}
if (is_a($sAttType, 'AttributeOneWayPassword', true))
{
continue;
$aForbidenAttType = [
'AttributeLinkedSet',
'AttributeFriendlyName',
'iAttributeNoGroupBy', //we cannot only use iAttributeNoGroupBy since this method is also used by the designer who do not have access to the classes' PHP reflection API. So the known classes has to be listed altogether
'AttributeOneWayPassword',
'AttributeEncryptedString',
'AttributePassword',
];
foreach ($aForbidenAttType as $sForbidenAttType) {
if (is_a($sAttType, $sForbidenAttType, true))
{
continue 2;
}
}
$sLabel = $this->oModelReflection->GetLabel($sClass, $sAttCode);
@@ -514,7 +521,7 @@ EOF
*
* Used as a fallback in iTop for unknown dashlet classes.
*
* @since 2.5
* @since 2.5.0
*/
class DashletUnknown extends Dashlet
{
@@ -913,15 +920,28 @@ class DashletObjectList extends Dashlet
public function Render($oPage, $bEditMode = false, $aExtraParams = array())
{
$sTitle = $this->aProperties['title'];
$sQuery = $this->aProperties['query'];
$sShowMenu = $this->aProperties['menu'] ? '1' : '0';
$oPage->add('<div class="dashlet-content">');
$sHtmlTitle = utils::HtmlEntities(Dict::S($sTitle)); // done in the itop block
if ($sHtmlTitle != '')
{
$oPage->add('<h1>'.$sHtmlTitle.'</h1>');
$oPage->add('<div class="main_header"><h1>&nbsp;'.$sHtmlTitle.'</h1></div>');
}
$oFilter = $this->GetDBSearch($aExtraParams);
$oBlock = new DisplayBlock($oFilter, 'list');
$aParams = array(
'menu' => $sShowMenu,
'table_id' => self::APPUSERPREFERENCES_PREFIX.$this->sId,
);
$sBlockId = 'block_'.$this->sId.($bEditMode ? '_edit' : ''); // make a unique id (edition occurring in the same DOM)
$oBlock->Display($oPage, $sBlockId, array_merge($aExtraParams, $aParams));
$oPage->add('</div>');
}
public function GetDBSearch($aExtraParams = array())
{
$sQuery = $this->aProperties['query'];
if (isset($aExtraParams['query_params']))
{
$aQueryParams = $aExtraParams['query_params'];
@@ -935,15 +955,8 @@ class DashletObjectList extends Dashlet
{
$aQueryParams = array();
}
$oFilter = DBObjectSearch::FromOQL($sQuery, $aQueryParams);
$oBlock = new DisplayBlock($oFilter, 'list');
$aParams = array(
'menu' => $sShowMenu,
'table_id' => 'Dashlet'.$this->sId,
);
$sBlockId = 'block_'.$this->sId.($bEditMode ? '_edit' : ''); // make a unique id (edition occurring in the same DOM)
$oBlock->Display($oPage, $sBlockId, array_merge($aExtraParams, $aParams));
$oPage->add('</div>');
return DBObjectSearch::FromOQL($sQuery, $aQueryParams);
}
/**
@@ -1112,7 +1125,7 @@ abstract class DashletGroupBy extends Dashlet
$this->sFunction = null;
}
if (empty($this->aProperties['order_direction']))
if ((!is_null($this->sClass)) && empty($this->aProperties['order_direction']))
{
$aAttributeTypes = $this->oModelReflection->ListAttributes($this->sClass);
if (isset($aAttributeTypes[$this->sGroupByAttCode]))
@@ -1263,10 +1276,10 @@ abstract class DashletGroupBy extends Dashlet
break;
}
$oPage->add('<div style="text-align:center" class="dashlet-content">');
$oPage->add('<div class="dashlet-content">');
if ($sHtmlTitle != '')
{
$oPage->add('<h1>'.$sHtmlTitle.'</h1>');
$oPage->add('<div class="main_header"><h1>&nbsp;'.$sHtmlTitle.'</h1></div>');
}
$sBlockId = 'block_'.$this->sId.($bEditMode ? '_edit' : ''); // make a unique id (edition occuring in the same DOM)
$oBlock = new DisplayBlock($oFilter, $sType);
@@ -1859,11 +1872,11 @@ class DashletGroupByTable extends DashletGroupBy
$iTotal += $aDisplayData['value'];
}
$oPage->add('<div class="dashlet-content">');
$sBlockId = 'block_fake_'.$this->sId.($bEditMode ? '_edit' : ''); // make a unique id (edition occuring in the same DOM)
$oPage->add('<div id="'.$sBlockId.'" class="display_block">');
$oPage->add('<div class="dashlet-content">');
$oPage->add('<p>'.Dict::Format('UI:Pagination:HeaderNoSelection', $iTotal).'</p>');
$oPage->add('<table class="listResults">');
$oPage->add('<thead>');
@@ -1917,7 +1930,7 @@ class DashletHeaderStatic extends Dashlet
$oPage->add('<div class="main_header">');
$oPage->add('<img src="'.$sIconPath.'">');
$oPage->add('<h1>'.$this->oModelReflection->DictString($sTitle).'</h1>');
$oPage->add('<div class="main_header"><h1>&nbsp;'.$this->oModelReflection->DictString($sTitle).'</h1></div>');
$oPage->add('</div>');
$oPage->add('</div>');

View File

@@ -1,14 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<itop_design xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="1.6">
<itop_design xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="1.7">
<portals>
<portal id="legacy_portal" _delta="define">
<url>portal/index.php</url>
<rank>1.0</rank>
<handler/>
<allow>
</allow>
<deny/>
</portal>
<portal id="backoffice" _delta="define">
<url>pages/UI.php</url>
<rank>2.0</rank>
@@ -23,5 +15,10 @@
<menu id="AdminTools" xsi:type="MenuGroup" _delta="define">
<rank>80</rank>
</menu>
<menu id="SystemTools" xsi:type="MenuGroup" _delta="define">
<rank>100</rank>
<enable_class>ResourceSystemMenu</enable_class>
<enable_action>UR_ACTION_MODIFY</enable_action>
</menu>
</menus>
</itop_design>

View File

@@ -1,30 +1,27 @@
<?php
// Copyright (C) 2010-2017 Combodo SARL
//
// This file is part of iTop.
//
// iTop is free software; you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// iTop 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 Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with iTop. If not, see <http://www.gnu.org/licenses/>
/**
* Data Table to display a set of objects in a tabular manner in HTML
* Copyright (C) 2013-2020 Combodo SARL
*
* @copyright Copyright (C) 2010-2017 Combodo SARL
* @license http://opensource.org/licenses/AGPL-3.0
* This file is part of iTop.
*
* iTop is free software; you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* iTop 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 Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
*/
class DataTable
{
protected $iListId; // Unique ID inside the web page
/** @var string */
private $sDatatableContainerId;
protected $sTableId; // identifier for saving the settings (combined with the class aliases)
protected $oSet; // The set of objects to display
protected $aClassAliases; // The aliases (alias => class) inside the set
@@ -34,14 +31,20 @@ class DataTable
protected $bShowObsoleteData;
/**
* @param $iListId mixed Unique ID for this div/table in the page
* @param $oSet DBObjectSet The set of data to display
* @param $aClassAliases Hash The list of classes/aliases to be displayed in this set $sAlias => $sClassName
* @param $sTableId mixed A string (or null) identifying this table in order to persist its settings
* @param string $iListId Unique ID for this div/table in the page
* @param DBObjectSet $oSet The set of data to display
* @param array$aClassAliases The list of classes/aliases to be displayed in this set $sAlias => $sClassName
* @param string $sTableId A string (or null) identifying this table in order to persist its settings
*
* @throws \CoreException
* @throws \MissingQueryArgument
* @throws \MySQLException
* @throws \MySQLHasGoneAwayException
*/
public function __construct($iListId, $oSet, $aClassAliases, $sTableId = null)
{
$this->iListId = utils::GetSafeId($iListId); // Make a "safe" ID for jQuery
$this->sDatatableContainerId = 'datatable_'.utils::GetSafeId($iListId);
$this->oSet = $oSet;
$this->aClassAliases = $aClassAliases;
$this->sTableId = $sTableId;
@@ -50,7 +53,19 @@ class DataTable
$this->oDefaultSettings = null;
$this->bShowObsoleteData = $oSet->GetShowObsoleteData();
}
/**
* @param \WebPage $oPage
* @param \DataTableSettings $oSettings
* @param $bActionsMenu
* @param $sSelectMode
* @param $bViewLink
* @param $aExtraParams
*
* @return string
* @throws \CoreException
* @throws \MySQLException
*/
public function Display(WebPage $oPage, DataTableSettings $oSettings, $bActionsMenu, $sSelectMode, $bViewLink, $aExtraParams)
{
$this->oDefaultSettings = $oSettings;
@@ -119,7 +134,23 @@ class DataTable
return $this->GetAsHTML($oPage, $oCustomSettings->iDefaultPageSize, $oCustomSettings->iDefaultPageSize, 0, $oCustomSettings->aColumns, $bActionsMenu, $bToolkitMenu, $sSelectMode, $bViewLink, $aExtraParams);
}
/**
* @param \WebPage $oPage
* @param $iPageSize
* @param $iDefaultPageSize
* @param $iPageIndex
* @param $aColumns
* @param $bActionsMenu
* @param $bToolkitMenu
* @param $sSelectMode
* @param $bViewLink
* @param $aExtraParams
*
* @return string
* @throws \ArchivedObjectException
* @throws \CoreException
*/
public function GetAsHTML(WebPage $oPage, $iPageSize, $iDefaultPageSize, $iPageIndex, $aColumns, $bActionsMenu, $bToolkitMenu, $sSelectMode, $bViewLink, $aExtraParams)
{
$sObjectsCount = $this->GetObjectCount($oPage, $sSelectMode);
@@ -137,7 +168,7 @@ class DataTable
$sDataTable = $this->GetHTMLTable($oPage, $aColumns, $sSelectMode, $iPageSize, $bViewLink, $aExtraParams);
$sConfigDlg = $this->GetTableConfigDlg($oPage, $aColumns, $bViewLink, $iDefaultPageSize);
$sHtml = "<table id=\"datatable_{$this->iListId}\" class=\"datatable\">";
$sHtml = "<table id=\"{$this->sDatatableContainerId}\" class=\"datatable\">";
$sHtml .= "<tr><td>";
$sHtml .= "<table style=\"width:100%;\">";
$sHtml .= "<tr><td class=\"pagination_container\">$sObjectsCount</td><td class=\"menucontainer\">$sToolkitMenu $sActionsMenu</td></tr>";
@@ -173,7 +204,7 @@ class DataTable
$aOptions['oDefaultSettings'] = $this->GetAsHash($this->oDefaultSettings);
}
$sJSOptions = json_encode($aOptions);
$oPage->add_ready_script("$('#datatable_{$this->iListId}').datatable($sJSOptions);");
$oPage->add_ready_script("$('#{$this->sDatatableContainerId}').datatable($sJSOptions);");
return $sHtml;
}
@@ -198,7 +229,13 @@ class DataTable
}
return $sHtml;
}
/**
* @param \WebPage $oPage
* @param $sSelectMode
*
* @return string
*/
protected function GetObjectCount(WebPage $oPage, $sSelectMode)
{
if (($sSelectMode == 'single') || ($sSelectMode == 'multiple'))
@@ -211,6 +248,15 @@ class DataTable
}
return $sHtml;
}
/**
* @param \WebPage $oPage
* @param $iPageSize
* @param $iDefaultPageSize
* @param $iPageIndex
*
* @return string
*/
protected function GetPager(WebPage $oPage, $iPageSize, $iDefaultPageSize, $iPageIndex)
{
$sHtml = '';
@@ -295,7 +341,17 @@ class DataTable
EOF;
return $sHtml;
}
/**
* @param \WebPage $oPage
* @param $aExtraParams
*
* @return string
* @throws \CoreException
* @throws \DictExceptionMissingString
* @throws \MissingQueryArgument
* @throws \MySQLException
*/
protected function GetActionsMenu(WebPage $oPage, $aExtraParams)
{
$oMenuBlock = new MenuBlock($this->oSet->GetFilter(), 'list');
@@ -303,13 +359,20 @@ EOF;
$sHtml = $oMenuBlock->GetRenderContent($oPage, $aExtraParams, $this->iListId);
return $sHtml;
}
/**
* @param \WebPage $oPage
* @param $aExtraParams
*
* @return string
* @throws \Exception
*/
protected function GetToolkitMenu(WebPage $oPage, $aExtraParams)
{
if (!$oPage->IsPrintableVersion())
{
$sMenuTitle = Dict::S('UI:ConfigureThisList');
$sHtml = '<div class="itop_popup toolkit_menu" id="tk_'.$this->iListId.'"><ul><li><img src="../images/toolkit_menu.png?t='.utils::GetCacheBusterTimestamp().'"><ul>';
$sHtml = '<div class="itop_popup toolkit_menu" id="tk_'.$this->iListId.'"><ul><li aria-label="'.Dict::S('UI:Menu:Toolkit').'"><i class="fas fa-tools"></i><i class="fas fa-caret-down"></i><ul>';
$oMenuItem1 = new JSPopupMenuItem('iTop::ConfigureList', $sMenuTitle, "$('#datatable_dlg_".$this->iListId."').dialog('open');");
$aActions = array(
@@ -326,7 +389,15 @@ EOF;
}
return $sHtml;
}
/**
* @param \WebPage $oPage
* @param $aColumns
* @param $bViewLink
* @param $iDefaultPageSize
*
* @return string
*/
protected function GetTableConfigDlg(WebPage $oPage, $aColumns, $bViewLink, $iDefaultPageSize)
{
$sHtml = "<div id=\"datatable_dlg_{$this->iListId}\" style=\"display: none;\">";
@@ -350,35 +421,54 @@ EOF;
$sHtml .= "<input id=\"dtbl_dlg_all_{$this->iListId}\" type=\"radio\" name=\"scope\" $sGenericChecked value=\"defaults\"><label for=\"dtbl_dlg_all_{$this->iListId}\">&nbsp;".Dict::S('UI:ForAllLists').'</label></p>';
$sHtml .= "</fieldset>";
$sHtml .= '<table style="width:100%"><tr><td style="text-align:center;">';
$sHtml .= '<button type="button" onclick="$(\'#datatable_'.$this->iListId.'\').datatable(\'onDlgCancel\'); $(\'#datatable_dlg_'.$this->iListId.'\').dialog(\'close\')">'.Dict::S('UI:Button:Cancel').'</button>';
$sHtml .= '<button type="button" onclick="$(\'#'.$this->sDatatableContainerId.'\').datatable(\'onDlgCancel\'); $(\'#datatable_dlg_'.$this->iListId.'\').dialog(\'close\')">'.Dict::S('UI:Button:Cancel').'</button>';
$sHtml .= '</td><td style="text-align:center;">';
$sHtml .= '<button type="submit" onclick="$(\'#datatable_'.$this->iListId.'\').datatable(\'onDlgOk\');$(\'#datatable_dlg_'.$this->iListId.'\').dialog(\'close\');">'.Dict::S('UI:Button:Ok').'</button>';
$sHtml .= '<button type="submit" onclick="$(\'#'.$this->sDatatableContainerId.'\').datatable(\'onDlgOk\');$(\'#datatable_dlg_'.$this->iListId.'\').dialog(\'close\');">'.Dict::S('UI:Button:Ok').'</button>';
$sHtml .= '</td></tr></table>';
$sHtml .= "</form>";
$sHtml .= "</div>";
$sDlgTitle = addslashes(Dict::S('UI:ListConfigurationTitle'));
$oPage->add_ready_script("$('#datatable_dlg_{$this->iListId}').dialog({autoOpen: false, title: '$sDlgTitle', width: 500, close: function() { $('#datatable_{$this->iListId}').datatable('onDlgCancel'); } });");
$oPage->add_ready_script("$('#datatable_dlg_{$this->iListId}').dialog({autoOpen: false, title: '$sDlgTitle', width: 500, close: function() { $('#{$this->sDatatableContainerId}').datatable('onDlgCancel'); } });");
return $sHtml;
}
/**
* @param $oSetting
*
* @return array
*/
public function GetAsHash($oSetting)
{
$aSettings = array('iDefaultPageSize' => $oSetting->iDefaultPageSize, 'oColumns' => $oSetting->aColumns);
return $aSettings;
}
/**
* @param array $aColumns
* @param string $sSelectMode
* @param bool $bViewLink
*
* @return array
* @throws \CoreException
* @throws \DictExceptionMissingString
* @throws \Exception
*/
protected function GetHTMLTableConfig($aColumns, $sSelectMode, $bViewLink)
{
$aAttribs = array();
if ($sSelectMode == 'multiple')
{
$aAttribs['form::select'] = array('label' => "<input type=\"checkbox\" onClick=\"CheckAll('.selectList{$this->iListId}:not(:disabled)', this.checked);\" class=\"checkAll\"></input>", 'description' => Dict::S('UI:SelectAllToggle+'));
$aAttribs['form::select'] = array(
'label' => "<input type=\"checkbox\" onClick=\"CheckAll('.selectList{$this->iListId}:not(:disabled)', this.checked);\" class=\"checkAll\"></input>",
'description' => Dict::S('UI:SelectAllToggle+'),
'metadata' => array(),
);
}
else if ($sSelectMode == 'single')
{
$aAttribs['form::select'] = array('label' => "", 'description' => '');
$aAttribs['form::select'] = array('label' => '', 'description' => '', 'metadata' => array());
}
foreach($this->aClassAliases as $sAlias => $sClassName)
@@ -389,19 +479,55 @@ EOF;
{
if ($sAttCode == '_key_')
{
$aAttribs['key_'.$sAlias] = array('label' => MetaModel::GetName($sClassName), 'description' => '');
$sAttLabel = MetaModel::GetName($sClassName);
$aAttribs['key_'.$sAlias] = array(
'label' => $sAttLabel,
'description' => '',
'metadata' => array(
'object_class' => $sClassName,
'attribute_label' => $sAttLabel,
),
);
}
else
{
$oAttDef = MetaModel::GetAttributeDef($sClassName, $sAttCode);
$aAttribs[$sAttCode.'_'.$sAlias] = array('label' => MetaModel::GetLabel($sClassName, $sAttCode), 'description' => $oAttDef->GetOrderByHint());
$sAttDefClass = get_class($oAttDef);
$sAttLabel = MetaModel::GetLabel($sClassName, $sAttCode);
$aAttribs[$sAttCode.'_'.$sAlias] = array(
'label' => $sAttLabel,
'description' => $oAttDef->GetOrderByHint(),
'metadata' => array(
'object_class' => $sClassName,
'attribute_code' => $sAttCode,
'attribute_type' => $sAttDefClass,
'attribute_label' => $sAttLabel,
),
);
}
}
}
}
return $aAttribs;
}
/**
* @param $aColumns
* @param $sSelectMode
* @param $iPageSize
* @param $bViewLink
* @param $aExtraParams
*
* @return array
* @throws \CoreException
* @throws \CoreUnexpectedValue
* @throws \MissingQueryArgument
* @throws \MySQLException
* @throws \MySQLHasGoneAwayException
* @throws \Exception
*/
protected function GetHTMLTableValues($aColumns, $sSelectMode, $iPageSize, $bViewLink, $aExtraParams)
{
$bLocalize = true;
@@ -411,6 +537,7 @@ EOF;
}
$aValues = array();
$aAttDefsCache = array();
$this->oSet->Seek(0);
$iMaxObjects = $iPageSize;
while (($aObjects = $this->oSet->FetchAssoc()) && ($iMaxObjects != 0))
@@ -451,11 +578,41 @@ EOF;
{
if ($sAttCode == '_key_')
{
$aRow['key_'.$sAlias] = $aObjects[$sAlias]->GetHyperLink();
$aRow['key_'.$sAlias] = array(
'value_raw' => $aObjects[$sAlias]->GetKey(),
'value_html' => $aObjects[$sAlias]->GetHyperLink(),
);
}
else
{
$aRow[$sAttCode.'_'.$sAlias] = $aObjects[$sAlias]->GetAsHTML($sAttCode, $bLocalize);
// Prepare att. def. classes cache to avoid retrieving AttDef for each row
if(!isset($aAttDefsCache[$sClassName][$sAttCode]))
{
$aAttDefClassesCache[$sClassName][$sAttCode] = get_class(MetaModel::GetAttributeDef($sClassName, $sAttCode));
}
// Only retrieve raw (stored) value for simple fields
$bExcludeRawValue = false;
foreach (cmdbAbstractObject::GetAttDefClassesToExcludeFromMarkupMetadataRawValue() as $sAttDefClassToExclude)
{
if (is_a($aAttDefClassesCache[$sClassName][$sAttCode], $sAttDefClassToExclude, true))
{
$bExcludeRawValue = true;
break;
}
}
if($bExcludeRawValue)
{
$aRow[$sAttCode.'_'.$sAlias] = $aObjects[$sAlias]->GetAsHTML($sAttCode, $bLocalize);
}
else
{
$aRow[$sAttCode.'_'.$sAlias] = array(
'value_raw' => $aObjects[$sAlias]->Get($sAttCode),
'value_html' => $aObjects[$sAlias]->GetAsHTML($sAttCode, $bLocalize),
);
}
}
}
}
@@ -484,7 +641,25 @@ EOF;
}
return $aValues;
}
/**
* @param \WebPage $oPage
* @param $aColumns
* @param $sSelectMode
* @param $iPageSize
* @param $bViewLink
* @param $aExtraParams
*
* @return string
* @throws \ArchivedObjectException
* @throws \CoreException
* @throws \CoreUnexpectedValue
* @throws \DictExceptionMissingString
* @throws \MissingQueryArgument
* @throws \MySQLException
* @throws \MySQLHasGoneAwayException
* @throws \Exception
*/
public function GetHTMLTable(WebPage $oPage, $aColumns, $sSelectMode, $iPageSize, $bViewLink, $aExtraParams)
{
$iNbPages = ($iPageSize < 1) ? 1 : ceil($this->iNbObjects / $iPageSize);
@@ -496,7 +671,7 @@ EOF;
$aValues = $this->GetHTMLTableValues($aColumns, $sSelectMode, $iPageSize, $bViewLink, $aExtraParams);
$sHtml = '<table class="listContainer">';
$sHtml = '<table class="listContainer object-list">';
foreach($this->oSet->GetFilter()->GetInternalParams() as $sName => $sValue)
{
@@ -573,19 +748,37 @@ EOF;
}
$sOQL = addslashes($this->oSet->GetFilter()->serialize());
$oPage->add_ready_script(
<<<EOF
var oTable = $('#{$this->iListId} table.listResults');
<<<JS
var oTable = $('#{$this->sDatatableContainerId} table.listResults');
oTable.tableHover();
oTable.tablesorter( { $sHeaders widgets: ['myZebra', 'truncatedList']} ).tablesorterPager({container: $('#pager{$this->iListId}'), totalRows:$iCount, size: $iPageSize, filter: '$sOQL', extra_params: '$sExtraParams', select_mode: '$sSelectModeJS', displayKey: $sDisplayKey, table_id: '{$this->iListId}', columns: $sJSColumns, class_aliases: $sJSClassAliases $sCssCount});
EOF
);
oTable
.tablesorter({ $sHeaders widgets: ['myZebra', 'truncatedList']})
.tablesorterPager({
container: $('#pager{$this->iListId}'),
totalRows:$iCount,
size: $iPageSize,
filter: '$sOQL',
extra_params: '$sExtraParams',
select_mode: '$sSelectModeJS',
displayKey: $sDisplayKey,
table_id: '{$this->sDatatableContainerId}',
columns: $sJSColumns,
class_aliases: $sJSClassAliases $sCssCount
});
JS
);
if ($sFakeSortList != '')
{
$oPage->add_ready_script("oTable.trigger(\"fakesorton\", [$sFakeSortList]);");
}
return $sHtml;
}
/**
* @param \WebPage $oPage
* @param $iDefaultPageSize
* @param $iStart
*/
public function UpdatePager(WebPage $oPage, $iDefaultPageSize, $iStart)
{
$iPageSize = $iDefaultPageSize;
@@ -609,11 +802,48 @@ EOF
*/
class PrintableDataTable extends DataTable
{
/**
* @param \WebPage $oPage
* @param $iPageSize
* @param $iDefaultPageSize
* @param $iPageIndex
* @param $aColumns
* @param $bActionsMenu
* @param $bToolkitMenu
* @param $sSelectMode
* @param $bViewLink
* @param $aExtraParams
*
* @return string
* @throws \ArchivedObjectException
* @throws \CoreException
* @throws \CoreUnexpectedValue
* @throws \DictExceptionMissingString
* @throws \MissingQueryArgument
* @throws \MySQLException
* @throws \MySQLHasGoneAwayException
*/
public function GetAsHTML(WebPage $oPage, $iPageSize, $iDefaultPageSize, $iPageIndex, $aColumns, $bActionsMenu, $bToolkitMenu, $sSelectMode, $bViewLink, $aExtraParams)
{
return $this->GetHTMLTable($oPage, $aColumns, $sSelectMode, -1, $bViewLink, $aExtraParams);
}
/**
* @param \WebPage $oPage
* @param $aColumns
* @param $sSelectMode
* @param $iPageSize
* @param $bViewLink
* @param $aExtraParams
*
* @return string
* @throws \CoreException
* @throws \CoreUnexpectedValue
* @throws \DictExceptionMissingString
* @throws \MissingQueryArgument
* @throws \MySQLException
* @throws \MySQLHasGoneAwayException
*/
public function GetHTMLTable(WebPage $oPage, $aColumns, $sSelectMode, $iPageSize, $bViewLink, $aExtraParams)
{
$iNbPages = ($iPageSize < 1) ? 1 : ceil($this->iNbObjects / $iPageSize);
@@ -638,7 +868,13 @@ class DataTableSettings implements Serializable
public $iDefaultPageSize;
public $aColumns;
/**
* DataTableSettings constructor.
*
* @param $aClassAliases
* @param null $sTableId
*/
public function __construct($aClassAliases, $sTableId = null)
{
$this->aClassAliases = $aClassAliases;
@@ -646,14 +882,22 @@ class DataTableSettings implements Serializable
$this->iDefaultPageSize = 10;
$this->aColumns = array();
}
/**
* @param $iDefaultPageSize
* @param $aSortOrder
* @param $aColumns
*/
protected function Init($iDefaultPageSize, $aSortOrder, $aColumns)
{
$this->iDefaultPageSize = $iDefaultPageSize;
$this->aColumns = $aColumns;
$this->FixVisibleColumns();
}
/**
* @return string
*/
public function serialize()
{
// Save only the 'visible' columns
@@ -679,7 +923,12 @@ class DataTableSettings implements Serializable
)
);
}
/**
* @param string $sData
*
* @throws \Exception
*/
public function unserialize($sData)
{
$aData = unserialize($sData);
@@ -712,7 +961,16 @@ class DataTableSettings implements Serializable
}
$this->FixVisibleColumns();
}
/**
* @param $aClassAliases
* @param $bViewLink
* @param $aDefaultLists
*
* @return \DataTableSettings
* @throws \CoreException
* @throws \DictExceptionMissingString
*/
static public function GetDataModelSettings($aClassAliases, $bViewLink, $aDefaultLists)
{
$oSettings = new DataTableSettings($aClassAliases);
@@ -762,7 +1020,10 @@ class DataTableSettings implements Serializable
$oSettings->Init($iDefaultPageSize, $aSortOrder, $aColumns);
return $oSettings;
}
/**
* @throws \CoreException
*/
protected function FixVisibleColumns()
{
foreach($this->aClassAliases as $sAlias => $sClass)
@@ -799,7 +1060,15 @@ class DataTableSettings implements Serializable
}
}
}
/**
* @param $aClassAliases
* @param null $sTableId
* @param bool $bOnlyOnTable
*
* @return \DataTableSettings|null
* @throws \Exception
*/
static public function GetTableSettings($aClassAliases, $sTableId = null, $bOnlyOnTable = false)
{
$pref = null;
@@ -828,7 +1097,10 @@ class DataTableSettings implements Serializable
return $oSettings;
}
/**
* @return array
*/
public function GetSortOrder()
{
$aSortOrder = array();
@@ -846,7 +1118,12 @@ class DataTableSettings implements Serializable
}
return $aSortOrder;
}
/**
* @param null $sTargetTableId
*
* @return bool
*/
public function Save($sTargetTableId = null)
{
$sSaveId = is_null($sTargetTableId) ? $this->sTableId : $sTargetTableId;
@@ -857,6 +1134,9 @@ class DataTableSettings implements Serializable
return true;
}
/**
* @return bool
*/
public function SaveAsDefault()
{
$sSettings = $this->serialize();
@@ -886,18 +1166,43 @@ class DataTableSettings implements Serializable
}
return true;
}
/**
* @param null $sTableId
*
* @return string
*/
protected function GetPrefsKey($sTableId = null)
{
if ($sTableId == null) $sTableId = '*';
return static::GetAppUserPreferenceKey($this->aClassAliases, $sTableId);
}
public static function GetAppUserPreferenceKey($aClassAliases, $sTableId)
{
if ($sTableId === null)
{
$sTableId = '*';
}
$aKeys = array();
foreach($this->aClassAliases as $sAlias => $sClass)
foreach($aClassAliases as $sAlias => $sClass)
{
$aKeys[] = $sAlias.'-'.$sClass;
}
return implode('/', $aKeys).'|'.$sTableId;
}
/**
* @param $sAlias
* @param $sAttCode
* @param $oAttDef
* @param $bChecked
* @param $sSort
*
* @return array|bool
* @throws \CoreException
* @throws \DictExceptionMissingString
*/
protected function GetFieldData($sAlias, $sAttCode, $oAttDef, $bChecked, $sSort)
{
$ret = false;

View File

@@ -1,26 +1,20 @@
<?php
// Copyright (C) 2010-2017 Combodo SARL
//
// This file is part of iTop.
//
// iTop is free software; you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// iTop 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 Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with iTop. If not, see <http://www.gnu.org/licenses/>
/**
* DisplayBlock and derived class
* Copyright (C) 2013-2019 Combodo SARL
*
* @copyright Copyright (C) 2010-2017 Combodo SARL
* @license http://opensource.org/licenses/AGPL-3.0
* This file is part of iTop.
*
* iTop is free software; you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* iTop 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 Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
*/
require_once(APPROOT.'/application/webpage.class.inc.php');
@@ -91,7 +85,7 @@ class DisplayBlock
{
$oDummyFilter = new DBObjectSearch($oSet->GetClass());
$aKeys = array();
$oSet->OptimizeColumnLoad(array('id')); // No need to load all the columns just to get the id
$oSet->OptimizeColumnLoad(array($oSet->GetClassAlias() => array())); // No need to load all the columns just to get the id
while($oObject = $oSet->Fetch())
{
$aKeys[] = $oObject->GetKey();
@@ -249,7 +243,7 @@ class DisplayBlock
$sHtml .= $this->GetRenderContent($oPage, $aExtraParams, $sId);
} catch (Exception $e)
{
IssueLog::Error('Exception during GetDisplay: ' . $e->getMessage());
}
$sHtml .= "</div>\n";
}
@@ -330,8 +324,10 @@ class DisplayBlock
* @throws DictExceptionMissingString
* @throws MySQLException
* @throws Exception
*
* @since 2.7.7 3.0.1 3.1.0 N°3129 add type hinting to $aExtraParams
*/
public function GetRenderContent(WebPage $oPage, $aExtraParams, $sId)
public function GetRenderContent(WebPage $oPage, array $aExtraParams, $sId)
{
$sHtml = '';
// Add the extra params into the filter if they make sense for such a filter
@@ -452,8 +448,21 @@ class DisplayBlock
$this->m_oSet = new CMDBObjectSet($this->m_oFilter, $aOrderBy, $aQueryParams);
}
$this->m_oSet->SetShowObsoleteData($this->m_bShowObsoleteData);
switch($this->m_sStyle)
{
switch($this->m_sStyle) {
case 'list_search':
case 'list':
break;
default:
// N°3473: except for 'list_search' and 'list' (which have more granularity, see the other switch below),
// refuse to render if the user is not allowed to see the class.
if (! UserRights::IsActionAllowed($this->m_oSet->GetClass(), UR_ACTION_READ, $this->m_oSet) == UR_ALLOWED_YES) {
$sHtml .= $oPage->GetP(Dict::Format('UI:Error:ReadNotAllowedOn_Class', $this->m_oSet->GetClass()));
return $sHtml;
}
}
switch ($this->m_sStyle) {
case 'count':
if (isset($aExtraParams['group_by']))
{
@@ -843,7 +852,8 @@ class DisplayBlock
foreach($aStates as $sStateValue)
{
$aStateLabels[$sStateValue] = htmlentities($oAttDef->GetValueLabel($sStateValue), ENT_QUOTES, 'UTF-8');
$sHtmlValue=$aGroupBy['group1']->MakeValueLabel($this->m_oFilter, $sStateValue, $sStateValue);
$aStateLabels[$sStateValue] = strip_tags($sHtmlValue);
$aCounts[$sStateValue] = (array_key_exists($sStateValue, $aCountsQueryResults))
? $aCountsQueryResults[$sStateValue]
@@ -952,7 +962,7 @@ class DisplayBlock
$iChartCounter++;
$sChartType = isset($aExtraParams['chart_type']) ? $aExtraParams['chart_type'] : 'pie';
$sTitle = isset($aExtraParams['chart_title']) ? '<h1 style="text-align:center">'.htmlentities(Dict::S($aExtraParams['chart_title']), ENT_QUOTES, 'UTF-8').'</h1>' : '';
$sTitle = isset($aExtraParams['chart_title']) ? '<div class="main_header"><h1>&#160;'.htmlentities(Dict::S($aExtraParams['chart_title']), ENT_QUOTES, 'UTF-8').'</h1></div>' : '';
$sHtml = "$sTitle<div style=\"height:200px;width:100%\" class=\"dashboard_chart\" id=\"my_chart_$sId{$iChartCounter}\"><div style=\"height:200px;line-height:200px;vertical-align:center;text-align:center;width:100%\"><img src=\"../images/indicator.gif\"></div></div>\n";
$sGroupBy = isset($aExtraParams['group_by']) ? $aExtraParams['group_by'] : '';
$sGroupByExpr = isset($aExtraParams['group_by_expr']) ? '&params[group_by_expr]='.$aExtraParams['group_by_expr'] : '';
@@ -999,6 +1009,7 @@ EOF
$iTotalCount = 0;
$aValues = array();
$aURLs = array();
foreach ($aRes as $iRow => $aRow)
{
$sValue = $aRow['grouped_by_1'];
@@ -1006,7 +1017,8 @@ EOF
$aGroupBy[(int)$iRow] = (int) $aRow[$sFctVar];
$iTotalCount += $aRow['_itop_count_'];
$aValues[] = array('label' => html_entity_decode(strip_tags($sHtmlValue), ENT_QUOTES, 'UTF-8'), 'label_html' => $sHtmlValue, 'value' => (int) $aRow[$sFctVar]);
// Build the search for this subset
$oSubsetSearch = $this->m_oFilter->DeepClone();
$oCondition = new BinaryExpression($oGroupByExp, '=', new ScalarExpression($sValue));
@@ -1020,16 +1032,23 @@ EOF
{
case 'bars':
$aNames = array();
$iMaxNbCharsInLabel = 0;
foreach($aValues as $idx => $aValue)
{
$aNames[$idx] = $aValue['label'];
if ($iMaxNbCharsInLabel < mb_strlen($aValue['label'])) {
$iMaxNbCharsInLabel = mb_strlen($aValue['label']);
}
}
$sJSNames = json_encode($aNames);
$sJson = json_encode($aValues);
$oPage->add_ready_script(
<<<EOF
var iChartDefaultHeight = 200,
iChartLegendHeight = 6 * $iMaxNbCharsInLabel,
iChartTotalHeight = iChartDefaultHeight + iChartLegendHeight;
$('#my_chart_$sId').height(iChartTotalHeight+ 'px');
var chart = c3.generate({
bindto: d3.select('#my_chart_$sId'),
data: {
@@ -1097,8 +1116,19 @@ EOF
}
$sJSColumns = json_encode($aColumns);
$sJSNames = json_encode($aNames);
$iNbLinesToAddForName = 0;
if (count($aNames) > 50) {
// Calculation of the number of legends line add to the height of the graph to have a maximum of 5 legend columns
$iNbLinesIncludedInChartHeight = 10;
$iNbLinesToAddForName = ceil(count($aNames) / 5) - $iNbLinesIncludedInChartHeight;
}
$oPage->add_ready_script(
<<<EOF
// Calculate height of graph : 200px (minimum height for the chart) + 20*iNbLinesToAddForName for the legend
var iChartDefaultHeight = 200,
iChartLegendHeight = 20 * $iNbLinesToAddForName,
iChartTotalHeight = (iChartDefaultHeight + iChartLegendHeight);
$('#my_chart_$sId').height(iChartTotalHeight + 'px');
var chart = c3.generate({
bindto: d3.select('#my_chart_$sId'),
data: {
@@ -1410,8 +1440,25 @@ class HistoryBlock extends DisplayBlock
$this->iLimitStart = $iStart;
$this->iLimitCount = $iCount;
}
public function GetRenderContent(WebPage $oPage, $aExtraParams = array(), $sId)
/**
* @param \WebPage $oPage
* @param array $aExtraParams
* @param string $sId
*
* @return string
* @throws \ArchivedObjectException
* @throws \CoreException
* @throws \CoreUnexpectedValue
* @throws \DictExceptionMissingString
* @throws \MissingQueryArgument
* @throws \MySQLException
* @throws \MySQLHasGoneAwayException
*
* @since 2.7.7 3.0.1 3.1.0 N°3129 Remove default value for $aExtraParams and add type hinting for PHP 8.0 compatibility
* (var is unused, and all calls were already made using a default value)
*/
public function GetRenderContent(WebPage $oPage, array $aExtraParams, $sId)
{
$sHtml = '';
$bTruncated = false;
@@ -1550,8 +1597,10 @@ class MenuBlock extends DisplayBlock
* @throws \Exception
* @throws \MissingQueryArgument
* @throws \MySQLException
*
* @since 2.7.7 3.0.1 3.1.0 N°3129 Remove default value and add type hinting on $aExtraParams for PHP 8.0 compatibility
*/
public function GetRenderContent(WebPage $oPage, $aExtraParams = array(), $sId)
public function GetRenderContent(WebPage $oPage, array $aExtraParams, $sId)
{
if ($this->m_sStyle == 'popup') // popup is a synonym of 'list' for backward compatibility
{
@@ -1886,11 +1935,13 @@ class MenuBlock extends DisplayBlock
{
if (count($aFavoriteActions) > 0)
{
$sHtml .= "<div class=\"itop_popup actions_menu\"><ul>\n<li>".Dict::S('UI:Menu:OtherActions')."\n<ul>\n";
$sActionsMenuLabel = Dict::S('UI:Menu:OtherActions');
$sHtml .= "<div class=\"itop_popup actions_menu\"><ul>\n<li aria-label=\"{$sActionsMenuLabel}\">{$sActionsMenuLabel}<i class=\"fas fa-caret-down\"></i>"."\n<ul>\n";
}
else
{
$sHtml .= "<div class=\"itop_popup actions_menu\"><ul>\n<li>".Dict::S('UI:Menu:Actions')."\n<ul>\n";
$sActionsMenuLabel = Dict::S('UI:Menu:Actions');
$sHtml .= "<div class=\"itop_popup actions_menu\"><ul>\n<li aria-label=\"{$sActionsMenuLabel}\">{$sActionsMenuLabel}<i class=\"fas fa-caret-down\"></i>"."\n<ul>\n";
}
$sHtml .= $oPage->RenderPopupMenuItems($aActions, $aFavoriteActions);
@@ -1898,7 +1949,8 @@ class MenuBlock extends DisplayBlock
if ($this->m_sStyle == 'details')
{
$sSearchAction = "window.location=\"{$sRootUrl}pages/UI.php?operation=search_form&do_search=0&class=$sClass{$sContext}\"";
$sHtml .= "<div class=\"actions_button icon_actions_button\" title=\"".htmlentities(Dict::Format('UI:SearchFor_Class', MetaModel::GetName($sClass)), ENT_QUOTES, 'UTF-8')."\"><span class=\"search-button fa fa-search\" onclick='$sSearchAction'></span></div>";
$sHtml .= "<div class=\"actions_button icon_actions_button\" title=\"".htmlentities(Dict::Format('UI:SearchFor_Class',
MetaModel::GetName($sClass)), ENT_QUOTES, 'UTF-8')."\"><span class=\"search-button fas fa-search\" onclick='$sSearchAction'></span></div>";
}
@@ -1909,7 +1961,8 @@ class MenuBlock extends DisplayBlock
}
if (!$oPage->IsPrintableVersion() && ($sRefreshAction!=''))
{
$sHtml .= "<div class=\"actions_button icon_actions_button\" title=\"".htmlentities(Dict::S('UI:Button:Refresh'), ENT_QUOTES, 'UTF-8')."\"><span class=\"refresh-button fa fa-refresh\" onclick=\"$sRefreshAction\"></span></div>";
$sHtml .= "<div class=\"actions_button icon_actions_button\" title=\"".htmlentities(Dict::S('UI:Button:Refresh'),
ENT_QUOTES, 'UTF-8')."\"><span class=\"refresh-button fas fa-sync\" onclick=\"$sRefreshAction\"></span></div>";
}

View File

@@ -0,0 +1,82 @@
<?php
/**
* @copyright Copyright (C) 2010-2020 Combodo SARL
* @license http://opensource.org/licenses/AGPL-3.0
*/
class ErrorPage extends NiceWebPage
{
public function __construct($sTitle)
{
parent::__construct($sTitle);
$this->add_linked_script("../js/jquery.blockUI.js");
$this->add_linked_script("../setup/setup.js");
$this->add_saas("css/setup.scss");
}
public function info($sText)
{
$this->add("<p class=\"info\">$sText</p>\n");
$this->log_info($sText);
}
public function ok($sText)
{
$this->add("<div class=\"message message-valid\"><span class=\"message-title\">Success:</span>$sText</div>");
$this->log_ok($sText);
}
public function warning($sText)
{
$this->add("<div class=\"message message-warning\"><span class=\"message-title\">Warning:</span>$sText</div>");
$this->log_warning($sText);
}
public function error($sText)
{
$this->add("<div class=\"message message-error\">$sText</div>");
$this->log_error($sText);
}
public function output()
{
$sLogo = utils::GetAbsoluteUrlAppRoot().'/images/itop-logo.png';
$sTimeStamp = utils::GetCacheBusterTimestamp();
$sTitle = utils::HtmlEntities($this->s_title);
$this->s_content = <<<HTML
<div id="header" class="error_page">
<h1><a href="http://www.combodo.com/itop" target="_blank"><img title="iTop by Combodo" alt=" " src="{$sLogo}?t={$sTimeStamp}"></a>&nbsp;{$sTitle}</h1>
</div>
<div id="setup" class="error_page">
{$this->s_content}
</div>
HTML;
return parent::output();
}
public static function log_error($sText)
{
IssueLog::Error($sText);
}
public static function log_warning($sText)
{
IssueLog::Warning($sText);
}
public static function log_info($sText)
{
IssueLog::Info($sText);
}
public static function log_ok($sText)
{
IssueLog::Ok($sText);
}
public static function log($sText)
{
IssueLog::Ok($sText);
}
}

View File

@@ -395,6 +395,7 @@ EOF
{
foreach($aFields as $oField)
{
/** @var \DesignerFormField $oField */
$oField->ReadParam($aValues);
}
}
@@ -679,18 +680,34 @@ class DesignerTabularForm extends DesignerForm
class DesignerFormField
{
/** @var string $sLabel */
protected $sLabel;
/** @var string $sCode */
protected $sCode;
/** @var mixed $defaultValue */
protected $defaultValue;
/** @var \DesignerForm $oForm */
protected $oForm;
/** @var bool $bMandatory */
protected $bMandatory;
/** @var bool $bReadOnly */
protected $bReadOnly;
/** @var bool $bAutoApply */
protected $bAutoApply;
/** @var array $aCSSClasses */
protected $aCSSClasses;
/** @var bool $bDisplayed */
protected $bDisplayed;
/** @var array $aWidgetExtraParams */
protected $aWidgetExtraParams;
/**
* DesignerFormField constructor.
*
* @param string $sCode
* @param string $sLabel
* @param mixed $defaultValue
*/
public function __construct($sCode, $sLabel, $defaultValue)
{
$this->sLabel = $sLabel;
@@ -703,7 +720,10 @@ class DesignerFormField
$this->bDisplayed = true;
$this->aWidgetExtraParams = array();
}
/**
* @return string
*/
public function GetCode()
{
return $this->sCode;
@@ -712,69 +732,108 @@ class DesignerFormField
/**
* @param \DesignerForm $oForm
*/
public function SetForm(\DesignerForm $oForm)
public function SetForm(DesignerForm $oForm)
{
$this->oForm = $oForm;
}
/**
* @param bool $bMandatory
*/
public function SetMandatory($bMandatory = true)
{
$this->bMandatory = $bMandatory;
}
/**
* @param bool $bReadOnly
*/
public function SetReadOnly($bReadOnly = true)
{
$this->bReadOnly = $bReadOnly;
}
/**
* @return bool
*/
public function IsReadOnly()
{
return ($this->oForm->IsReadOnly() || $this->bReadOnly);
}
/**
* @param bool $bAutoApply
*/
public function SetAutoApply($bAutoApply)
{
$this->bAutoApply = $bAutoApply;
}
/**
* @return bool
*/
public function IsAutoApply()
{
return $this->bAutoApply;
}
/**
* @param bool $bDisplayed
*/
public function SetDisplayed($bDisplayed)
{
$this->bDisplayed = $bDisplayed;
}
/**
* @return bool
*/
public function IsDisplayed()
{
return $this->bDisplayed;
}
/**
* @return string
*/
public function GetFieldId()
{
return $this->oForm->GetFieldId($this->sCode);
}
/**
* @return string
*/
public function GetWidgetClass()
{
return 'property_field';
}
/**
* @return array
*/
public function GetWidgetExtraParams()
{
return $this->aWidgetExtraParams;
}
/**
* @param \WebPage $oP
* @param string $sFormId
* @param string $sRenderMode
*
* @return array
*/
public function Render(WebPage $oP, $sFormId, $sRenderMode='dialog')
{
$sId = $this->oForm->GetFieldId($this->sCode);
$sName = $this->oForm->GetFieldName($this->sCode);
return array('label' => $this->sLabel, 'value' => "<input type=\"text\" id=\"$sId\" name=\"$sName\" value=\"".htmlentities($this->defaultValue, ENT_QUOTES, 'UTF-8')."\">");
}
/**
* @param array $aValues
*/
public function ReadParam(&$aValues)
{
if ($this->IsReadOnly())
@@ -801,12 +860,18 @@ class DesignerFormField
}
}
}
/**
* @return bool
*/
public function IsVisible()
{
return true;
}
/**
* @param string $sCSSClass
*/
public function AddCSSClass($sCSSClass)
{
$this->aCSSClasses[] = $sCSSClass;
@@ -814,6 +879,8 @@ class DesignerFormField
/**
* A way to set/change the default value after constructing the field
*
* @param array $aAllDefaultValue
*/
public function SetDefaultValueFrom($aAllDefaultValue)
{
@@ -822,7 +889,12 @@ class DesignerFormField
$this->defaultValue = $aAllDefaultValue[$this->GetCode()];
}
}
/**
* @param $sFieldCode
*
* @return \DesignerFormField|false
*/
public function FindField($sFieldCode)
{
if ($this->sCode == $sFieldCode)
@@ -832,11 +904,17 @@ class DesignerFormField
return false;
}
/**
* @return string
*/
public function GetHandlerEquals()
{
return 'null';
}
/**
* @return string
*/
public function GetHandlerGetValue()
{
return 'null';
@@ -845,25 +923,43 @@ class DesignerFormField
class DesignerLabelField extends DesignerFormField
{
/** @var int $iCount A counter to automatically make the field code */
protected static $iCount = 0;
/** @var string $sDescription */
protected $sDescription;
/**
* @inheritdoc
*/
public function __construct($sLabel, $sDescription)
{
parent::__construct('', $sLabel, '');
// Increase counter
static::$iCount++;
parent::__construct('label_number_' . static::$iCount, $sLabel, '');
$this->sDescription = $sDescription;
}
/**
* @inheritdoc
*/
public function Render(WebPage $oP, $sFormId, $sRenderMode='dialog')
{
$sId = $this->oForm->GetFieldId($this->sCode);
$sName = $this->oForm->GetFieldName($this->sCode);
return array('label' => $this->sLabel, 'value' => $this->sDescription);
}
/**
* @inheritdoc
*/
public function ReadParam(&$aValues)
{
}
/**
* @inheritdoc
*/
public function IsVisible()
{
return true;
@@ -1127,7 +1223,7 @@ class DesignerComboField extends DesignerFormField
$sChecked = $this->defaultValue ? 'checked' : '';
$sMandatory = $this->bMandatory ? 'true' : 'false';
$sReadOnly = $this->IsReadOnly() ? 'disabled="disabled"' : '';
if ($this->IsSorted())
if ($this->IsSorted() )
{
asort($this->aAllowedValues);
}
@@ -1175,18 +1271,14 @@ class DesignerComboField extends DesignerFormField
$sHtml .= "<option value=\"\">".$this->sNullLabel."</option>";
}
}
foreach($this->aAllowedValues as $sKey => $sDisplayValue)
{
if ($this->bMultipleSelection)
{
foreach ($this->aAllowedValues as $sKey => $sDisplayValue) {
if ($this->bMultipleSelection) {
$sSelected = in_array($sKey, $this->defaultValue) ? 'selected' : '';
}
else
{
} else {
$sSelected = ($sKey == $this->defaultValue) ? 'selected' : '';
}
// Quick and dirty: display the menu parents as a tree
$sHtmlValue = str_replace(' ', '&nbsp;', htmlentities($sDisplayValue, ENT_QUOTES, 'UTF-8'));
$sHtmlValue = str_replace(' ', '&nbsp;', $sDisplayValue);
$sHtml .= "<option value=\"".htmlentities($sKey, ENT_QUOTES, 'UTF-8')."\" $sSelected>$sHtmlValue</option>";
}
$sHtml .= "</select>";
@@ -1334,7 +1426,8 @@ class DesignerIconSelectionField extends DesignerFormField
$sPostUploadTo = ($this->sUploadUrl == null) ? 'null' : "'{$this->sUploadUrl}'";
if (!$this->IsReadOnly())
{
$sValue = "<input type=\"hidden\" id=\"$sId\" name=\"$sName\" value=\"{$this->defaultValue}\"/>";
$sDefaultValue = ($this->defaultValue !== '') ? $this->defaultValue : $this->aAllowedValues[$idx]['value'];
$sValue = "<input type=\"hidden\" id=\"$sId\" name=\"$sName\" value=\"{$sDefaultValue}\"/>";
$oP->add_ready_script(
<<<EOF
$('#$sId').icon_select({current_idx: $idx, items: $sJSItems, post_upload_to: $sPostUploadTo});
@@ -1396,6 +1489,7 @@ class RunTimeIconSelectionField extends DesignerIconSelectionField
$sAvailableIcons .= ' static $sKey = '.var_export($sKey, true).';'.PHP_EOL;
$sAvailableIcons .= ' static $aIconFiles = '.var_export($aFiles, true).';'.PHP_EOL;
$sAvailableIcons .= '}'.PHP_EOL;
SetupUtils::builddir(dirname($sCacheFile));
file_put_contents($sCacheFile, $sAvailableIcons, LOCK_EX);
}
return $aFiles;

View File

@@ -1,27 +1,20 @@
<?php
// Copyright (C) 2010-2018 Combodo SARL
//
// This file is part of iTop.
//
// iTop is free software; you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// iTop 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 Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with iTop. If not, see <http://www.gnu.org/licenses/>
/**
* Class iTopWebPage
* Copyright (C) 2013-2020 Combodo SARL
*
* @copyright Copyright (C) 2010-2018 Combodo SARL
* @license http://opensource.org/licenses/AGPL-3.0
* This file is part of iTop.
*
* iTop is free software; you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* iTop 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 Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
*/
require_once(APPROOT."/application/nicewebpage.class.inc.php");
@@ -46,13 +39,19 @@ class iTopWebPage extends NiceWebPage implements iTabbedPage
protected $sBreadCrumbEntryIcon;
protected $oCtx;
protected $bHasCollapsibleSection = false;
/**
* iTopWebPage constructor.
*
* @param string $sTitle
* @param bool $bPrintable
*
* @throws \Exception
*/
public function __construct($sTitle, $bPrintable = false)
{
parent::__construct($sTitle, $bPrintable);
$this->m_oTabs = new TabManager();
$this->oCtx = new ContextTag('GUI:Console');
$this->oCtx = new ContextTag(ContextTag::TAG_CONSOLE);
ApplicationContext::SetUrlMakerClass('iTopStandardURLMaker');
@@ -61,8 +60,7 @@ class iTopWebPage extends NiceWebPage implements iTabbedPage
// Create a breadcrumb entry for the current page, but get its title as late as possible (page title could be changed later)
$this->bBreadCrumbEnabled = true;
}
else
{
else {
$this->bBreadCrumbEnabled = false;
}
@@ -71,18 +69,18 @@ class iTopWebPage extends NiceWebPage implements iTabbedPage
$this->m_sMenu = "";
$this->m_aMessages = array();
$this->SetRootUrl(utils::GetAbsoluteUrlAppRoot());
$this->add_header("Content-type: text/html; charset=utf-8");
$this->add_header('Cache-control: no-cache, no-store, must-revalidate');
$this->add_header('Pragma: no-cache');
$this->add_header('Expires: 0');
$this->add_header('X-Frame-Options: deny');
$this->add_header("Content-type: text/html; charset=".self::PAGES_CHARSET);
$this->no_cache();
$this->add_http_headers();
$this->add_linked_stylesheet("../css/jquery.treeview.css");
$this->add_linked_stylesheet("../css/jquery.autocomplete.css");
$this->add_linked_stylesheet("../css/jquery-ui-timepicker-addon.css");
$this->add_linked_stylesheet("../css/jquery.multiselect.css");
$this->add_linked_stylesheet("../css/magnific-popup.css");
$this->add_linked_stylesheet("../css/c3.min.css");
$this->add_linked_stylesheet("../css/font-awesome/css/font-awesome.min.css");
$this->add_linked_stylesheet("../css/font-awesome/css/all.min.css");
$this->add_linked_stylesheet("../css/font-awesome/css/v4-shims.min.css");
$this->add_linked_stylesheet("../js/ckeditor/plugins/codesnippet/lib/highlight/styles/obsidian.css");
$this->add_linked_script('../js/jquery.layout.min.js');
$this->add_linked_script('../js/jquery.ba-bbq.min.js');
@@ -96,6 +94,7 @@ class iTopWebPage extends NiceWebPage implements iTabbedPage
$this->add_linked_script("../js/swfobject.js");
$this->add_linked_script("../js/ckeditor/ckeditor.js");
$this->add_linked_script("../js/ckeditor/adapters/jquery.js");
$this->add_linked_script("../js/ckeditor/plugins/codesnippet/lib/highlight/highlight.pack.js");
$this->add_linked_script("../js/jquery.qtip-1.0.min.js");
$this->add_linked_script('../js/property_field.js');
$this->add_linked_script('../js/icon_select.js');
@@ -154,6 +153,9 @@ EOF
}
}
/**
* @return bool
*/
protected function IsMenuPaneVisible()
{
$bLeftPaneOpen = true;
@@ -176,6 +178,9 @@ EOF
return $bLeftPaneOpen;
}
/**
*
*/
protected function PrepareLayout()
{
if (MetaModel::GetConfig()->Get('demo_mode'))
@@ -224,7 +229,6 @@ EOF;
);
$sTimeFormat = AttributeDateTime::GetFormat()->ToTimeFormat();
$oTimeFormat = new DateTimeFormat($sTimeFormat);
$sJSLangShort = json_encode(strtolower(substr(Dict::GetUserLanguage(), 0, 2)));
// Date picker options
$aPickerOptions = array(
@@ -242,29 +246,38 @@ EOF;
$sJSDatePickerOptions = json_encode($aPickerOptions);
// Time picker additional options
$sUserLang = Dict::GetUserLanguage();
$sUserLangShort = strtolower(
substr($sUserLang, 0, 2)
);
// PR #40 : we are picking correct values for specific cases in dict files
// some languages are using codes like zh-CN or pt-BR
$sTimePickerLang = json_encode(
Dict::S('INTERNAL:JQuery-DatePicker:LangCode', $sUserLangShort)
);
$aPickerOptions['showOn'] = '';
$aPickerOptions['buttonImage'] = null;
$aPickerOptions['timeFormat'] = $oTimeFormat->ToDatePicker();
$aPickerOptions['controlType'] = 'select';
$aPickerOptions['closeText'] = Dict::S('UI:Button:Ok');
$sJSDateTimePickerOptions = json_encode($aPickerOptions);
if ($sJSLangShort != '"en"')
if ($sTimePickerLang != '"en"')
{
// More options that cannot be passed via json_encode since they must be evaluated client-side
$aMoreJSOptions = ",
'timeText': $.timepicker.regional[$sJSLangShort].timeText,
'hourText': $.timepicker.regional[$sJSLangShort].hourText,
'minuteText': $.timepicker.regional[$sJSLangShort].minuteText,
'secondText': $.timepicker.regional[$sJSLangShort].secondText,
'currentText': $.timepicker.regional[$sJSLangShort].currentText
'timeText': $.timepicker.regional[$sTimePickerLang].timeText,
'hourText': $.timepicker.regional[$sTimePickerLang].hourText,
'minuteText': $.timepicker.regional[$sTimePickerLang].minuteText,
'secondText': $.timepicker.regional[$sTimePickerLang].secondText,
'currentText': $.timepicker.regional[$sTimePickerLang].currentText
}";
$sJSDateTimePickerOptions = substr($sJSDateTimePickerOptions, 0, -1).$aMoreJSOptions;
}
$this->add_script(
<<< EOF
<<< JS
function GetUserLanguage()
{
return $sJSLangShort;
return $sTimePickerLang;
}
function PrepareWidgets()
{
@@ -296,12 +309,12 @@ EOF;
});
});
}
EOF
JS
);
// Attribute set tooltip on items
$this->add_ready_script(
<<<EOF
<<<JS
$('.attribute-set-item').each(function(){
// Encoding only title as the content is already sanitized by the HTML attribute.
var sLabel = $('<div/>').text($(this).attr('data-label')).html();
@@ -328,25 +341,39 @@ EOF
position: { corner: { target: 'topMiddle', tooltip: 'bottomLeft' }}
});
});
EOF
JS
);
// Make image attributes zoomable
$this->add_ready_script(
<<<EOF
<<<JS
$('.view-image img').each(function(){
$(this).attr('href', $(this).attr('src'))
})
.magnificPopup({type: 'image', closeOnContentClick: true });
EOF
JS
);
// Highlight code content created with CKEditor
// Note: We check for the <code> tag inside the <pre> tag to only target code from CKEditor, otherwise we might highlight some others things. See N°3810
$this->add_ready_script(
<<<JS
// Highlight code content for HTML AttributeText
$("[data-attribute-type='AttributeText'] .HTML pre > code").parent().each(function(i, block) {
hljs.highlightBlock(block);
});
// Highlight code content for CaseLogs
$("[data-attribute-type='AttributeCaseLog'] .caselog_entry_html pre > code").parent().each(function(i, block) {
hljs.highlightBlock(block);
});
JS
);
$this->add_init_script(
<<< EOF
<<< JS
try
{
var myLayout; // a var is required because this page utilizes: myLayout.allowOverflow() method
// Layout
paneSize = GetUserPreference('menu_size', 300);
if ($('body').length > 0)
@@ -452,11 +479,11 @@ EOF
// Do something with the error !
alert(err);
}
EOF
JS
);
$this->add_ready_script(
<<< EOF
<<< JS
// Adjust initial size
$('.v-resizable').each( function()
@@ -597,7 +624,7 @@ EOF
ShowDebug();
$('#logOffBtn>ul').popupmenu();
$('.caselog_header').click( function () { $(this).toggleClass('open').next('.caselog_entry,.caselog_entry_html').toggle(); });
$('body').on('click', '.caselog_header', function () { $(this).toggleClass('open').next('.caselog_entry,.caselog_entry_html').toggle(); });
$(document).ajaxSend(function(event, jqxhr, options) {
jqxhr.setRequestHeader('X-Combodo-Ajax', 'true');
@@ -617,7 +644,7 @@ EOF
});
}
});
EOF
JS
);
$this->add_ready_script(InlineImage::FixImagesWidth());
/*
@@ -628,7 +655,7 @@ EOF
$sUserPrefs = appUserPreferences::GetAsJSON();
$this->add_script(
<<<EOF
<<<JS
// // for JQuery history
// function history_callback(hash)
// {
@@ -698,7 +725,7 @@ EOF
{
$('.ui-layout-center, .ui-layout-north, .ui-layout-south').css({display: 'block'});
}
EOF
JS
);
}
@@ -733,11 +760,22 @@ EOF
$this->sBreadCrumbEntryIcon = null;
}
/**
* @param string $sHtml
*/
public function AddToMenu($sHtml)
{
$this->m_sMenu .= $sHtml;
}
/**
* @return string
* @throws \CoreException
* @throws \MissingQueryArgument
* @throws \MySQLException
* @throws \MySQLHasGoneAwayException
* @throws \OQLException
*/
public function GetSiloSelectionForm()
{
// List of visible Organizations
@@ -764,15 +802,9 @@ EOF
switch ($iCount)
{
case 0:
// No such dimension/silo => nothing to select
$sHtml = '<div id="SiloSelection"><!-- nothing to select --></div>';
break;
case 1:
// Only one possible choice... no selection, but display the value
$oOrg = $oSet->Fetch();
$sHtml = '<div id="SiloSelection">'.$oOrg->GetName().'</div>';
$sHtml .= '';
// No such dimension/silo or only one possible choice => nothing to select
$sHtml = '<div id="SiloSelection"><!-- nothing to select --></div>';
break;
default:
@@ -804,6 +836,9 @@ EOF
return $sHtml;
}
/**
* @throws \DictExceptionMissingString
*/
public function DisplayMenu()
{
// Display the menu
@@ -819,6 +854,8 @@ EOF
protected function InitNewsroom()
{
$sNewsroomInitialImage = '';
$aProviderParams = array();
if (MetaModel::GetConfig()->Get('newsroom_enabled') !== false)
{
$oUser = UserRights::GetUserObject();
@@ -826,31 +863,32 @@ EOF
* @var iNewsroomProvider[] $aProviders
*/
$aProviders = MetaModel::EnumPlugins('iNewsroomProvider');
$aProviderParams = array();
foreach($aProviders as $oProvider)
{
$oProvider->SetConfig(MetaModel::GetConfig());
$bProviderEnabled = appUserPreferences::GetPref('newsroom_provider_'.get_class($oProvider), true);
if ($bProviderEnabled && $oProvider->IsApplicable($oUser))
{
$aProviderParams[] = array(
'label' => $oProvider->GetLabel(),
'fetch_url' => $oProvider->GetFetchURL(),
'view_all_url' => $oProvider->GetViewAllURL(),
'mark_all_as_read_url' => $oProvider->GetMarkAllAsReadURL(),
'placeholders' => $oProvider->GetPlaceholders(),
'ttl' => $oProvider->GetTTL(),
);
$bProviderEnabled = appUserPreferences::GetPref('newsroom_provider_'.get_class($oProvider),true);
if ($bProviderEnabled && $oProvider->IsApplicable($oUser))
{
$aProviderParams[] = array(
'label' => $oProvider->GetLabel(),
'fetch_url' => $oProvider->GetFetchURL(),
'view_all_url' => $oProvider->GetViewAllURL(),
'mark_all_as_read_url' => $oProvider->GetMarkAllAsReadURL(),
'placeholders' => $oProvider->GetPlaceholders(),
'ttl' => $oProvider->GetTTL(),
);
}
}
}
// Show newsroom only if there are some providers
if (count($aProviderParams) > 0)
{
$sImageUrl= '../images/newsroom_menu.png';
$sPlaceholderImageUrl= '../images/newsroom-message.svg';
$sImageUrl= 'fas fa-comment-dots';
$sPlaceholderImageUrl= 'far fa-envelope';
$aParams = array(
'image_url' => $sImageUrl,
'placeholder_image_url' => $sPlaceholderImageUrl,
'cache_uuid' => 'itop-newsroom-'.md5(APPROOT),
'image_icon' => $sImageUrl,
'placeholder_image_icon' => $sPlaceholderImageUrl,
'cache_uuid' => 'itop-newsroom-'.UserRights::GetUserId().'-'.md5(APPROOT),
'providers' => $aProviderParams,
'display_limit' => (int)appUserPreferences::GetPref('newsroom_display_size', 7),
'labels' => array(
@@ -865,20 +903,16 @@ EOF
$('#top-left-newsroom-cell').newsroom_menu($sParams);
EOF
);
$sNewsroomInitialImage = '<img style="opacity:0.4" src="../images/newsroom_menu.png">';
$sNewsroomInitialImage = '<i style="opacity:0.4" class="top-right-icon fas fa-comment-dots"></i>';
}
else
{
// No newsroom menu at all
}
}
// else no newsroom menu
return $sNewsroomInitialImage;
// else no newsroom menu
return $sNewsroomInitialImage;
}
/**
* Outputs (via some echo) the complete HTML page by assembling all its elements
* @inheritDoc
* @throws \Exception
*/
public function output()
{
@@ -957,8 +991,8 @@ EOF
$sNewEntry = json_encode(array(
'id' => $this->sBreadCrumbEntryId,
'url' => $this->sBreadCrumbEntryUrl,
'label' => htmlentities($this->sBreadCrumbEntryLabel, ENT_QUOTES, 'UTF-8'),
'description' => htmlentities($this->sBreadCrumbEntryDescription, ENT_QUOTES, 'UTF-8'),
'label' => htmlentities($this->sBreadCrumbEntryLabel, ENT_QUOTES, self::PAGES_CHARSET),
'description' => htmlentities($this->sBreadCrumbEntryDescription, ENT_QUOTES, self::PAGES_CHARSET),
'icon' => $this->sBreadCrumbEntryIcon,
));
}
@@ -991,8 +1025,9 @@ EOF
$sHtml .= "<head>\n";
// Make sure that Internet Explorer renders the page using its latest/highest/greatest standards !
$sHtml .= "<meta http-equiv=\"X-UA-Compatible\" content=\"IE=edge\" />\n";
$sHtml .= "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" />\n";
$sHtml .= "<title>".htmlentities($this->s_title, ENT_QUOTES, 'UTF-8')."</title>\n";
$sPageCharset = self::PAGES_CHARSET;
$sHtml .= "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=$sPageCharset\" />\n";
$sHtml .= "<title>".htmlentities($this->s_title, ENT_QUOTES, $sPageCharset)."</title>\n";
$sHtml .= $this->get_base_tag();
// Stylesheets MUST be loaded before any scripts otherwise
// jQuery scripts may face some spurious problems (like failing on a 'reload')
@@ -1111,16 +1146,18 @@ EOF
{
$sBodyClass = 'printable-version';
}
$sHtml .= "<body class=\"$sBodyClass\">\n";
$sHtml .= "<body class=\"$sBodyClass\" data-gui-type=\"backoffice\">\n";
if ($this->IsPrintableVersion())
{
$sHtml .= "<div class=\"explain-printable not-printable\">";
$sHtml .= '<p>'.Dict::Format('UI:ExplainPrintable',
'<img src="../images/eye-open-555.png" style="vertical-align:middle">').'</p>';
$sHtml .= "<div id=\"hiddeable_chapters\"></div>";
$sHtml .= '<button onclick="window.print()">'.htmlentities(Dict::S('UI:Button:GoPrint'), ENT_QUOTES, 'UTF-8').'</button>';
$sHtml .= '<button onclick="window.print()">'.htmlentities(Dict::S('UI:Button:GoPrint'), ENT_QUOTES,
self::PAGES_CHARSET).'</button>';
$sHtml .= '&nbsp;';
$sHtml .= '<button onclick="window.close()">'.htmlentities(Dict::S('UI:Button:Cancel'), ENT_QUOTES, 'UTF-8').'</button>';
$sHtml .= '<button onclick="window.close()">'.htmlentities(Dict::S('UI:Button:Cancel'), ENT_QUOTES,
self::PAGES_CHARSET).'</button>';
$sHtml .= '&nbsp;';
$sDefaultResolution = '27.7cm';
@@ -1146,7 +1183,7 @@ EOF;
}
// Render the revision number
if (ITOP_REVISION == '$WCREV$')
if (ITOP_REVISION == 'svn')
{
// This is NOT a version built using the buil system, just display the main version
$sVersionString = Dict::Format('UI:iTopVersion:Short', ITOP_APPLICATION, ITOP_VERSION);
@@ -1158,7 +1195,7 @@ EOF;
}
// Render the text of the global search form
$sText = htmlentities(utils::ReadParam('text', '', false, 'raw_data'), ENT_QUOTES, 'UTF-8');
$sText = htmlentities(utils::ReadParam('text', '', false, 'raw_data'), ENT_QUOTES, self::PAGES_CHARSET);
$sOnClick = " onclick=\"if ($('#global-search-input').val() != '') { $('#global-search form').submit(); } \"";
$sDefaultPlaceHolder = Dict::S("UI:YourSearch");
@@ -1182,7 +1219,7 @@ EOF;
{
$sLogonMessage = Dict::Format('UI:LoggedAsMessage', $sUserName);
}
$sLogOffMenu = "<span id=\"logOffBtn\"><ul><li><img src=\"../images/on-off-menu.png\"><ul>";
$sLogOffMenu = "<span id=\"logOffBtn\"><ul><li aria-label=\"" . Dict::S("UI:PowerMenu") . "\"><i class=\"top-right-icon icon-additional-arrow fas fa-power-off\"></i><ul>";
$sLogOffMenu .= "<li><span>$sLogonMessage</span></li>\n";
$aActions = array();
@@ -1213,7 +1250,7 @@ EOF;
$oExitArchive = new JSPopupMenuItem('UI:ArchiveModeOff', Dict::S('UI:ArchiveModeOff'), 'return ArchiveMode(false);');
$aActions[$oExitArchive->GetUID()] = $oExitArchive->GetMenuItem();
$sIcon = '<span class="fa fa-lock fa-1x"></span>';
$sIcon = '<span class="fas fa-lock fa-1x"></span>';
$this->AddApplicationMessage(Dict::S('UI:ArchiveMode:Banner'), $sIcon, Dict::S('UI:ArchiveMode:Banner+'));
}
elseif (UserRights::CanBrowseArchive())
@@ -1259,8 +1296,8 @@ EOF;
$sIcon =
<<<EOF
<span class="fa-stack fa-sm">
<i class="fa fa-pencil fa-flip-horizontal fa-stack-1x"></i>
<i class="fa fa-ban fa-stack-2x text-danger"></i>
<i class="fas fa-pencil-alt fa-flip-horizontal fa-stack-1x"></i>
<i class="fas fa-ban fa-stack-2x text-danger"></i>
</span>
EOF;
@@ -1277,7 +1314,7 @@ EOF;
{
$sHtmlIcon = $aMessage['icon'] ? $aMessage['icon'] : '';
$sHtmlMessage = $aMessage['message'];
$sTitleAttr = $aMessage['tip'] ? 'title="'.htmlentities($aMessage['tip'], ENT_QUOTES, 'UTF-8').'"' : '';
$sTitleAttr = $aMessage['tip'] ? 'title="'.htmlentities($aMessage['tip'], ENT_QUOTES, self::PAGES_CHARSET).'"' : '';
$sApplicationMessages .= '<div class="app-message" '.$sTitleAttr.'><span class="app-message-icon">'.$sHtmlIcon.'</span><span class="app-message-body">'.$sHtmlMessage.'</div></span>';
}
@@ -1308,9 +1345,11 @@ EOF;
$sHtml .= '<!-- Beginning of the left pane -->';
$sHtml .= ' <div class="ui-layout-north">';
$sHtml .= ' <div id="header-logo">';
$sHtml .= ' <div id="top-left"></div><div id="logo"><a href="'.htmlentities($sIconUrl, ENT_QUOTES,
'UTF-8').'"><img src="'.$sDisplayIcon.'" title="'.htmlentities($sVersionString, ENT_QUOTES,
'UTF-8').'" style="border:0; margin-top:16px; margin-right:40px;"/></a></div>';
$sHtml .= ' <div id="top-left"></div><div id="logo"><a href="'
.htmlentities($sIconUrl, ENT_QUOTES, self::PAGES_CHARSET)
.'"><img src="'.$sDisplayIcon.'" title="'
.htmlentities($sVersionString, ENT_QUOTES, self::PAGES_CHARSET)
.'" style="border:0; margin-top:16px; margin-right:40px;"/></a></div>';
$sHtml .= ' </div>';
$sHtml .= ' <div class="header-menu">';
if (!MetaModel::GetConfig()->Get('demo_mode'))
@@ -1342,10 +1381,10 @@ EOF;
$sHtml .= ' <table id="top-bar-table">';
$sHtml .= ' <tr>';
$sHtml .= ' <td id="open-left-pane" class="menu-pane-exclusive" style="'.$GoHomeInitialStyle.'" onclick="$(\'body\').layout().open(\'west\');">';
$sHtml .= ' <img src="../images/menu.png">';
$sHtml .= ' <i class="fas fa-bars"></i>';
$sHtml .= ' </td>';
$sHtml .= ' <td id="go-home" class="menu-pane-exclusive" style="'.$GoHomeInitialStyle.'">';
$sHtml .= ' <a href="'.utils::GetAbsoluteUrlAppRoot().'pages/UI.php"><img src="../images/home.png"></a>';
$sHtml .= ' <a href="'.utils::GetAbsoluteUrlAppRoot().'pages/UI.php"><i class="fas fa-home"></i></a>';
$sHtml .= ' </td>';
$sHtml .= ' <td class="top-bar-spacer menu-pane-exclusive" style="'.$GoHomeInitialStyle.'">';
$sHtml .= ' </td>';
@@ -1355,8 +1394,8 @@ EOF;
$sHtml .= ' <td id="top-bar-table-search">';
$sHtml .= ' <div id="global-search"><form action="'.utils::GetAbsoluteUrlAppRoot().'pages/UI.php">';
$sHtml .= ' <table id="top-left-buttons-area"><tr>';
$sHtml .= ' <td id="top-left-global-search-cell"><div id="global-search-area"><input id="global-search-input" type="text" name="text" placeholder="'.$sDefaultPlaceHolder.'" value="'.$sText.'"></input><div '.$sOnClick.' id="global-search-image"><input type="hidden" name="operation" value="full_text"/></div></div></td>';
$sHtml .= ' <td id="top-left-help-cell"><a id="help-link" href="'.$sOnlineHelpUrl.'" target="_blank"><img title="'.Dict::S('UI:Help').'" src="../images/help.png?t='.utils::GetCacheBusterTimestamp().'"/></td>';
$sHtml .= ' <td id="top-left-global-search-cell"><div id="global-search-area"><input id="global-search-input" type="text" name="text" placeholder="'.$sDefaultPlaceHolder.'" value="'.$sText.'"></input><div '.$sOnClick.' id="global-search-image"><i class="top-right-icon fa-flip-horizontal fas fa-search"></i><input type="hidden" name="operation" value="full_text"/></div></div></td>';
$sHtml .= ' <td id="top-left-help-cell"><a id="help-link" href="'.$sOnlineHelpUrl.'" target="_blank" title="'.Dict::S('UI:Help').'"><i class="top-right-icon fas fa-question-circle"></i></a></td>';
$sHtml .= ' <td id="top-left-newsroom-cell">'.$sNewsRoomInitialImage.'</td>';
$sHtml .= ' <td id="top-left-logoff-cell">'.self::FilterXSS($sLogOffMenu).'</td>';
$sHtml .= ' </tr></table></form></div>';
@@ -1411,9 +1450,12 @@ EOF;
{
if ($this->GetOutputFormat() == 'pdf' && $this->IsOutputFormatAvailable('pdf'))
{
// Note: Apparently this was a demand from ITOMIG a while back, so it's not "dead code" per say.
// The last trace we got is in R-007989. Do not remove this without checking before with the concerned parties if it is still used!
if (@is_readable(APPROOT.'lib/MPDF/mpdf.php'))
{
require_once(APPROOT.'lib/MPDF/mpdf.php');
/** @noinspection PhpUndefinedClassInspection Check above comment */
$oMPDF = new mPDF('c');
$oMPDF->mirroMargins = false;
if ($this->a_base['href'] != '')
@@ -1441,90 +1483,67 @@ EOF;
}
/**
* Adds init scripts for the collapsible sections
* @inheritDoc
* @throws \Exception
*/
private function outputCollapsibleSectionInit()
{
if (!$this->bHasCollapsibleSection)
{
return;
}
$this->add_script(<<<'EOD'
function initCollapsibleSection(iSectionId, bOpenedByDefault, sSectionStateStorageKey)
{
var bStoredSectionState = JSON.parse(localStorage.getItem(sSectionStateStorageKey));
var bIsSectionOpenedInitially = (bStoredSectionState == null) ? bOpenedByDefault : bStoredSectionState;
if (bIsSectionOpenedInitially) {
$("#LnkCollapse_"+iSectionId).toggleClass("open");
$("#Collapse_"+iSectionId).toggle();
}
$("#LnkCollapse_"+iSectionId).click(function(e) {
localStorage.setItem(sSectionStateStorageKey, !($("#Collapse_"+iSectionId).is(":visible")));
$("#LnkCollapse_"+iSectionId).toggleClass("open");
$("#Collapse_"+iSectionId).slideToggle("normal");
e.preventDefault(); // we don't want to do anything more (see #1030 : a non wanted tab switching was triggered)
});
}
EOD
);
}
public function AddTabContainer($sTabContainer, $sPrefix = '')
{
$this->add($this->m_oTabs->AddTabContainer($sTabContainer, $sPrefix));
}
public function AddToTab($sTabContainer, $sTabLabel, $sHtml)
/**
* @inheritDoc
* @throws \Exception
*/
public function AddToTab($sTabContainer, $sTabCode, $sHtml)
{
$this->add($this->m_oTabs->AddToTab($sTabContainer, $sTabLabel, $sHtml));
$this->add($this->m_oTabs->AddToTab($sTabContainer, $sTabCode, $sHtml));
}
/**
* @inheritDoc
*/
public function SetCurrentTabContainer($sTabContainer = '')
{
return $this->m_oTabs->SetCurrentTabContainer($sTabContainer);
}
public function SetCurrentTab($sTabLabel = '')
/**
* @inheritDoc
*/
public function SetCurrentTab($sTabCode = '', $sTabTitle = null)
{
return $this->m_oTabs->SetCurrentTab($sTabLabel);
return $this->m_oTabs->SetCurrentTab($sTabCode, $sTabTitle);
}
/**
* Add a tab which content will be loaded asynchronously via the supplied URL
*
* Limitations:
* Cross site scripting is not not allowed for security reasons. Use a normal tab with an IFRAME if you want to pull content from
* another server. Static content cannot be added inside such tabs.
*
* @param string $sTabLabel The (localised) label of the tab
* @param string $sUrl The URL to load (on the same server)
* @param boolean $bCache Whether or not to cache the content of the tab once it has been loaded. flase will cause the tab to be
* reloaded upon each activation.
*
* @inheritDoc
* @throws \Exception
* @since 2.0.3
*/
public function AddAjaxTab($sTabLabel, $sUrl, $bCache = true)
public function AddAjaxTab($sTabCode, $sUrl, $bCache = true, $sTabTitle = null)
{
$this->add($this->m_oTabs->AddAjaxTab($sTabLabel, $sUrl, $bCache));
$this->add($this->m_oTabs->AddAjaxTab($sTabCode, $sUrl, $bCache, $sTabTitle));
}
/**
* @inheritDoc
*/
public function GetCurrentTab()
{
return $this->m_oTabs->GetCurrentTab();
}
public function RemoveTab($sTabLabel, $sTabContainer = null)
/**
* @inheritDoc
*/
public function RemoveTab($sTabCode, $sTabContainer = null)
{
$this->m_oTabs->RemoveTab($sTabLabel, $sTabContainer);
$this->m_oTabs->RemoveTab($sTabCode, $sTabContainer);
}
/**
* Finds the tab whose title matches a given pattern
*
* @return mixed The name of the tab as a string or false if not found
* @inheritDoc
*/
public function FindTab($sPattern, $sTabContainer = null)
{
@@ -1536,49 +1555,19 @@ EOD
* DOES NOT WORK: apparently in the *old* version of jquery
* that we are using this is not supported... TO DO upgrade
* the whole jquery bundle...
*
* @param string $sTabContainer
* @param string $sTabCode
*/
public function SelectTab($sTabContainer, $sTabLabel)
public function SelectTab($sTabContainer, $sTabCode)
{
$this->add_ready_script($this->m_oTabs->SelectTab($sTabContainer, $sTabLabel));
}
public function StartCollapsibleSection(
$sSectionLabel, $bOpenedByDefault = false, $sSectionStateStorageBusinessKey = ''
) {
$this->add($this->GetStartCollapsibleSection($sSectionLabel, $bOpenedByDefault,
$sSectionStateStorageBusinessKey));
}
private function GetStartCollapsibleSection(
$sSectionLabel, $bOpenedByDefault = false, $sSectionStateStorageBusinessKey = ''
) {
$this->bHasCollapsibleSection = true;
$sHtml = '';
static $iSectionId = 0;
$sHtml .= '<a id="LnkCollapse_'.$iSectionId.'" class="CollapsibleLabel" href="#">'.$sSectionLabel.'</a></br>'."\n";
$sHtml .= '<div id="Collapse_'.$iSectionId.'" style="display:none">'."\n";
$oConfig = MetaModel::GetConfig();
$sSectionStateStorageKey = $oConfig->GetItopInstanceid().'/'.$sSectionStateStorageBusinessKey.'/collapsible-'.$iSectionId;
$sSectionStateStorageKey = json_encode($sSectionStateStorageKey);
$sOpenedByDefault = ($bOpenedByDefault) ? 'true' : 'false';
$this->add_ready_script("initCollapsibleSection($iSectionId, $sOpenedByDefault, '$sSectionStateStorageKey');");
$iSectionId++;
return $sHtml;
}
public function EndCollapsibleSection()
{
$this->add($this->GetEndCollapsibleSection());
}
public function GetEndCollapsibleSection()
{
return "</div>";
$this->add_ready_script($this->m_oTabs->SelectTab($sTabContainer, $sTabCode));
}
/**
* @inheritDoc
* @throws \Exception
*/
public function add($sHtml)
{
if (($this->m_oTabs->GetCurrentTabContainer() != '') && ($this->m_oTabs->GetCurrentTab() != ''))
@@ -1592,9 +1581,7 @@ EOD
}
/**
* Records the current state of the 'html' part of the page output
*
* @return mixed The current state of the 'html' output
* @inheritDoc
*/
public function start_capture()
{
@@ -1614,12 +1601,7 @@ EOD
}
/**
* Returns the part of the html output that occurred since the call to start_capture
* and removes this part from the current html output
*
* @param $offset mixed The value returned by start_capture
*
* @return string The part of the html output that was added since the call to start_capture
* @inheritDoc
*/
public function end_capture($offset)
{
@@ -1644,15 +1626,21 @@ EOD
/**
* Set the message to be displayed in the 'app-banner' section at the top of the page
*
* @param string $sHtmlMessage
*/
public function SetMessage($sHtmlMessage)
{
$sHtmlIcon = '<span class="fa fa-comment fa-1x"></span>';
$sHtmlIcon = '<span class="fas fa-comment fa-1x"></span>';
$this->AddApplicationMessage($sHtmlMessage, $sHtmlIcon);
}
/**
* Add message to be displayed in the 'app-banner' section at the top of the page
*
* @param string $sHtmlMessage
* @param string|null $sHtmlIcon
* @param string|null $sTip
*/
public function AddApplicationMessage($sHtmlMessage, $sHtmlIcon = null, $sTip = null)
{
@@ -1673,7 +1661,8 @@ EOD
* @param string $sContent
* @param string $sCssClasses CSS classes to add to the container
*
* @since 2.6
* @throws \Exception
* @since 2.6.0
*/
public function AddHeaderMessage($sContent, $sCssClasses = 'message_info')
{
@@ -1686,6 +1675,8 @@ EOF
/**
* Adds a script to be executed when the DOM is ready (typical JQuery use), right before add_ready_script
*
* @param string $sScript
*
* @return void
*/
public function add_init_script($sScript)

View File

@@ -0,0 +1,145 @@
<?php
/**
* Class LoginBasic
*
* @copyright Copyright (C) 2010-2019 Combodo SARL
* @license http://opensource.org/licenses/AGPL-3.0
*/
class LoginBasic extends AbstractLoginFSMExtension
{
/**
* Return the list of supported login modes for this plugin
*
* @return array of supported login modes
*/
public function ListSupportedLoginModes()
{
return array('basic');
}
protected function OnModeDetection(&$iErrorCode)
{
if (!isset($_SESSION['login_mode']))
{
if (isset($_SERVER['HTTP_AUTHORIZATION']) && !empty($_SERVER['HTTP_AUTHORIZATION']))
{
$_SESSION['login_mode'] = 'basic';
}
elseif (isset($_SERVER['REDIRECT_HTTP_AUTHORIZATION']) && !empty($_SERVER['REDIRECT_HTTP_AUTHORIZATION']))
{
$_SESSION['login_mode'] = 'basic';
}
elseif (isset($_SERVER['PHP_AUTH_USER']))
{
$_SESSION['login_mode'] = 'basic';
}
}
return LoginWebPage::LOGIN_FSM_CONTINUE;
}
protected function OnReadCredentials(&$iErrorCode)
{
if (!isset($_SESSION['login_mode']) || $_SESSION['login_mode'] == 'basic')
{
list($sAuthUser, $sAuthPwd) = $this->GetAuthUserAndPassword();
$_SESSION['login_temp_auth_user'] = $sAuthUser;
}
return LoginWebPage::LOGIN_FSM_CONTINUE;
}
protected function OnCheckCredentials(&$iErrorCode)
{
if (isset($_SESSION['login_mode']) && $_SESSION['login_mode'] == 'basic')
{
list($sAuthUser, $sAuthPwd) = $this->GetAuthUserAndPassword();
if (!UserRights::CheckCredentials($sAuthUser, $sAuthPwd, $_SESSION['login_mode'], 'internal'))
{
$iErrorCode = LoginWebPage::EXIT_CODE_WRONGCREDENTIALS;
return LoginWebPage::LOGIN_FSM_ERROR;
}
// Save the checked user
$_SESSION['auth_user'] = $sAuthUser;
}
return LoginWebPage::LOGIN_FSM_CONTINUE;
}
protected function OnCredentialsOK(&$iErrorCode)
{
if (isset($_SESSION['login_mode']) && $_SESSION['login_mode'] == 'basic')
{
$sAuthUser = $_SESSION['auth_user'];
LoginWebPage::OnLoginSuccess($sAuthUser, 'internal', $_SESSION['login_mode']);
}
return LoginWebPage::LOGIN_FSM_CONTINUE;
}
protected function OnError(&$iErrorCode)
{
if (isset($_SESSION['login_mode']) && $_SESSION['login_mode'] == 'basic')
{
$iOnExit = LoginWebPage::getIOnExit();
if ($iOnExit === LoginWebPage::EXIT_RETURN)
{
return LoginWebPage::LOGIN_FSM_RETURN; // Error, exit FSM
}
LoginWebPage::HTTP401Error();
}
return LoginWebPage::LOGIN_FSM_CONTINUE;
}
protected function OnConnected(&$iErrorCode)
{
if (isset($_SESSION['login_mode']) && $_SESSION['login_mode'] == 'basic')
{
$_SESSION['can_logoff'] = true;
return LoginWebPage::CheckLoggedUser($iErrorCode);
}
return LoginWebPage::LOGIN_FSM_CONTINUE;
}
private function GetAuthUserAndPassword()
{
$sAuthUser = '';
$sAuthPwd = null;
$sAuthorization = '';
if (isset($_SERVER['HTTP_AUTHORIZATION']) && !empty($_SERVER['HTTP_AUTHORIZATION']))
{
$sAuthorization = $_SERVER['HTTP_AUTHORIZATION'];
}
elseif (isset($_SERVER['REDIRECT_HTTP_AUTHORIZATION']) && !empty($_SERVER['REDIRECT_HTTP_AUTHORIZATION']))
{
$sAuthorization = $_SERVER['REDIRECT_HTTP_AUTHORIZATION'];
}
if (!empty($sAuthorization))
{
list($sAuthUser, $sAuthPwd) = explode(':', base64_decode(substr($sAuthorization, 6)));
}
else
{
if (isset($_SERVER['PHP_AUTH_USER']))
{
$sAuthUser = $_SERVER['PHP_AUTH_USER'];
// Unfortunately, the RFC is not clear about the encoding...
// IE and FF supply the user and password encoded in ISO-8859-1 whereas Chrome provides them encoded in UTF-8
// So let's try to guess if it's an UTF-8 string or not... fortunately all encodings share the same ASCII base
if (!LoginWebPage::LooksLikeUTF8($sAuthUser))
{
// Does not look like and UTF-8 string, try to convert it from iso-8859-1 to UTF-8
// Supposed to be harmless in case of a plain ASCII string...
$sAuthUser = iconv('iso-8859-1', 'utf-8', $sAuthUser);
}
$sAuthPwd = $_SERVER['PHP_AUTH_PW'];
if (!LoginWebPage::LooksLikeUTF8($sAuthPwd))
{
// Does not look like and UTF-8 string, try to convert it from iso-8859-1 to UTF-8
// Supposed to be harmless in case of a plain ASCII string...
$sAuthPwd = iconv('iso-8859-1', 'utf-8', $sAuthPwd);
}
}
}
return array($sAuthUser, $sAuthPwd);
}
}

View File

@@ -0,0 +1,140 @@
<?php
/**
* @copyright Copyright (C) 2010-2019 Combodo SARL
* @license http://opensource.org/licenses/AGPL-3.0
*/
/**
* Class LoginDefaultBefore
*/
class LoginDefaultBefore extends AbstractLoginFSMExtension
{
/**
* Must be executed before the other login plugins
*
* @return array of supported login modes
*/
public function ListSupportedLoginModes()
{
return array('before');
}
protected function OnStart(&$iErrorCode)
{
$iErrorCode = LoginWebPage::EXIT_CODE_OK;
unset($_SESSION['login_temp_auth_user']);
// Check if proposed login mode is present and allowed
$aAllowedLoginTypes = MetaModel::GetConfig()->GetAllowedLoginTypes();
$sProposedLoginMode = utils::ReadParam('login_mode', '');
$index = array_search($sProposedLoginMode, $aAllowedLoginTypes);
if ($index !== false)
{
// Force login mode
$_SESSION['login_mode'] = $sProposedLoginMode;
}
else
{
unset($_SESSION['login_mode']);
}
return LoginWebPage::LOGIN_FSM_CONTINUE;
}
protected function OnReadCredentials(&$iErrorCode)
{
// Check if proposed login mode is present and allowed
$aAllowedLoginTypes = MetaModel::GetConfig()->GetAllowedLoginTypes();
$sProposedLoginMode = utils::ReadParam('login_mode', '');
$index = array_search($sProposedLoginMode, $aAllowedLoginTypes);
if ($index !== false)
{
// Force login mode
LoginWebPage::SetLoginModeAndReload($sProposedLoginMode);
}
return LoginWebPage::LOGIN_FSM_CONTINUE;
}
}
/**
* Class LoginDefaultAfter
*/
class LoginDefaultAfter extends AbstractLoginFSMExtension implements iLogoutExtension
{
/**
* Must be executed after the other login plugins
*
* @return array of supported login modes
*/
public function ListSupportedLoginModes()
{
return array('after');
}
protected function OnError(&$iErrorCode)
{
self::ResetLoginSession();
$iOnExit = LoginWebPage::getIOnExit();
if ($iOnExit === LoginWebPage::EXIT_RETURN)
{
return LoginWebPage::LOGIN_FSM_RETURN; // Error, exit FSM
}
elseif ($iOnExit == LoginWebPage::EXIT_HTTP_401)
{
LoginWebPage::HTTP401Error(); // Error, exit
}
// LoginWebPage::EXIT_PROMPT
return LoginWebPage::LOGIN_FSM_CONTINUE;
}
protected function OnCredentialsOk(&$iErrorCode)
{
if (!isset($_SESSION['login_mode']))
{
// N°6358 - if EXIT_RETURN was asked, send an error
if (LoginWebPage::getIOnExit() === LoginWebPage::EXIT_RETURN) {
$iErrorCode = LoginWebPage::EXIT_CODE_WRONGCREDENTIALS;
return LoginWebPage::LOGIN_FSM_ERROR;
}
// If no plugin validated the user, exit
self::ResetLoginSession();
exit();
}
return LoginWebPage::LOGIN_FSM_CONTINUE;
}
/**
* Execute all actions to log out properly
*/
public function LogoutAction()
{
self::ResetLoginSession();
}
protected function OnConnected(&$iErrorCode)
{
unset($_SESSION['login_temp_auth_user']);
if (is_null(UserRights::GetUserObject())){
//N°7085 avoid infinite loop
IssueLog::Error("No user logged in. exit");
exit(-1);
}
return LoginWebPage::LOGIN_FSM_CONTINUE;
}
// Hard reset of the session
private static function ResetLoginSession()
{
LoginWebPage::ResetSession();
foreach (array_keys($_SESSION) as $sKey)
{
if (utils::StartsWith($sKey, 'login_'))
{
unset($_SESSION[$sKey]);
}
}
}
}

View File

@@ -0,0 +1,96 @@
<?php
/**
* Class LoginExternal
*
* @copyright Copyright (C) 2010-2019 Combodo SARL
* @license http://opensource.org/licenses/AGPL-3.0
*/
class LoginExternal extends AbstractLoginFSMExtension
{
/**
* Return the list of supported login modes for this plugin
*
* @return array of supported login modes
*/
public function ListSupportedLoginModes()
{
return array('external');
}
protected function OnModeDetection(&$iErrorCode)
{
if (!isset($_SESSION['login_mode']))
{
$sAuthUser = $this->GetAuthUser();
if ($sAuthUser && (strlen($sAuthUser) > 0))
{
$_SESSION['login_mode'] = 'external';
}
}
return LoginWebPage::LOGIN_FSM_CONTINUE;
}
protected function OnCheckCredentials(&$iErrorCode)
{
if (isset($_SESSION['login_mode']) && $_SESSION['login_mode'] == 'external')
{
$sAuthUser = $this->GetAuthUser();
if (!UserRights::CheckCredentials($sAuthUser, '', $_SESSION['login_mode'], 'external'))
{
$iErrorCode = LoginWebPage::EXIT_CODE_WRONGCREDENTIALS;
return LoginWebPage::LOGIN_FSM_ERROR;
}
// Save the checked user
$_SESSION['auth_user'] = $sAuthUser;
}
return LoginWebPage::LOGIN_FSM_CONTINUE;
}
protected function OnCredentialsOK(&$iErrorCode)
{
if (isset($_SESSION['login_mode']) && $_SESSION['login_mode'] == 'external')
{
$sAuthUser = $_SESSION['auth_user'];
LoginWebPage::OnLoginSuccess($sAuthUser, 'external', $_SESSION['login_mode']);
}
return LoginWebPage::LOGIN_FSM_CONTINUE;
}
protected function OnConnected(&$iErrorCode)
{
if (isset($_SESSION['login_mode']) && $_SESSION['login_mode'] == 'external')
{
$_SESSION['can_logoff'] = false;
return LoginWebPage::CheckLoggedUser($iErrorCode);
}
return LoginWebPage::LOGIN_FSM_CONTINUE;
}
protected function OnError(&$iErrorCode)
{
if (isset($_SESSION['login_mode']) && $_SESSION['login_mode'] == 'external')
{
$iOnExit = LoginWebPage::getIOnExit();
if ($iOnExit === LoginWebPage::EXIT_RETURN)
{
return LoginWebPage::LOGIN_FSM_RETURN; // Error, exit FSM
}
LoginWebPage::HTTP401Error();
}
return LoginWebPage::LOGIN_FSM_CONTINUE;
}
/**
* @return bool
*/
private function GetAuthUser()
{
$sExtAuthVar = MetaModel::GetConfig()->GetExternalAuthenticationVariable(); // In which variable is the info passed ?
eval('$sAuthUser = isset('.$sExtAuthVar.') ? '.$sExtAuthVar.' : false;'); // Retrieve the value
/** @var string $sAuthUser */
return $sAuthUser; // Retrieve the value
}
}

View File

@@ -0,0 +1,154 @@
<?php
/**
* @copyright Copyright (C) 2010-2019 Combodo SARL
* @license http://opensource.org/licenses/AGPL-3.0
*/
/**
* Class LoginForm
*
* @since 2.7.0
*/
class LoginForm extends AbstractLoginFSMExtension implements iLoginUIExtension
{
private $bForceFormOnError = false;
/**
* Return the list of supported login modes for this plugin
*
* @return array of supported login modes
*/
public function ListSupportedLoginModes()
{
return array('form');
}
/**
* @inheritDoc
*/
protected function OnReadCredentials(&$iErrorCode)
{
if (!isset($_SESSION['login_mode']) || ($_SESSION['login_mode'] == 'form'))
{
$sAuthUser = utils::ReadPostedParam('auth_user', '', 'raw_data');
$sAuthPwd = utils::ReadPostedParam('auth_pwd', null, 'raw_data');
if ($this->bForceFormOnError || empty($sAuthUser) || empty($sAuthPwd))
{
if (array_key_exists('HTTP_X_COMBODO_AJAX', $_SERVER))
{
// X-Combodo-Ajax is a special header automatically added to all ajax requests
// Let's reply that we're currently logged-out
header('HTTP/1.0 401 Unauthorized');
exit;
}
if (LoginWebPage::getIOnExit() === LoginWebPage::EXIT_RETURN) {
return LoginWebPage::LOGIN_FSM_CONTINUE;
}
// No credentials yet, display the form
$oPage = LoginWebPage::NewLoginWebPage();
$oPage->DisplayLoginForm($this->bForceFormOnError);
$oPage->output();
$this->bForceFormOnError = false;
exit;
}
$_SESSION['login_temp_auth_user'] = $sAuthUser;
$_SESSION['login_mode'] = 'form';
}
return LoginWebPage::LOGIN_FSM_CONTINUE;
}
/**
* @inheritDoc
*/
protected function OnCheckCredentials(&$iErrorCode)
{
if (isset($_SESSION['login_mode']) && $_SESSION['login_mode'] == 'form')
{
$sAuthUser = utils::ReadPostedParam('auth_user', '', 'raw_data');
$sAuthPwd = utils::ReadPostedParam('auth_pwd', null, 'raw_data');
if (!UserRights::CheckCredentials($sAuthUser, $sAuthPwd, $_SESSION['login_mode'], 'internal'))
{
$iErrorCode = LoginWebPage::EXIT_CODE_WRONGCREDENTIALS;
return LoginWebPage::LOGIN_FSM_ERROR;
}
// Save the checked user
$_SESSION['auth_user'] = $sAuthUser;
}
return LoginWebPage::LOGIN_FSM_CONTINUE;
}
/**
* @inheritDoc
*/
protected function OnCredentialsOK(&$iErrorCode)
{
if (isset($_SESSION['login_mode']) && $_SESSION['login_mode'] == 'form')
{
$sAuthUser = $_SESSION['auth_user'];
// Store 'auth_user' in session for further use
LoginWebPage::OnLoginSuccess($sAuthUser, 'internal', $_SESSION['login_mode']);
}
return LoginWebPage::LOGIN_FSM_CONTINUE;
}
/**
* @inheritDoc
*/
protected function OnError(&$iErrorCode)
{
if (isset($_SESSION['login_mode']) && $_SESSION['login_mode'] == 'form')
{
$this->bForceFormOnError = true;
}
return LoginWebPage::LOGIN_FSM_CONTINUE;
}
/**
* @inheritDoc
*/
protected function OnConnected(&$iErrorCode)
{
if (isset($_SESSION['login_mode']) && $_SESSION['login_mode'] == 'form')
{
$_SESSION['can_logoff'] = true;
return LoginWebPage::CheckLoggedUser($iErrorCode);
}
return LoginWebPage::LOGIN_FSM_CONTINUE;
}
/**
* @inheritDoc
* @throws \Exception
*/
public function GetTwigContext()
{
$oLoginContext = new LoginTwigContext();
$oLoginContext->AddPostedVar('auth_user');
$oLoginContext->AddPostedVar('auth_pwd');
$sAuthUser = utils::ReadParam('auth_user', '', true, 'raw_data');
$sAuthPwd = utils::ReadParam('suggest_pwd', '', true, 'raw_data');
$aData = array(
'sAuthUser' => $sAuthUser,
'sAuthPwd' => $sAuthPwd,
);
$oLoginContext->AddBlockExtension('login_input', new LoginBlockExtension('extensionblock/loginforminput.html.twig', $aData));
$oLoginContext->AddBlockExtension('login_submit', new LoginBlockExtension('extensionblock/loginformsubmit.html.twig'));
$oLoginContext->AddBlockExtension('login_form_footer', new LoginBlockExtension('extensionblock/loginformfooter.html.twig'));
$bEnableResetPassword = MetaModel::GetConfig()->Get('forgot_password');
$sResetPasswordUrl = utils::GetAbsoluteUrlAppRoot() . 'pages/UI.php?loginop=forgot_pwd';
$aData = array(
'bEnableResetPassword' => $bEnableResetPassword,
'sResetPasswordUrl' => $sResetPasswordUrl,
);
$oLoginContext->AddBlockExtension('login_links', new LoginBlockExtension('extensionblock/loginformlinks.html.twig', $aData));
return $oLoginContext;
}
}

View File

@@ -0,0 +1,321 @@
<?php
/**
*
* @copyright Copyright (C) 2010-2019 Combodo SARL
* @license http://opensource.org/licenses/AGPL-3.0
*/
use Combodo\iTop\TwigExtension;
/**
* Twig context for modules extending the login screen
* Class LoginTwigContext
*/
class LoginTwigContext
{
/** @var array */
private $aBlockExtension;
/** @var array */
private $aPostedVars;
/** @var string */
private $sTwigLoaderPath;
/** @var array */
private $aCSSFiles;
/** @var array */
private $aJsFiles;
private $sTwigNameSpace;
/**
* Build a context to display the twig files used
* to extend the login screens
*
* LoginTwigContext constructor.
* @api
*/
public function __construct()
{
$this->aBlockExtension = array();
$this->aPostedVars = array();
$this->sTwigLoaderPath = null;
$this->aCSSFiles = array();
$this->aJsFiles = array();
$this->sTwigNameSpace = null;
}
/**
* Set the absolute path on disk of the folder containing the twig templates
*
* @param string $sPath absolute path of twig templates directory
* @api
*/
public function SetLoaderPath($sPath)
{
$this->sTwigLoaderPath = $sPath;
}
/**
* Add a Twig block extension
*
* @param string $sBlockName
* @param LoginBlockExtension $oBlockExtension
*/
public function AddBlockExtension($sBlockName, $oBlockExtension)
{
$this->aBlockExtension[$sBlockName] = $oBlockExtension;
}
/**
* Add a variable intended to be posted on URL (and managed) by the module.
* Declaring the posted variables will prevent the core engine to manipulate these variables.
*
* @param string $sPostedVar Name of the posted variable
* @api
*/
public function AddPostedVar($sPostedVar)
{
$this->aPostedVars[] = $sPostedVar;
}
/**
* Add the URL of a CSS file to link to the login screen
*
* @param string $sFile URL of the CSS file to link
* @api
*/
public function AddCSSFile($sFile)
{
$this->aCSSFiles[] = $sFile;
}
/**
* Add the URL of a javascript file to link to the login screen
* @param string $sFile URL of the javascript file to link
* @api
*/
public function AddJsFile($sFile)
{
$this->aJsFiles[] = $sFile;
}
/**
* @param string $sBlockName
*
* @return \LoginBlockExtension
*/
public function GetBlockExtension($sBlockName)
{
/** @var LoginBlockExtension $oBlockExtension */
$oBlockExtension = isset($this->aBlockExtension[$sBlockName]) ? $this->aBlockExtension[$sBlockName] : null;
return $oBlockExtension;
}
/**
* @return array
*/
public function GetPostedVars()
{
return $this->aPostedVars;
}
/**
* @return string
*/
public function GetTwigLoaderPath()
{
return $this->sTwigLoaderPath;
}
/**
* @return array
*/
public function GetCSSFiles()
{
return $this->aCSSFiles;
}
/**
* @return array
*/
public function GetJsFiles()
{
return $this->aJsFiles;
}
}
/**
* Twig block description for login screen extension
* The login screen can be extended by adding twig templates
* to specific blocks of the login screens
*
* Class LoginBlockExtension
*/
class LoginBlockExtension
{
private $sTwig;
private $aData;
/**
* Create a new twig extension block
* The given twig template can be HTML, CSS or JavaScript.
* CSS goes to the block named 'css' and is inline in the page.
* JavaScript goes to the blocks named 'script' or 'ready_script' and are inline in the page.
* HTML goes to everywhere else
*
* LoginBlockExtension constructor.
*
* @param string $sTwig name of the twig file relative to the path given to the LoginTwigContext
* @param array $aData Data given to the twig template (into the variable {{ aData }})
* @api
*/
public function __construct($sTwig, $aData = array())
{
$this->sTwig = $sTwig;
$this->aData = $aData;
}
public function GetTwig()
{
return $this->sTwig;
}
public function GetData()
{
return $this->aData;
}
}
/**
* Used by LoginWebPage to display the login screen
* Class LoginTwigRenderer
*/
class LoginTwigRenderer
{
private $aLoginPluginList;
private $aPluginFormData;
private $aPostedVars;
private $oTwig;
public function __construct()
{
$this->aLoginPluginList = LoginWebPage::GetLoginPluginList('iLoginUIExtension', false);
$this->aPluginFormData = array();
$aTwigLoaders = array();
$this->aPostedVars = array();
foreach ($this->aLoginPluginList as $oLoginPlugin)
{
/** @var \iLoginUIExtension $oLoginPlugin */
$oLoginContext = $oLoginPlugin->GetTwigContext();
if (is_null($oLoginContext))
{
continue;
}
$this->aPluginFormData[] = $oLoginContext;
$sTwigLoaderPath = $oLoginContext->GetTwigLoaderPath();
if ($sTwigLoaderPath != null)
{
$oExtensionLoader = new Twig_Loader_Filesystem();
$oExtensionLoader->setPaths($sTwigLoaderPath);
$aTwigLoaders[] = $oExtensionLoader;
}
$this->aPostedVars = array_merge($this->aPostedVars, $oLoginContext->GetPostedVars());
}
$oCoreLoader = new Twig_Loader_Filesystem(array(), APPROOT.'templates');
$aCoreTemplatesPaths = array('login', 'login/password');
// Having this path declared after the plugins let the plugins replace the core templates
$oCoreLoader->setPaths($aCoreTemplatesPaths);
// Having the core templates accessible within a different namespace offer the possibility to extend them while replacing them
$oCoreLoader->setPaths($aCoreTemplatesPaths, 'ItopCore');
$aTwigLoaders[] = $oCoreLoader;
$oLoader = new Twig_Loader_Chain($aTwigLoaders);
$this->oTwig = new Twig_Environment($oLoader);
TwigExtension::RegisterTwigExtensions($this->oTwig);
}
public function GetDefaultVars()
{
$sLogo = 'itop-logo-external.png';
$sBrandingLogo = 'login-logo.png';
$sVersionShort = Dict::Format('UI:iTopVersion:Short', ITOP_APPLICATION, ITOP_VERSION);
$sIconUrl = Utils::GetConfig()->Get('app_icon_url');
$sDisplayIcon = utils::GetAbsoluteUrlAppRoot().'images/'.$sLogo.'?t='.utils::GetCacheBusterTimestamp();
if (file_exists(MODULESROOT.'branding/'.$sBrandingLogo))
{
$sDisplayIcon = utils::GetAbsoluteUrlModulesRoot().'branding/'.$sBrandingLogo.'?t='.utils::GetCacheBusterTimestamp();
}
$aVars = array(
'sAppRootUrl' => utils::GetAbsoluteUrlAppRoot(),
'aPluginFormData' => $this->GetPluginFormData(),
'sItopVersion' => ITOP_VERSION,
'sVersionShort' => $sVersionShort,
'sIconUrl' => $sIconUrl,
'sDisplayIcon' => $sDisplayIcon,
);
return $aVars;
}
public function Render(NiceWebPage $oPage, $sTwigFile, $aVars = array())
{
$oTemplate = $this->GetTwig()->load($sTwigFile);
$oPage->add($oTemplate->renderBlock('body', $aVars));
$oPage->add_script($oTemplate->renderBlock('script', $aVars));
$oPage->add_ready_script($oTemplate->renderBlock('ready_script', $aVars));
$oPage->add_style($oTemplate->renderBlock('css', $aVars));
// Render CSS links
foreach ($this->aPluginFormData as $oFormData)
{
/** @var \LoginTwigContext $oFormData */
$aCSSFiles = $oFormData->GetCSSFiles();
foreach ($aCSSFiles as $sCSSFile)
{
$oPage->add_linked_stylesheet($sCSSFile);
}
$aJsFiles = $oFormData->GetJsFiles();
foreach ($aJsFiles as $sJsFile)
{
$oPage->add_linked_script($sJsFile);
}
}
}
/**
* @return mixed
*/
public function GetLoginPluginList()
{
return $this->aLoginPluginList;
}
/**
* @return array
*/
public function GetPluginFormData()
{
return $this->aPluginFormData;
}
/**
* @return array
*/
public function GetPostedVars()
{
return $this->aPostedVars;
}
/**
* @return \Twig_Environment
*/
public function GetTwig()
{
return $this->oTwig;
}
}

View File

@@ -0,0 +1,95 @@
<?php
/**
* Class LoginURL
*
* @copyright Copyright (C) 2010-2019 Combodo SARL
* @license http://opensource.org/licenses/AGPL-3.0
*/
class LoginURL extends AbstractLoginFSMExtension
{
/**
* @var bool
*/
private $bErrorOccurred = false;
/**
* Return the list of supported login modes for this plugin
*
* @return array of supported login modes
*/
public function ListSupportedLoginModes()
{
return array('url');
}
protected function OnModeDetection(&$iErrorCode)
{
if (!isset($_SESSION['login_mode']) && !$this->bErrorOccurred)
{
$sAuthUser = utils::ReadParam('auth_user', '', false, 'raw_data');
$sAuthPwd = utils::ReadParam('auth_pwd', null, false, 'raw_data');
if (!empty($sAuthUser) && !empty($sAuthPwd))
{
$_SESSION['login_mode'] = 'url';
}
}
return LoginWebPage::LOGIN_FSM_CONTINUE;
}
protected function OnReadCredentials(&$iErrorCode)
{
if (isset($_SESSION['login_mode']) && $_SESSION['login_mode'] == 'url')
{
$_SESSION['login_temp_auth_user'] = utils::ReadParam('auth_user', '', false, 'raw_data');
}
return LoginWebPage::LOGIN_FSM_CONTINUE;
}
protected function OnCheckCredentials(&$iErrorCode)
{
if (isset($_SESSION['login_mode']) && $_SESSION['login_mode'] == 'url')
{
$sAuthUser = utils::ReadParam('auth_user', '', false, 'raw_data');
$sAuthPwd = utils::ReadParam('auth_pwd', null, false, 'raw_data');
if (!UserRights::CheckCredentials($sAuthUser, $sAuthPwd, $_SESSION['login_mode'], 'internal'))
{
$iErrorCode = LoginWebPage::EXIT_CODE_WRONGCREDENTIALS;
return LoginWebPage::LOGIN_FSM_ERROR;
}
// Save the checked user
$_SESSION['auth_user'] = $sAuthUser;
}
return LoginWebPage::LOGIN_FSM_CONTINUE;
}
protected function OnCredentialsOK(&$iErrorCode)
{
if (isset($_SESSION['login_mode']) && $_SESSION['login_mode'] == 'url')
{
$sAuthUser = $_SESSION['auth_user'];
LoginWebPage::OnLoginSuccess($sAuthUser, 'internal', $_SESSION['login_mode']);
}
return LoginWebPage::LOGIN_FSM_CONTINUE;
}
protected function OnError(&$iErrorCode)
{
if (isset($_SESSION['login_mode']) && $_SESSION['login_mode'] == 'url')
{
$this->bErrorOccurred = true;
}
return LoginWebPage::LOGIN_FSM_CONTINUE;
}
protected function OnConnected(&$iErrorCode)
{
if ($_SESSION['login_mode'] == 'url')
{
$_SESSION['can_logoff'] = true;
return LoginWebPage::CheckLoggedUser($iErrorCode);
}
return LoginWebPage::LOGIN_FSM_CONTINUE;
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,93 @@
<?php
/**
* Copyright (C) 2013-2019 Combodo SARL
*
* This file is part of iTop.
*
* iTop is free software; you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* iTop 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 Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
*/
//
// Maintenance message display functions
// Only included by approot.inc.php
//
/**
* Use a setup page to display the maintenance message
* @param $sTitle
* @param $sMessage
*/
function _MaintenanceSetupPageMessage($sTitle, $sMessage)
{
// Web Page
@include_once(APPROOT.'setup/setuppage.class.inc.php');
if (class_exists('SetupPage'))
{
$oP = new ErrorPage($sTitle);
$oP->p("<h2 class=\"center\">$sMessage</h2>");
$oP->add_ready_script(
<<<JS
// Reload in 30s to check if maintenance is over
setTimeout(function(){ window.location.reload(); }, 30000);
JS
);
$oP->output();
}
else
{
_MaintenanceTextMessage($sMessage);
}
}
/**
* Use simple text to display the maintenance message
* @param $sMessage
*/
function _MaintenanceTextMessage($sMessage)
{
echo $sMessage;
}
/**
* Use a simple HTML to display the maintenance message
* @param $sMessage
*/
function _MaintenanceHtmlMessage($sMessage)
{
echo '<html><body><div>'.$sMessage.'</div></body></html>';
}
/**
* Use a simple JSON to display the maintenance message
*
* @param $sTitle
* @param $sMessage
*/
function _MaintenanceJsonMessage($sTitle, $sMessage)
{
@include_once(APPROOT."/application/ajaxwebpage.class.inc.php");
if (class_exists('ajax_page'))
{
$oP = new ajax_page($sTitle);
$oP->add_header('Access-Control-Allow-Origin: *');
$oP->SetContentType('application/json');
$oP->add('{"code":100, "message":"'.$sMessage.'"}');
$oP->Output();
}
else
{
_MaintenanceTextMessage($sMessage);
}
}

View File

@@ -1,27 +1,20 @@
<?php
// Copyright (C) 2010-2016 Combodo SARL
//
// This file is part of iTop.
//
// iTop is free software; you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// iTop 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 Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with iTop. If not, see <http://www.gnu.org/licenses/>
/**
* Construction and display of the application's main menu
* Copyright (C) 2013-2019 Combodo SARL
*
* @copyright Copyright (C) 2010-2016 Combodo SARL
* @license http://opensource.org/licenses/AGPL-3.0
* This file is part of iTop.
*
* iTop is free software; you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* iTop 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 Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
*/
require_once(APPROOT.'/application/utils.inc.php');
@@ -135,7 +128,7 @@ class ApplicationMenu
if (is_null($oMenuNode) || !$oMenuNode->IsEnabled())
{
require_once(APPROOT.'/setup/setuppage.class.inc.php');
$oP = new SetupPage(Dict::S('UI:PageTitle:FatalError'));
$oP = new ErrorPage(Dict::S('UI:PageTitle:FatalError'));
$oP->add("<h1>".Dict::S('UI:Login:Error:AccessRestricted')."</h1>\n");
$oP->p("<a href=\"".utils::GetAbsoluteUrlAppRoot()."pages/logoff.php\">".Dict::S('UI:LogOffMenu')."</a>");
$oP->output();
@@ -201,7 +194,7 @@ class ApplicationMenu
/**
* Entry point to display the whole menu into the web page, used by iTopWebPage
* @param \iTopWebPage $oPage
* @param \WebPage $oPage
* @param $aExtraParams
* @throws DictExceptionMissingString
*/
@@ -217,7 +210,7 @@ class ApplicationMenu
{
if (!self::CanDisplayMenu($aMenu)) { continue; }
$oMenuNode = self::GetMenuNode($aMenu['index']);
$oPage->AddToMenu('<h3 id="'.utils::GetSafeId('AccordionMenu_'.$oMenuNode->GetMenuID()).'">'.$oMenuNode->GetTitle().'</h3>');
$oPage->AddToMenu('<h3 id="'.utils::GetSafeId('AccordionMenu_'.$oMenuNode->GetMenuID()).'" class="navigation-menu-group" data-menu-id="'.$oMenuNode->GetMenuId().'">'.$oMenuNode->GetTitle().'</h3>');
$oPage->AddToMenu('<div>');
$oPage->AddToMenu('<ul>');
$aChildren = self::GetChildren($aMenu['index']);
@@ -270,12 +263,15 @@ EOF
/**
* Handles the display of the sub-menus (called recursively if necessary)
* @param \iTopWebPage $oPage
*
* @param \WebPage $oPage
* @param array $aMenus
* @param array $aExtraParams
* @param int $iActiveMenu
*
* @return true if the currently selected menu is one of the submenus
* @throws DictExceptionMissingString
* @throws \Exception
*/
static protected function DisplaySubMenu($oPage, $aMenus, $aExtraParams, $iActiveMenu = -1)
{
@@ -284,22 +280,39 @@ EOF
usort($aMenus, array('ApplicationMenu', 'CompareOnRank'));
foreach($aMenus as $aMenu)
{
if (!self::CanDisplayMenu($aMenu))
{
continue;
}
$index = $aMenu['index'];
$oMenu = self::GetMenuNode($index);
if ($oMenu->IsEnabled())
{
$aChildren = self::GetChildren($index);
$sCSSClass = (count($aChildren) > 0) ? ' class="submenu"' : '';
$aCSSClasses = array('navigation-menu-item');
if (count($aChildren) > 0)
{
$aCSSClasses[] = 'submenu';
}
$sHyperlink = $oMenu->GetHyperlink($aExtraParams);
$sItemHtml = '<li id="'.utils::GetSafeId('AccordionMenu_'.$oMenu->GetMenuID()).'" class="'.implode(' ', $aCSSClasses).'" data-menu-id="'.$oMenu->GetMenuID().'">';
if ($sHyperlink != '')
{
$sLinkTarget = '';
if ($oMenu->IsHyperLinkInNewWindow())
{
$sLinkTarget .= ' target="_blank"';
}
$sURL = '"'.$oMenu->GetHyperlink($aExtraParams).'"'.$sLinkTarget;
$sTitle = utils::HtmlEntities($oMenu->GetTitle());
$oPage->AddToMenu('<li id="'.utils::GetSafeId('AccordionMenu_'.$oMenu->GetMenuID()).'" '.$sCSSClass.'><a href="'.$oMenu->GetHyperlink($aExtraParams).'">'.$sTitle.'</a></li>');
$sItemHtml .= "<a href={$sURL}>{$sTitle}</a>";
}
else
{
$oPage->AddToMenu('<li id="'.utils::GetSafeId('AccordionMenu_'.$oMenu->GetMenuID()).'" '.$sCSSClass.'>'.$oMenu->GetTitle().'</li>');
$sItemHtml .= $oMenu->GetTitle();
}
$sItemHtml .= '</li>';
$oPage->AddToMenu($sItemHtml);
if ($iActiveMenu == $index)
{
$bActive = true;
@@ -600,13 +613,24 @@ abstract class MenuNode
/**
* @param $aExtraParams
*
* @return string
* @throws \Exception
*/
public function GetHyperlink($aExtraParams)
{
$aExtraParams['c[menu]'] = $this->GetMenuId();
return $this->AddParams(utils::GetAbsoluteUrlAppRoot().'pages/UI.php', $aExtraParams);
}
/**
* @return bool true if the link should be opened in a new window
* @since 2.7.0 N°1283
*/
public function IsHyperLinkInNewWindow()
{
return false;
}
/**
* Add a limiting display condition for the same menu node. The conditions will be combined with a AND
@@ -671,8 +695,8 @@ abstract class MenuNode
public abstract function RenderContent(WebPage $oPage, $aExtraParams = array());
/**
* @param $sHyperlink
* @param $aExtraParams
* @param string $sHyperlink
* @param array $aExtraParams
* @return string
*/
protected function AddParams($sHyperlink, $aExtraParams)
@@ -716,8 +740,7 @@ class MenuGroup extends MenuNode
}
/**
* @param WebPage $oPage
* @param array $aExtraParams
* @inheritDoc
*/
public function RenderContent(WebPage $oPage, $aExtraParams = array())
{
@@ -755,8 +778,7 @@ class TemplateMenuNode extends MenuNode
}
/**
* @param $aExtraParams
* @return string
* @inheritDoc
*/
public function GetHyperlink($aExtraParams)
{
@@ -765,10 +787,8 @@ class TemplateMenuNode extends MenuNode
}
/**
* @param WebPage $oPage
* @param array $aExtraParams
* @return mixed|void
* @throws DictExceptionMissingString
* @inheritDoc
* @throws \Exception
*/
public function RenderContent(WebPage $oPage, $aExtraParams = array())
{
@@ -857,12 +877,8 @@ class OQLMenuNode extends MenuNode
}
/**
* @param WebPage $oPage
* @param array $aExtraParams
* @return mixed|void
* @throws CoreException
* @throws DictExceptionMissingString
* @throws OQLException
* @inheritDoc
* @throws \Exception
*/
public function RenderContent(WebPage $oPage, $aExtraParams = array())
{
@@ -881,11 +897,11 @@ class OQLMenuNode extends MenuNode
}
/**
* @param $sOql
* @param $sTitle
* @param $sUsageId
* @param $bSearchPane
* @param $bSearchOpen
* @param string $sOql
* @param string $sTitle
* @param string $sUsageId
* @param bool $bSearchPane
* @param bool $bSearchOpen
* @param WebPage $oPage
* @param array $aExtraParams
* @param bool $bEnableBreadcrumb
@@ -958,16 +974,14 @@ class SearchMenuNode extends MenuNode
}
/**
* @param \iTopWebPage $oPage
* @param array $aExtraParams
* @return mixed|void
* @throws DictExceptionMissingString
* @throws Exception
* @inheritDoc
* @throws \DictExceptionMissingString
* @throws \Exception
*/
public function RenderContent(WebPage $oPage, $aExtraParams = array())
{
ApplicationMenu::CheckMenuIdEnabled($this->GetMenuId());
$oPage->SetBreadCrumbEntry("menu-".$this->sMenuId, $this->GetTitle(), '', '', utils::GetAbsoluteUrlAppRoot().'images/search.png');
$oPage->SetBreadCrumbEntry("menu-".$this->sMenuId, $this->GetTitle(), '', '', utils::GetAbsoluteUrlAppRoot().'images/breadcrumb-search.png');
$oSearch = new DBObjectSearch($this->sClass);
$aParams = array_merge(array('table_id' => 'Menu_'.utils::GetSafeId($this->GetMenuId())), $aExtraParams);
@@ -990,8 +1004,12 @@ class WebPageMenuNode extends MenuNode
*/
protected $sHyperlink;
/** @var bool */
protected $bIsLinkInNewWindow;
/**
* Create a menu item that points to any web page (not only UI.php)
*
* @param string $sMenuId Unique identifier of the menu (used to identify the menu for bookmarking, and for getting the labels from the dictionary)
* @param string $sHyperlink URL to the page to load. Use relative URL if you want to keep the application portable !
* @param integer $iParentIndex ID of the parent menu
@@ -1000,17 +1018,21 @@ class WebPageMenuNode extends MenuNode
* @param integer $iActionCode Either UR_ACTION_READ, UR_ACTION_MODIFY, UR_ACTION_DELETE, UR_ACTION_BULKREAD, UR_ACTION_BULKMODIFY or UR_ACTION_BULKDELETE
* @param integer $iAllowedResults Expected "rights" for the action: either UR_ALLOWED_YES, UR_ALLOWED_NO, UR_ALLOWED_DEPENDS or a mix of them...
* @param string $sEnableStimulus
* @param bool $bIsLinkInNewWindow for the {@link WebPageMenuNode::IsHyperLinkInNewWindow} method
*/
public function __construct($sMenuId, $sHyperlink, $iParentIndex, $fRank = 0.0, $sEnableClass = null, $iActionCode = null, $iAllowedResults = UR_ALLOWED_YES, $sEnableStimulus = null)
public function __construct(
$sMenuId, $sHyperlink, $iParentIndex, $fRank = 0.0, $sEnableClass = null, $iActionCode = null,
$iAllowedResults = UR_ALLOWED_YES, $sEnableStimulus = null, $bIsLinkInNewWindow = false
)
{
parent::__construct($sMenuId, $iParentIndex, $fRank, $sEnableClass, $iActionCode, $iAllowedResults, $sEnableStimulus);
$this->sHyperlink = $sHyperlink;
$this->aReflectionProperties['url'] = $sHyperlink;
$this->bIsLinkInNewWindow = $bIsLinkInNewWindow;
}
/**
* @param array $aExtraParams
* @return string
* @inheritDoc
*/
public function GetHyperlink($aExtraParams)
{
@@ -1019,8 +1041,15 @@ class WebPageMenuNode extends MenuNode
}
/**
* @param WebPage $oPage
* @param array $aExtraParams
* @inheritDoc
*/
public function IsHyperLinkInNewWindow()
{
return $this->bIsLinkInNewWindow;
}
/**
* @inheritDoc
*/
public function RenderContent(WebPage $oPage, $aExtraParams = array())
{
@@ -1061,10 +1090,7 @@ class NewObjectMenuNode extends MenuNode
}
/**
* @param string[] $aExtraParams
*
* @return string
* @throws \Exception
* @inheritDoc
*/
public function GetHyperlink($aExtraParams)
{
@@ -1098,8 +1124,7 @@ class NewObjectMenuNode extends MenuNode
}
/**
* @param WebPage $oPage
* @param string[] $aExtraParams
* @inheritDoc
*/
public function RenderContent(WebPage $oPage, $aExtraParams = array())
{
@@ -1137,8 +1162,7 @@ class DashboardMenuNode extends MenuNode
}
/**
* @param string[] $aExtraParams
* @return string
* @inheritDoc
*/
public function GetHyperlink($aExtraParams)
{
@@ -1157,10 +1181,8 @@ class DashboardMenuNode extends MenuNode
}
/**
* @param \iTopWebPage $oPage
* @param string[] $aExtraParams
* @throws CoreException
* @throws Exception
* @inheritDoc
* @throws \Exception
*/
public function RenderContent(WebPage $oPage, $aExtraParams = array())
{
@@ -1168,8 +1190,9 @@ class DashboardMenuNode extends MenuNode
$oDashboard = $this->GetDashboard();
if ($oDashboard != null)
{
$sDivId = preg_replace('/[^a-zA-Z0-9_]/', '', $this->sMenuId);
$sDivId = utils::Sanitize($this->sMenuId, '', 'element_identifier');
$oPage->add('<div class="dashboard_contents" id="'.$sDivId.'">');
$aExtraParams['dashboard_div_id'] = $sDivId;
$oDashboard->SetReloadURL($this->GetHyperlink($aExtraParams));
$oDashboard->Render($oPage, false, $aExtraParams);
$oPage->add('</div>');
@@ -1254,8 +1277,7 @@ class DashboardMenuNode extends MenuNode
class ShortcutContainerMenuNode extends MenuNode
{
/**
* @param string[] $aExtraParams
* @return string
* @inheritDoc
*/
public function GetHyperlink($aExtraParams)
{
@@ -1263,15 +1285,14 @@ class ShortcutContainerMenuNode extends MenuNode
}
/**
* @param WebPage $oPage
* @param string[] $aExtraParams
* @return mixed|void
* @inheritDoc
*/
public function RenderContent(WebPage $oPage, $aExtraParams = array())
{
}
/**
* @inheritDoc
* @throws CoreException
* @throws Exception
*/
@@ -1326,9 +1347,7 @@ class ShortcutMenuNode extends MenuNode
}
/**
* @param string[] $aExtraParams
* @return string
* @throws CoreException
* @inheritDoc
*/
public function GetHyperlink($aExtraParams)
{
@@ -1346,10 +1365,8 @@ class ShortcutMenuNode extends MenuNode
}
/**
* @param WebPage $oPage
* @param string[] $aExtraParams
* @return mixed|void
* @throws DictExceptionMissingString
* @inheritDoc
* @throws \Exception
*/
public function RenderContent(WebPage $oPage, $aExtraParams = array())
{
@@ -1358,8 +1375,9 @@ class ShortcutMenuNode extends MenuNode
}
/**
* @return string
* @throws CoreException
* @inheritDoc
*
* @throws \Exception
*/
public function GetTitle()
{
@@ -1367,8 +1385,9 @@ class ShortcutMenuNode extends MenuNode
}
/**
* @return string
* @throws CoreException
* @inheritDoc
*
* @throws \Exception
*/
public function GetLabel()
{

View File

@@ -1,27 +1,20 @@
<?php
// Copyright (C) 2010-2016 Combodo SARL
//
// This file is part of iTop.
//
// iTop is free software; you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// iTop 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 Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with iTop. If not, see <http://www.gnu.org/licenses/>
/**
* Class NiceWebPage
* Copyright (C) 2013-2020 Combodo SARL
*
* @copyright Copyright (C) 2010-2016 Combodo SARL
* @license http://opensource.org/licenses/AGPL-3.0
* This file is part of iTop.
*
* iTop is free software; you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* iTop 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 Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
*/
require_once(APPROOT."/application/webpage.class.inc.php");
@@ -37,17 +30,16 @@ class NiceWebPage extends WebPage
{
parent::__construct($s_title, $bPrintable);
$this->m_aReadyScripts = array();
$this->add_linked_script(utils::GetAbsoluteUrlAppRoot().'js/jquery-3.3.1.min.js');
$this->add_linked_script(utils::GetAbsoluteUrlAppRoot().'js/jquery.min.js');
if(utils::IsDevelopmentEnvironment()) // Needed since many other plugins still rely on oldies like $.browser
{
$this->add_linked_script(utils::GetAbsoluteUrlAppRoot().'js/jquery-migrate-3.0.1.dev.js');
$this->add_linked_script(utils::GetAbsoluteUrlAppRoot().'js/jquery-migrate.dev.js');
}
else
{
$this->add_linked_script(utils::GetAbsoluteUrlAppRoot().'js/jquery-migrate-3.0.1.prod.min.js');
$this->add_linked_script(utils::GetAbsoluteUrlAppRoot().'js/jquery-migrate.prod.min.js');
}
$this->add_linked_stylesheet(utils::GetAbsoluteUrlAppRoot().'css/ui-lightness/jquery-ui-1.11.4.custom.css');
$this->add_linked_script(utils::GetAbsoluteUrlAppRoot().'js/jquery-ui-1.11.4.custom.min.js');
$this->add_linked_script(utils::GetAbsoluteUrlAppRoot().'js/jquery-ui-1.11.4.custom.min.js');
$this->add_linked_script(utils::GetAbsoluteUrlAppRoot().'js/utils.js');
$this->add_linked_script(utils::GetAbsoluteUrlAppRoot().'js/hovertip.js');
// table sorting
@@ -75,6 +67,8 @@ class NiceWebPage extends WebPage
$this->add_linked_script(utils::GetAbsoluteUrlAppRoot().'js/search/search_form_criteria_date_abstract.js');
$this->add_linked_script(utils::GetAbsoluteUrlAppRoot().'js/search/search_form_criteria_date.js');
$this->add_linked_script(utils::GetAbsoluteUrlAppRoot().'js/search/search_form_criteria_date_time.js');
$this->add_linked_script(utils::GetAbsoluteUrlAppRoot().'js/clipboard.min.js');
$this->add_linked_script(utils::GetAbsoluteUrlAppRoot().'js/clipboardwidget.js');
$this->add_dict_entries('UI:Combo');
@@ -122,7 +116,7 @@ class NiceWebPage extends WebPage
$("table.listResults").tableHover(); // hover tables
EOF
);
$this->add_saas("css/light-grey.scss");
$this->LoadTheme();
$this->m_sRootUrl = $this->GetAbsoluteUrlAppRoot();
$sAbsURLAppRoot = addslashes($this->m_sRootUrl);
@@ -232,7 +226,8 @@ EOF
foreach($aChoices as $sKey => $sValue)
{
$sSelected = ($sKey == $sDefaultValue) ? " SELECTED" : "";
$this->add("<option style=\"width: ".$iWidthPx." px;\" value=\"".htmlspecialchars($sKey)."\"$sSelected>".htmlentities($sValue, ENT_QUOTES, 'UTF-8')."</option>");
$this->add("<option style=\"width: ".$iWidthPx." px;\" value=\"".htmlspecialchars($sKey)."\"$sSelected>".htmlentities($sValue,
ENT_QUOTES, self::PAGES_CHARSET)."</option>");
}
$this->add("</select>");
}
@@ -254,6 +249,14 @@ EOF
}
parent::output();
}
}
?>
/**
* @throws \Exception
* @since 2.7.0
*/
protected function LoadTheme()
{
$sCssThemeUrl = ThemeHandler::GetCurrentThemeUrl();
$this->add_linked_stylesheet($sCssThemeUrl);
}
}

View File

@@ -1,15 +1,53 @@
<?php
require_once(APPROOT.'lib/tcpdf/tcpdf.php');
/**
* Copyright (C) 2013-2019 Combodo SARL
*
* This file is part of iTop.
*
* iTop is free software; you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* iTop 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 Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
*/
require_once(APPROOT.'application/utils.inc.php');
/**
* Custom class derived from TCPDF for providing custom headers and footers
*
* @author denis
*
*/
class iTopPDF extends TCPDF
{
protected $sDocumentTitle;
/**
* Shortcut for {@link TCPDF::SetFont}, to use the font configured
*
* @param string $style
* @param int $size
* @param string $fontfile
* @param string $subset
* @param bool $out
*
* @uses \TCPDF::SetFont()
* @uses \iTopPDF::GetPdfFont()
* @since 2.7.0
*/
public function SetFontParams($style, $size, $fontfile='', $subset='default', $out=true)
{
$siTopFont = self::GetPdfFont();
$this->SetFont($siTopFont, $style, $size, $fontfile, $subset, $out);
}
public function SetDocumentTitle($sDocumentTitle)
{
$this->sDocumentTitle = $sDocumentTitle;
@@ -17,26 +55,29 @@ class iTopPDF extends TCPDF
/**
* Builds the custom header. Called for each new page.
*
* @see TCPDF::Header()
*/
public function Header()
{
// Title
// Set font
$this->SetFont('dejavusans', 'B', 10);
$this->SetFontParams('B', 10);
$iPageNumberWidth = 25;
$aMargins = $this->getMargins();
// Display the title (centered)
$this->SetXY($aMargins['left'] + $iPageNumberWidth, 0);
$this->MultiCell($this->getPageWidth() - $aMargins['left'] - $aMargins['right'] - 2*$iPageNumberWidth, 15, $this->sDocumentTitle, 0, 'C', false, 0 /* $ln */, '', '', true, 0, false, true, 15, 'M' /* $valign */);
$this->SetFont('dejavusans', '', 10);
$this->MultiCell($this->getPageWidth() - $aMargins['left'] - $aMargins['right'] - 2 * $iPageNumberWidth, 15, $this->sDocumentTitle,
0, 'C', false, 0 /* $ln */, '', '', true, 0, false, true, 15, 'M' /* $valign */);
$this->SetFontParams('', 10);
// Display the page number (right aligned)
// Warning: the 'R'ight alignment does not work when using placeholders like $this->getAliasNumPage() or $this->getAliasNbPages()
$this->MultiCell($iPageNumberWidth, 15, Dict::Format('Core:BulkExport:PDF:PageNumber' ,$this->page), 0, 'R', false, 0 /* $ln */, '', '', true, 0, false, true, 15, 'M' /* $valign */);
$this->MultiCell($iPageNumberWidth, 15, Dict::Format('Core:BulkExport:PDF:PageNumber', $this->page), 0, 'R', false, 0 /* $ln */, '',
'', true, 0, false, true, 15, 'M' /* $valign */);
// Branding logo
$sBrandingIcon = APPROOT.'images/itop-logo.png';
if (file_exists(MODULESROOT.'branding/main-logo.png'))
@@ -51,6 +92,18 @@ class iTopPDF extends TCPDF
{
// No footer
}
/**
* dejavusans is a UTF-8 Unicode font. Standard PDF fonts like helvetica or times new roman are NOT UTF-8
* @return string font in the config file (export_pdf_font)
*/
public static function GetPdfFont()
{
$oConfig = utils::GetConfig();
$sPdfFont = $oConfig->Get('export_pdf_font');
return $sPdfFont;
}
}
/**
@@ -58,49 +111,45 @@ class iTopPDF extends TCPDF
*/
class PDFPage extends WebPage
{
/**
* Instance of the TCPDF object for creating the PDF
* @var TCPDF
*/
/** @var \iTopPDF Instance of the TCPDF object for creating the PDF */
protected $oPdf;
public function __construct($s_title, $sPageFormat = 'A4', $sPageOrientation = 'L')
{
parent::__construct($s_title);
define(K_PATH_FONTS, APPROOT.'lib/tcpdf/fonts');
$this->oPdf = new iTopPDF($sPageOrientation, 'mm', $sPageFormat, true, 'UTF-8', false);
define(K_PATH_FONTS, APPROOT.'lib/combodo/tcpdf/fonts');
$this->oPdf = new iTopPDF($sPageOrientation, 'mm', $sPageFormat, true, self::PAGES_CHARSET, false);
// set document information
$this->oPdf->SetCreator(PDF_CREATOR);
$this->oPdf->SetAuthor('iTop');
$this->oPdf->SetTitle($s_title);
$this->oPdf->SetDocumentTitle($s_title);
$this->oPdf->setFontSubsetting(true);
// Set font
// dejavusans is a UTF-8 Unicode font. Standard PDF fonts like helvetica or times new roman are NOT UTF-8
$this->oPdf->SetFont('dejavusans', '', 10, '', true);
$this->oPdf->SetFontParams('', 10, '', true);
// set auto page breaks
$this->oPdf->SetAutoPageBreak(true, 15); // 15 mm break margin at the bottom
$this->oPdf->SetTopMargin(15);
// Add a page, we're ready to start
$this->oPdf->AddPage();
$this->SetContentDisposition('inline', $s_title.'.pdf');
$this->SetDefaultStyle();
}
/**
* Sets a default style (suitable for printing) to be included each time $this->oPdf->writeHTML() is called
*/
protected function SetDefaultStyle()
{
$this->add_style(
<<<EOF
<<<EOF
table {
padding: 2pt;
}
@@ -124,19 +173,21 @@ td.icon {
width: 30px;
}
EOF
);
);
}
/**
* Get access to the underlying TCPDF object
* @return TCPDF
*
* @return \iTopPDF
*/
public function get_tcpdf()
{
$this->flush();
return $this->oPdf;
}
/**
* Writes the currently buffered HTML content into the PDF. This can be useful:
* - to sync the flow in case you want to access the underlying TCPDF object for some specific/graphic output
@@ -156,39 +207,42 @@ EOF
$this->s_content = '';
}
}
/**
* Whether or not the page is a PDF page
*
* @return boolean
*/
public function is_pdf()
{
return true;
}
/**
* Generates the PDF document and returns the PDF content as a string
*
* @return string
* @see WebPage::output()
*/
public function output()
{
$this->add_header('Content-type: application/x-pdf');
if (!empty($this->sContentDisposition))
{
if (!empty($this->sContentDisposition))
{
$this->add_header('Content-Disposition: '.$this->sContentDisposition.'; filename="'.$this->sContentFileName.'"');
}
foreach($this->a_headers as $s_header)
{
header($s_header);
}
$this->flush();
}
foreach ($this->a_headers as $s_header)
{
header($s_header);
}
$this->flush();
echo $this->oPdf->Output($this->s_title.'.pdf', 'S');
}
public function get_pdf()
{
$this->flush();
return $this->oPdf->Output($this->s_title.'.pdf', 'S');
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -3,7 +3,7 @@
//
// This file is part of iTop.
//
// iTop is free software; you can redistribute it and/or modify
// iTop is free software; you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
@@ -15,12 +15,15 @@
//
// You should have received a copy of the GNU Affero General Public License
// along with iTop. If not, see <http://www.gnu.org/licenses/>
require_once(APPROOT.'/core/cmdbobject.class.inc.php');
require_once(APPROOT.'/application/utils.inc.php');
require_once(APPROOT.'/core/contexttag.class.inc.php');
/**
* File to include to initialize the datamodel in memory
*
* @copyright Copyright (C) 2010-2016 Combodo SARL
* @copyright Copyright (C) 2010-2019 Combodo SARL
* @license http://opensource.org/licenses/AGPL-3.0
*/
@@ -32,21 +35,30 @@ register_shutdown_function(function()
$sReservedMemory = null;
if (!is_null($err = error_get_last()) && ($err['type'] == E_ERROR))
{
if (strpos($err['message'], 'Allowed memory size of') !== false)
{
$sLimit = ini_get('memory_limit');
echo "<p>iTop: Allowed memory size of $sLimit exhausted, contact your administrator to increase memory_limit in php.ini</p>\n";
// Remove stack trace from MySQLException (since 2.7.2 see N°3174)
$sMessage = $err['message'];
if (strpos($sMessage, 'MySQLException') !== false) {
$iStackTracePos = strpos($sMessage, 'Stack trace:');
if ($iStackTracePos !== false) {
$sMessage = substr($sMessage, 0, $iStackTracePos);
}
}
else
{
// Log additional info but message from $err (since 2.7.6 N°4174)
$aErrToLog = $err;
unset($aErrToLog['message']);
IssueLog::error($sMessage, null, $aErrToLog);
if (strpos($err['message'], 'Allowed memory size of') !== false) {
$sLimit = ini_get('memory_limit');
echo "<p>iTop: Allowed memory size of $sLimit exhausted, contact your administrator to increase 'memory_limit' in php.ini</p>\n";
} elseif (strpos($err['message'], 'Maximum execution time') !== false) {
$sLimit = ini_get('max_execution_time');
echo "<p>iTop: Maximum execution time of $sLimit exceeded, contact your administrator to increase 'max_execution_time' in php.ini</p>\n";
} else {
echo "<p>iTop: An error occurred, check server error log for more information.</p>\n";
}
}
});
require_once(APPROOT.'/core/cmdbobject.class.inc.php');
require_once(APPROOT.'/application/utils.inc.php');
require_once(APPROOT.'/core/contexttag.class.inc.php');
session_name('itop-'.md5(APPROOT));
session_start();
$sSwitchEnv = utils::ReadParam('switch_env', null);
@@ -79,4 +91,10 @@ else
$_SESSION['itop_env'] = ITOP_DEFAULT_ENV;
}
$sConfigFile = APPCONF.$sEnv.'/'.ITOP_CONFIG_FILE;
MetaModel::Startup($sConfigFile, false /* $bModelOnly */, $bAllowCache, false /* $bTraceSourceFiles */, $sEnv);
try {
MetaModel::Startup($sConfigFile, false /* $bModelOnly */, $bAllowCache, false /* $bTraceSourceFiles */, $sEnv);
}
catch (MySQLException $e) {
IssueLog::Debug($e->getMessage());
throw new MySQLException('Could not connect to the DB server', []);
}

View File

@@ -1,27 +1,20 @@
<?php
// Copyright (C) 2010-2017 Combodo SARL
//
// This file is part of iTop.
//
// iTop is free software; you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// iTop 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 Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with iTop. If not, see <http://www.gnu.org/licenses/>
/**
* Class DisplayTemplate
* Copyright (C) 2013-2020 Combodo SARL
*
* @copyright Copyright (C) 2010-2017 Combodo SARL
* @license http://opensource.org/licenses/AGPL-3.0
* This file is part of iTop.
*
* iTop is free software; you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* iTop 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 Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
*/
require_once(APPROOT.'/application/displayblock.class.inc.php');
@@ -191,7 +184,7 @@ class DisplayTemplate
break;
case 'itoptab':
$oPage->SetCurrentTab(Dict::S(str_replace('_', ' ', $aAttributes['name'])));
$oPage->SetCurrentTab($aAttributes['name'], str_replace('_', ' ', $aAttributes['name']));
$oTemplate = new DisplayTemplate($sContent);
$oTemplate->Render($oPage, array()); // no params to apply, they have already been applied
//$oPage->p('iTop Tab Content:<pre>'.htmlentities($sContent, ENT_QUOTES, 'UTF-8').'</pre>');

View File

@@ -0,0 +1,194 @@
<?php
/**
* Copyright (C) 2013-2020 Combodo SARL
*
* This file is part of iTop.
*
* iTop is free software; you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* iTop 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 Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
*/
/**
* Class ThemeHandler
*
* @author Stephen Abello <stephen.abello@combodo.com>
* @since 2.7.0
*/
class ThemeHandler
{
/**
* Return default theme name and parameters
*
* @return array
* @since 2.7.0
*/
public static function GetDefaultThemeInformation()
{
return array(
'name' => 'light-grey',
'parameters' => array(
'variables' => array(),
'imports' => array(
'css-variables' => '../css/css-variables.scss',
),
'stylesheets' => array(
'jqueryui' => '../css/ui-lightness/jqueryui.scss',
'main' => '../css/light-grey.scss',
),
),
);
}
/**
* Return the ID of the theme currently defined in the config. file
*
* @return string
*/
public static function GetCurrentThemeId()
{
try
{
if (is_null(MetaModel::GetConfig()))
{
throw new CoreException('no config');
}
$sThemeId = MetaModel::GetConfig()->Get('backoffice_default_theme');
}
catch(CoreException $oCompileException)
{
// Fallback on our default theme in case the config. is not available yet
$aDefaultTheme = ThemeHandler::GetDefaultThemeInformation();
$sThemeId = $aDefaultTheme['name'];
}
return $sThemeId;
}
/**
* Return the absolute path of the compiled theme folder.
*
* @param string $sThemeId
*
* @return string
*/
public static function GetCompiledThemeFolderAbsolutePath($sThemeId)
{
return APPROOT.'env-'.utils::GetCurrentEnvironment().'/branding/themes/'.$sThemeId.'/';
}
/**
* Return the absolute URL for the current theme CSS file
*
* @return string
* @throws \Exception
*/
public static function GetCurrentThemeUrl()
{
try
{
// Try to compile theme defined in the configuration
$sThemeId = static::GetCurrentThemeId();
static::CompileTheme($sThemeId);
}
catch(CoreException $oCompileException)
{
// Fallback on our default theme (should always be compilable) in case the previous theme doesn't exists
$aDefaultTheme = ThemeHandler::GetDefaultThemeInformation();
$sThemeId = $aDefaultTheme['name'];
$sDefaultThemeDirPath = static::GetCompiledThemeFolderAbsolutePath($sThemeId);
// Create our theme dir if it doesn't exist (XML theme node removed, renamed etc..)
if(!is_dir($sDefaultThemeDirPath))
{
SetupUtils::builddir($sDefaultThemeDirPath);
}
static::CompileTheme($sThemeId, $aDefaultTheme['parameters']);
}
// Return absolute url to theme compiled css
return utils::GetAbsoluteUrlModulesRoot().'/branding/themes/'.$sThemeId.'/main.css';
}
/**
* Compile the $sThemeId theme
*
* @param string $sThemeId
* @param array|null $aThemeParameters Parameters (variables, imports, stylesheets) for the theme, if not passed, will be retrieved from compiled DM
* @param array|null $aImportsPaths Paths where imports can be found. Must end with '/'
* @param string|null $sWorkingPath Path of the folder used during compilation. Must end with a '/'
*
* @throws \CoreException
*/
public static function CompileTheme($sThemeId, $aThemeParameters = null, $aImportsPaths = null, $sWorkingPath = null)
{
// Default working path
if($sWorkingPath === null)
{
$sWorkingPath = APPROOT.'env-'.utils::GetCurrentEnvironment().'/';
}
// Default import paths (env-*)
if($aImportsPaths === null)
{
$aImportsPaths = array(
APPROOT.'env-'.utils::GetCurrentEnvironment().'/',
);
}
// Note: We do NOT check that the folder exists!
$sThemeFolderPath = $sWorkingPath.'/branding/themes/'.$sThemeId.'/';
$sThemeCssPath = $sThemeFolderPath.'main.css';
// Save parameters if passed... (typically during DM compilation)
if(is_array($aThemeParameters))
{
file_put_contents($sThemeFolderPath.'/theme-parameters.json', json_encode($aThemeParameters));
}
// ... Otherwise, retrieve them from compiled DM (typically when switching current theme in the config. file)
else
{
$aThemeParameters = json_decode(@file_get_contents($sThemeFolderPath.'theme-parameters.json'), true);
if ($aThemeParameters === null)
{
throw new CoreException('Could not load "'.$sThemeId.'" theme parameters from file, check that it has been compiled correctly');
}
}
$sTmpThemeScssContent = '';
$iStyleLastModified = 0;
clearstatcache();
// Loading files to import and stylesheet to compile, also getting most recent modification time on overall files
foreach ($aThemeParameters['imports'] as $sImport)
{
$sTmpThemeScssContent .= '@import "'.$sImport.'";'."\n";
$iImportLastModified = @filemtime($sWorkingPath.$sImport);
$iStyleLastModified = $iStyleLastModified < $iImportLastModified ? $iImportLastModified : $iStyleLastModified;
}
foreach ($aThemeParameters['stylesheets'] as $sStylesheet)
{
$sTmpThemeScssContent .= '@import "'.$sStylesheet.'";'."\n";
$iStylesheetLastModified = @filemtime($sWorkingPath.$sStylesheet);
$iStyleLastModified = $iStyleLastModified < $iStylesheetLastModified ? $iStylesheetLastModified : $iStyleLastModified;
}
// Checking if our compiled css is outdated
if (!file_exists($sThemeCssPath) || (is_writable($sThemeFolderPath) && (@filemtime($sThemeCssPath) < $iStyleLastModified)))
{
$sTmpThemeCssContent = utils::CompileCSSFromSASS($sTmpThemeScssContent, $aImportsPaths, $aThemeParameters['variables']);
file_put_contents($sThemeCssPath, $sTmpThemeCssContent);
}
}
}

View File

@@ -216,7 +216,7 @@ class privUITransactionFile
*
* @param void
*
* @return int The identifier of the new transaction
* @return int The new transaction identifier
*
* @throws \SecurityException
* @throws \Exception
@@ -231,8 +231,9 @@ class privUITransactionFile
{
throw new Exception('The directory "'.APPROOT.'data" must be writable to the application.');
}
/** @noinspection MkdirRaceConditionInspection */
if (!@mkdir(APPROOT.'data/transactions'))
// condition avoids race condition N°2345
// See https://github.com/kalessil/phpinspectionsea/blob/master/docs/probable-bugs.md#mkdir-race-condition
if (!mkdir($concurrentDirectory = APPROOT.'data/transactions') && !is_dir($concurrentDirectory))
{
throw new Exception('Failed to create the directory "'.APPROOT.'data/transactions". Ajust the rights on the parent directory or let an administrator create the transactions directory and give the web sever enough rights to write into it.');
}
@@ -333,11 +334,19 @@ class privUITransactionFile
* Cleanup old transactions which have been pending since more than 24 hours
* Use filemtime instead of filectime since filectime may be affected by operations on the directory (like changing the access rights)
*/
protected static function CleanupOldTransactions()
protected static function CleanupOldTransactions($sTransactionDir = null)
{
$iLimit = time() - 24*3600;
$iThreshold = (int) MetaModel::GetConfig()->Get('transactions_gc_threshold');
$iThreshold = min(100, $iThreshold);
$iThreshold = max(1, $iThreshold);
if ((100 != $iThreshold) && (rand(1, 100) > $iThreshold)) {
return;
}
clearstatcache();
$aTransactions = glob(APPROOT.'data/transactions/*-*');
$iLimit = time() - 24*3600;
$sPattern = $sTransactionDir ? "$sTransactionDir/*" : APPROOT.'data/transactions/*';
$aTransactions = glob($sPattern);
foreach($aTransactions as $sFileName)
{
if (filemtime($sFileName) < $iLimit)

View File

@@ -0,0 +1,131 @@
<?php
namespace Combodo\iTop;
use AttributeDateTime;
use Dict;
use Exception;
use Twig_Environment;
use Twig_SimpleFilter;
use Twig_SimpleFunction;
use utils;
class TwigExtension
{
/**
* Registers Twig extensions such as filters or functions.
* It allows us to access some stuff directly in twig.
*
* @param \Twig_Environment $oTwigEnv
*/
public static function RegisterTwigExtensions(Twig_Environment &$oTwigEnv)
{
// Filter to translate a string via the Dict::S function
// Usage in twig: {{ 'String:ToTranslate'|dict_s }}
$oTwigEnv->addFilter(new Twig_SimpleFilter('dict_s',
function ($sStringCode, $sDefault = null, $bUserLanguageOnly = false) {
return Dict::S($sStringCode, $sDefault, $bUserLanguageOnly);
})
);
// Filter to format a string via the Dict::Format function
// Usage in twig: {{ 'String:ToTranslate'|dict_format() }}
$oTwigEnv->addFilter(new Twig_SimpleFilter('dict_format',
function ($sStringCode, $sParam01 = null, $sParam02 = null, $sParam03 = null, $sParam04 = null) {
return Dict::Format($sStringCode, $sParam01, $sParam02, $sParam03, $sParam04);
})
);
// Filter to format output
// example a DateTime is converted to user format
// Usage in twig: {{ 'String:ToFormat'|output_format }}
$oTwigEnv->addFilter(new Twig_SimpleFilter('date_format',
function ($sDate) {
try
{
if (preg_match('@^\d\d\d\d-\d\d-\d\d \d\d:\d\d:\d\d$@', trim($sDate)))
{
return AttributeDateTime::GetFormat()->Format($sDate);
}
}
catch (Exception $e)
{
}
return $sDate;
})
);
// Filter to format output
// example a DateTime is converted to user format
// Usage in twig: {{ 'String:ToFormat'|output_format }}
$oTwigEnv->addFilter(new Twig_SimpleFilter('size_format',
function ($sSize) {
return utils::BytesToFriendlyFormat($sSize);
})
);
// Filter to enable base64 encode/decode
// Usage in twig: {{ 'String to encode'|base64_encode }}
$oTwigEnv->addFilter(new Twig_SimpleFilter('base64_encode', 'base64_encode'));
$oTwigEnv->addFilter(new Twig_SimpleFilter('base64_decode', 'base64_decode'));
// Filter to enable json decode (encode already exists)
// Usage in twig: {{ aSomeArray|json_decode }}
$oTwigEnv->addFilter(new Twig_SimpleFilter('json_decode', function ($sJsonString, $bAssoc = false) {
return json_decode($sJsonString, $bAssoc);
})
);
// Filter to add itopversion to an url
$oTwigEnv->addFilter(new Twig_SimpleFilter('add_itop_version', function ($sUrl) {
if (strpos($sUrl, '?') === false)
{
$sUrl = $sUrl."?itopversion=".ITOP_VERSION;
}
else
{
$sUrl = $sUrl."&itopversion=".ITOP_VERSION;
}
return $sUrl;
}));
// Filter to add a module's version to an url
$oTwigEnv->addFilter(new Twig_SimpleFilter('add_module_version', function ($sUrl, $sModuleName) {
$sModuleVersion = utils::GetCompiledModuleVersion($sModuleName);
if (strpos($sUrl, '?') === false)
{
$sUrl = $sUrl."?moduleversion=".$sModuleVersion;
}
else
{
$sUrl = $sUrl."&moduleversion=".$sModuleVersion;
}
return $sUrl;
}));
// Function to check our current environment
// Usage in twig: {% if is_development_environment() %}
$oTwigEnv->addFunction(new Twig_SimpleFunction('is_development_environment', function()
{
return utils::IsDevelopmentEnvironment();
}));
// Function to get the URL of a static page in a module
// Usage in twig: {{ get_static_page_module_url('itop-my-module', 'path-to-my-page') }}
$oTwigEnv->addFunction(new Twig_SimpleFunction('get_static_page_module_url', function($sModuleName, $sPage)
{
return utils::GetAbsoluteUrlModulesRoot().$sModuleName.'/'.$sPage;
}));
// Function to get the URL of a php page in a module
// Usage in twig: {{ get_page_module_url('itop-my-module', 'path-to-my-my-page.php') }}
$oTwigEnv->addFunction(new Twig_SimpleFunction('get_page_module_url', function($sModuleName, $sPage)
{
return utils::GetAbsoluteUrlModulePage($sModuleName, $sPage);
}));
}
}

View File

@@ -1,23 +1,28 @@
<?php
// Copyright (C) 2010-2017 Combodo SARL
//
// This file is part of iTop.
//
// iTop is free software; you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// iTop 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 Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with iTop. If not, see <http://www.gnu.org/licenses/>
/**
* Copyright (C) 2013-2020 Combodo SARL
*
* This file is part of iTop.
*
* iTop is free software; you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* iTop 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 Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
*/
require_once(APPROOT.'/application/webpage.class.inc.php');
require_once(APPROOT.'/application/displayblock.class.inc.php');
/**
* Class UIExtKeyWidget
* UI wdiget for displaying and editing external keys when
* UI widget for displaying and editing external keys when
* A simple drop-down list is not enough...
*
* The layout is the following
@@ -54,13 +59,7 @@
* | | +--------+ +-----+ | |
* | +--------------------------------------------+ |
* +------------------------------------------------+
* @copyright Copyright (C) 2010-2017 Combodo SARL
* @license http://opensource.org/licenses/AGPL-3.0
*/
require_once(APPROOT.'/application/webpage.class.inc.php');
require_once(APPROOT.'/application/displayblock.class.inc.php');
class UIExtKeyWidget
{
const ENUM_OUTPUT_FORMAT_CSV = 'csv';
@@ -72,7 +71,11 @@ class UIExtKeyWidget
protected $bSearchMode;
//public function __construct($sAttCode, $sClass, $sTitle, $oAllowedValues, $value, $iInputId, $bMandatory, $sNameSuffix = '', $sFieldPrefix = '', $sFormPrefix = '')
static public function DisplayFromAttCode($oPage, $sAttCode, $sClass, $sTitle, $oAllowedValues, $value, $iInputId, $bMandatory, $sFieldName = '', $sFormPrefix = '', $aArgs, $bSearchMode = false)
/**
* @since 2.7.7 3.0.1 3.1.0 N°3129 Add default value for $aArgs for PHP 8.0 compat
*/
public static function DisplayFromAttCode($oPage, $sAttCode, $sClass, $sTitle, $oAllowedValues, $value, $iInputId, $bMandatory, $sFieldName = '', $sFormPrefix = '', $aArgs = [], $bSearchMode = false)
{
$oAttDef = MetaModel::GetAttributeDef($sClass, $sAttCode);
$sTargetClass = $oAttDef->GetTargetClass();
@@ -274,7 +277,7 @@ EOF
// the input for the auto-complete
$sHTMLValue .= "<input class=\"field_autocomplete\" type=\"text\" id=\"label_$this->iId\" value=\"$sDisplayValue\"/>";
$sHTMLValue .= "<span class=\"field_input_btn\"><img id=\"mini_search_{$this->iId}\" style=\"border:0;vertical-align:middle;cursor:pointer;\" src=\"../images/mini_search.gif?t=".utils::GetCacheBusterTimestamp()."\" onClick=\"oACWidget_{$this->iId}.Search();\"/></span>";
$sHTMLValue .= "<span class=\"field_input_btn\"><div class=\"mini_button\" id=\"mini_search_{$this->iId}\" onClick=\"oACWidget_{$this->iId}.Search();\"><i class=\"fas fa-search\"></i></div></span>";
// another hidden input to store & pass the object's Id
$sHTMLValue .= "<input type=\"hidden\" id=\"$this->iId\" name=\"{$sAttrFieldPrefix}{$sFieldName}\" value=\"".htmlentities($value, ENT_QUOTES, 'UTF-8')."\" />\n";
@@ -298,7 +301,7 @@ EOF
}
if ($bExtensions && MetaModel::IsHierarchicalClass($this->sTargetClass) !== false)
{
$sHTMLValue .= "<span class=\"field_input_btn\"><img id=\"mini_tree_{$this->iId}\" style=\"border:0;vertical-align:middle;cursor:pointer;\" src=\"../images/mini_tree.gif?t=".utils::GetCacheBusterTimestamp()."\" onClick=\"oACWidget_{$this->iId}.HKDisplay();\"/></span>";
$sHTMLValue .= "<span class=\"field_input_btn\"><div class=\"mini_button\" id=\"mini_tree_{$this->iId}\" onClick=\"oACWidget_{$this->iId}.HKDisplay();\"><i class=\"fas fa-sitemap\"></i></div></span>";
$oPage->add_ready_script(
<<<EOF
if ($('#ac_tree_{$this->iId}').length == 0)
@@ -312,7 +315,7 @@ EOF
{
$sCallbackName = (MetaModel::IsAbstract($this->sTargetClass)) ? 'SelectObjectClass' : 'CreateObject';
$sHTMLValue .= "<span class=\"field_input_btn\"><img id=\"mini_add_{$this->iId}\" style=\"border:0;vertical-align:middle;cursor:pointer;\" src=\"../images/mini_add.gif?t=".utils::GetCacheBusterTimestamp()."\" onClick=\"oACWidget_{$this->iId}.{$sCallbackName}();\"/></span>";
$sHTMLValue .= "<span class=\"field_input_btn\"><div class=\"mini_button\" id=\"mini_add_{$this->iId}\" onClick=\"oACWidget_{$this->iId}.{$sCallbackName}();\"><i class=\"fas fa-plus\"></i></div></span>";
$oPage->add_ready_script(
<<<EOF
if ($('#ajax_{$this->iId}').length == 0)
@@ -427,8 +430,10 @@ EOF
*
* @throws CoreException
* @throws OQLException
*
* @since 2.7.7 3.0.1 3.1.0 N°3129 Remove default value for $oObj for PHP 8.0 compatibility
*/
public function AutoComplete(WebPage $oP, $sFilter, $oObj = null, $sContains, $sOutputFormat = self::ENUM_OUTPUT_FORMAT_CSV, $sOperation = null)
public function AutoComplete(WebPage $oP, $sFilter, $oObj, $sContains, $sOutputFormat = self::ENUM_OUTPUT_FORMAT_CSV, $sOperation = null)
{
if (is_null($sFilter))
{
@@ -578,8 +583,21 @@ EOF
$oNewObj->UpdateObjectFromArg('default');
$sDialogTitle = '';
$oPage->add('<div id="ac_create_'.$this->iId.'"><div class="wizContainer" style="vertical-align:top;"><div id="dcr_'.$this->iId.'">');
$oPage->add("<h1>".MetaModel::GetClassIcon($this->sTargetClass)."&nbsp;".Dict::Format('UI:CreationTitle_Class', MetaModel::GetName($this->sTargetClass))."</h1>\n");
$sClassLabel = MetaModel::GetName($this->sTargetClass);
$sClassIcon = MetaModel::GetClassIcon($this->sTargetClass);
$sObjClass = get_class($oNewObj);
$sObjKey = $oNewObj->GetKey();
$sHeaderTitle = Dict::Format('UI:CreationTitle_Class', $sClassLabel);
$oPage->add(<<<HTML
<div id="ac_create_{$this->iId}">
<!-- Beginning of object-details -->
<div class="object-details" data-object-class="$sObjClass" data-object-id="$sObjKey" data-object-mode="create">
<!-- Beginning of wizContainer -->
<div class="wizContainer" style="vertical-align:top;">
<div id="dcr_{$this->iId}">
<h1>$sClassIcon&nbsp;$sHeaderTitle</h1>
HTML
);
$aFieldsFlags = array();
$aFieldsComments = array();
foreach(MetaModel::ListAttributeDefs($this->sTargetClass) as $sAttCode => $oAttDef)
@@ -591,7 +609,13 @@ EOF
}
}
cmdbAbstractObject::DisplayCreationForm($oPage, $this->sTargetClass, $oNewObj, array(), array('formPrefix' => $this->iId, 'noRelations' => true, 'fieldsFlags' => $aFieldsFlags, 'fieldsComments' => $aFieldsComments));
$oPage->add('</div></div></div>');
$oPage->add(<<<HTML
</div>
</div><!-- End of wizContainer -->
</div><!-- End of object-details -->
</div>
HTML
);
// $oPage->add_ready_script("\$('#ac_create_$this->iId').dialog({ width: $(window).width()*0.8, height: 'auto', autoOpen: false, modal: true, title: '$sDialogTitle'});\n");
$oPage->add_ready_script("\$('#ac_create_$this->iId').dialog({ width: 'auto', height: 'auto', maxHeight: $(window).height() - 50, autoOpen: false, modal: true, title: '$sDialogTitle'});\n");
$oPage->add_ready_script("$('#dcr_{$this->iId} form').removeAttr('onsubmit');");
@@ -618,15 +642,22 @@ EOF
$oSet->SetShowObsoleteData(utils::ShowObsoleteData());
$sHKAttCode = MetaModel::IsHierarchicalClass($this->sTargetClass);
$this->DumpTree($oPage, $oSet, $sHKAttCode, $currValue);
$bHasChildLeafs = $this->DumpTree($oPage, $oSet, $sHKAttCode, $currValue);
$oPage->add('</td></tr></table>');
$oPage->add('</div>');
if ($bHasChildLeafs)
{
$oPage->add('<div class="treecontrol" id="treecontrolid"><a href="?#">'.Dict::S("UI:Treeview:CollapseAll").'</a> | <a href="?#">'.Dict::S("UI:Treeview:ExpandAll").'</a></div>');
}
$oPage->add("<input type=\"button\" id=\"btn_cancel_{$this->iId}\" value=\"".Dict::S('UI:Button:Cancel')."\" onClick=\"$('#dlg_tree_{$this->iId}').dialog('close');\">&nbsp;&nbsp;");
$oPage->add("<input type=\"button\" id=\"btn_ok_{$this->iId}\" value=\"".Dict::S('UI:Button:Ok')."\" onClick=\"oACWidget_{$this->iId}.DoHKOk();\">");
$oPage->add('</div></div>');
$oPage->add_ready_script("\$('#tree_$this->iId ul').treeview();\n");
$oPage->add_ready_script("\$('#tree_$this->iId ul').treeview({ control: '#treecontrolid', persist: 'false'});\n");
$oPage->add_ready_script("\$('#dlg_tree_$this->iId').dialog({ width: 'auto', height: 'auto', autoOpen: true, modal: true, title: '$sDialogTitle', resizeStop: oACWidget_{$this->iId}.OnHKResize, close: oACWidget_{$this->iId}.OnHKClose });\n");
}
@@ -655,6 +686,18 @@ EOF
}
}
/**
* @param WebPage $oP
* @param \DBObjectSet $oSet
* @param string $sParentAttCode
* @param string $currValue
*
* @return bool true if there are at least one child leaf, false if only roots nodes are present
* @throws \ArchivedObjectException
* @throws \CoreException
* @throws \CoreUnexpectedValue
* @throws \MySQLException
*/
function DumpTree($oP, $oSet, $sParentAttCode, $currValue)
{
$aTree = array();
@@ -683,6 +726,9 @@ EOF
{
$this->DumpNodes($oP, $iRootId, $aTree, $aNodes, $currValue);
}
$bHasOnlyRootNodes = (count($aTree) === 1);
return !$bHasOnlyRootNodes;
}
function DumpNodes($oP, $iRootId, $aTree, $aNodes, $currValue)
@@ -710,7 +756,7 @@ EOF
$sSelect = '<input id="input_'.$fUniqueId.'_'.$aNodes[$id]->GetKey().'" type="radio" value="'.$aNodes[$id]->GetKey().'" name="selectObject" '.$sChecked.'>&nbsp;';
}
}
$oP->add('<li>'.$sSelect.'<label for="input_'.$fUniqueId.'_'.$aNodes[$id]->GetKey().'">'.$aNodes[$id]->GetName().'</label>');
$oP->add('<li class="closed">'.$sSelect.'<label for="input_'.$fUniqueId.'_'.$aNodes[$id]->GetKey().'">'.$aNodes[$id]->GetName().'</label>');
$this->DumpNodes($oP, $id, $aTree, $aNodes, $currValue);
$oP->add("</li>\n");
}

View File

@@ -74,7 +74,7 @@ class UIHTMLEditorWidget
$sLanguage = strtolower(trim(UserRights::GetUserLanguage()));
$aConfig['language'] = $sLanguage;
$aConfig['contentsLanguage'] = $sLanguage;
$aConfig['extraPlugins'] = 'disabler';
$aConfig['extraPlugins'] = 'disabler,codesnippet';
$sWidthSpec = addslashes(trim($this->m_oAttDef->GetWidth()));
if ($sWidthSpec != '')
{

View File

@@ -85,9 +85,15 @@ class UILinksWidgetDirect
* @param array $aArgs
* @param string $sFormPrefix
* @param DBObject $oCurrentObj
*
* @since 2.7.7 3.0.1 3.1.0 N°3129 Remove default value for $aArgs for PHP 8.0 compatibility (handling wrong values at method start)
*/
public function Display(WebPage $oPage, $oValue, $aArgs = array(), $sFormPrefix, $oCurrentObj)
public function Display(WebPage $oPage, $oValue, $aArgs, $sFormPrefix, $oCurrentObj)
{
if (empty($aArgs)) {
$aArgs = [];
}
$oLinksetDef = MetaModel::GetAttributeDef($this->sClass, $this->sAttCode);
switch($oLinksetDef->GetEditMode())
{
@@ -137,8 +143,10 @@ class UILinksWidgetDirect
* @param string $sFormPrefix
* @param DBObject $oCurrentObj
* @param bool $bDisplayMenu
*
* @since 2.7.7 3.0.1 3.1.0 N°3129 Remove default value for $aArgs for PHP 8.0 compatibility (protected method, always called with default value)
*/
protected function DisplayAsBlock(WebPage $oPage, $oValue, $aArgs = array(), $sFormPrefix, $oCurrentObj, $bDisplayMenu)
protected function DisplayAsBlock(WebPage $oPage, $oValue, $aArgs, $sFormPrefix, $oCurrentObj, $bDisplayMenu)
{
$oLinksetDef = MetaModel::GetAttributeDef($this->sClass, $this->sAttCode);
$sTargetClass = $oLinksetDef->GetLinkedClass();
@@ -239,8 +247,10 @@ class UILinksWidgetDirect
* @param string $sFormPrefix
* @param DBObject $oCurrentObj
* @param array $aButtons
*
* @since 2.7.7 3.0.1 3.1.0 N°3129 Remove default value for $aArgs for PHP 8.0 compatibility (protected method, caller already handles it)
*/
protected function DisplayEditInPlace(WebPage $oPage, $oValue, $aArgs = array(), $sFormPrefix, $oCurrentObj, $aButtons = array('create', 'delete'))
protected function DisplayEditInPlace(WebPage $oPage, $oValue, $aArgs, $sFormPrefix, $oCurrentObj, $aButtons = array('create', 'delete'))
{
$aAttribs = $this->GetTableConfig();

View File

@@ -346,7 +346,7 @@ EOF
* @throws \CoreException
* @throws \DictExceptionMissingString
*/
public function Display(WebPage $oPage, $oValue, $aArgs = array(), $sFormPrefix, $oCurrentObj)
public function Display(WebPage $oPage, $oValue, $aArgs, $sFormPrefix, $oCurrentObj)
{
$sHtmlValue = '';
$sHtmlValue .= "<div id=\"linkedset_{$this->m_sAttCode}{$this->m_sNameSuffix}\">\n";

View File

@@ -34,7 +34,7 @@ require_once(APPROOT.'/core/userrights.class.inc.php');
*/
class appUserPreferences extends DBObject
{
static $oUserPrefs = null; // Local cache
private static $oUserPrefs = null; // Local cache
/**
* Get the value of the given property/preference
@@ -43,7 +43,7 @@ class appUserPreferences extends DBObject
* @param string $sDefaultValue The default value
* @return string The value of the property for the current user
*/
static function GetPref($sCode, $sDefaultValue)
public static function GetPref($sCode, $sDefaultValue)
{
if (self::$oUserPrefs == null)
{
@@ -65,7 +65,7 @@ class appUserPreferences extends DBObject
* @param string $sCode Code/Name of the property/preference to set
* @param string $sValue Value to set
*/
static function SetPref($sCode, $sValue)
public static function SetPref($sCode, $sValue)
{
if (self::$oUserPrefs == null)
{
@@ -83,13 +83,13 @@ class appUserPreferences extends DBObject
self::Save();
}
}
/**
* Clears the value for a given preference (or list of preferences that matches a pattern), and updates the database
* @param string $sPattern Code/Pattern of the properties/preferences to reset
* @param string $sCodeOrPattern Code/Pattern of the properties/preferences to reset
* @param boolean $bPattern Whether or not the supplied code is a PCRE pattern
*/
static function UnsetPref($sCodeOrPattern, $bPattern = false)
public static function UnsetPref($sCodeOrPattern, $bPattern = false)
{
if (self::$oUserPrefs == null)
{
@@ -124,7 +124,7 @@ class appUserPreferences extends DBObject
* Call this function to get all the preferences for the user, packed as a JSON object
* @return string JSON representation of the preferences
*/
static function GetAsJSON()
public static function GetAsJSON()
{
if (self::$oUserPrefs == null)
{
@@ -137,19 +137,19 @@ class appUserPreferences extends DBObject
/**
* Call this function if the user has changed (like when doing a logoff...)
*/
static public function ResetPreferences()
public static function ResetPreferences()
{
self::$oUserPrefs = null;
}
/**
* Call this function to ERASE all the preferences from the current user
*/
static public function ClearPreferences()
public static function ClearPreferences()
{
self::$oUserPrefs = null;
}
static protected function Save()
protected static function Save()
{
if (self::$oUserPrefs != null)
{
@@ -166,7 +166,7 @@ class appUserPreferences extends DBObject
* Loads the preferences for the current user, creating the record in the database
* if needed
*/
static protected function Load()
protected static function Load()
{
if (self::$oUserPrefs != null) return;
$oSearch = new DBObjectSearch('appUserPreferences');

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -273,10 +273,6 @@ class WizardHelper
static public function FromJSON($sJSON)
{
$oWizHelper = new WizardHelper();
if (get_magic_quotes_gpc())
{
$sJSON = stripslashes($sJSON);
}
$aData = json_decode($sJSON, true); // true means hash array instead of object
$oWizHelper->m_aData = $aData;
return $oWizHelper;

View File

@@ -42,14 +42,22 @@ class XMLPage extends WebPage
parent::__construct($s_title);
$this->m_bPassThrough = $bPassThrough;
$this->m_bHeaderSent = false;
$this->add_header("Content-type: text/xml; charset=utf-8");
$this->add_header('Cache-control: no-cache, no-store, must-revalidate');
$this->add_header('Pragma: no-cache');
$this->add_header('Expires: 0');
$this->add_header('X-Frame-Options: deny');
$this->add_header("Content-type: text/xml; charset=".self::PAGES_CHARSET);
$this->no_cache();
$this->add_http_headers();
$this->add_header("Content-location: export.xml");
}
/**
* Disabling sending the header so that resource won't be blocked by CORB. See parent method documentation.
* @return void
* @since 2.7.10 3.0.4 3.1.2 3.2.0 N°4368 method creation
*/
public function add_xcontent_type_options()
{
// Nothing to do !
}
public function output()
{
if (!$this->m_bPassThrough)
@@ -57,7 +65,8 @@ class XMLPage extends WebPage
// Get the unexpected output but do nothing with it
$sTrash = $this->ob_get_clean_safe();
$this->s_content = "<?xml version=\"1.0\" encoding=\"UTF-8\"?".">\n".trim($this->s_content);
$sCharset = self::PAGES_CHARSET;
$this->s_content = "<?xml version=\"1.0\" encoding=\"$sCharset\"?".">\n".trim($this->s_content);
$this->add_header("Content-Length: ".strlen($this->s_content));
foreach($this->a_headers as $s_header)
{
@@ -90,7 +99,8 @@ class XMLPage extends WebPage
{
header($s_header);
}
echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?".">\n";
$sCharset = self::PAGES_CHARSET;
echo "<?xml version=\"1.0\" encoding=\"$sCharset\"?".">\n";
echo trim($s_captured_output);
echo trim($this->s_content);
echo $sText;

View File

@@ -2,14 +2,19 @@
define('APPROOT', dirname(__FILE__).'/');
define('APPCONF', APPROOT.'conf/');
define('ITOP_DEFAULT_ENV', 'production');
if (function_exists('microtime'))
{
$fItopStarted = microtime(true);
}
else
{
$fItopStarted = 1000 * time();
}
?>
/**
* Constant containing the iTop core version, whatever application was built
*
* Note that in iTop 3.0.0 we used {@see ITOP_DESIGN_LATEST_VERSION} to get core version.
* When releasing, both constants should be updated : see `.make/release/update-versions.php` for that !
*
* @since 2.7.7 3.0.1 3.1.0 N°4714 constant creation
* @used-by utils::GetItopVersionWikiSyntax()
* @used-by iTopModulesPhpVersionIntegrationTest
*/
define('ITOP_CORE_VERSION', '2.7.12');
require_once APPROOT.'bootstrap.inc.php';

87
bootstrap.inc.php Normal file
View File

@@ -0,0 +1,87 @@
<?php
/**
* Copyright (C) 2013-2019 Combodo SARL
*
* This file is part of iTop.
*
* iTop is free software; you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* iTop 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 Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
*/
define('ITOP_DEFAULT_ENV', 'production');
define('MAINTENANCE_MODE_FILE', APPROOT.'data/.maintenance');
define('READONLY_MODE_FILE', APPROOT.'data/.readonly');
$fItopStarted = microtime(true);
$iItopInitialMemory = memory_get_usage(true);
if (! isset($GLOBALS['bBypassAutoload']) || $GLOBALS['bBypassAutoload'] == false)
{
require_once APPROOT.'/lib/autoload.php';
}
//
// Maintenance mode
//
// Use 'maintenance' parameter to bypass maintenance mode
if (!isset($bBypassMaintenance))
{
$bBypassMaintenance = isset($_REQUEST['maintenance']) ? boolval($_REQUEST['maintenance']) : false;
}
if (file_exists(MAINTENANCE_MODE_FILE) && !$bBypassMaintenance)
{
$sTitle = 'Maintenance';
$sMessage = 'This application is currently under maintenance.';
http_response_code(503);
// Display message depending on the request
include(APPROOT.'application/maintenancemsg.php');
$sSAPIName = strtoupper(trim(PHP_SAPI));
switch (true)
{
case isset($_SERVER['REQUEST_URI']) && EndsWith($_SERVER['REQUEST_URI'], '/pages/ajax.searchform.php'):
_MaintenanceHtmlMessage($sMessage);
break;
case $sSAPIName == 'CLI':
case array_key_exists('HTTP_X_COMBODO_AJAX', $_SERVER):
case isset($_SERVER['REQUEST_URI']) && (strpos($_SERVER['REQUEST_URI'], '/webservices/soapserver.php') !== false):
case isset($_SERVER['REQUEST_URI']) && (strpos($_SERVER['REQUEST_URI'], '/webservices/export-v2.php') !== false):
_MaintenanceTextMessage($sMessage);
break;
case isset($_SERVER['REQUEST_URI']) && (strpos($_SERVER['REQUEST_URI'], '/webservices/rest.php') !== false):
case isset($_SERVER['CONTENT_TYPE']) && ($_SERVER['CONTENT_TYPE'] == 'application/json'):
_MaintenanceJsonMessage($sTitle, $sMessage);
break;
default:
_MaintenanceSetupPageMessage($sTitle, $sMessage);
break;
}
exit();
}
/**
* helper to test if a string ends with another
* @param $haystack
* @param $needle
*
* @return bool
*/
function EndsWith($haystack, $needle) {
return substr_compare($haystack, $needle, -strlen($needle)) === 0;
}

View File

@@ -1,13 +1,40 @@
{
"name": "combodo/itop",
"description": "IT Operations Portal",
"type": "project",
"license": "AGPL-3.0-only",
"require": {
"php": ">=5.6.0",
"ext-soap": "*",
"ext-json": "*",
"ext-zip": "*",
"ext-mysqli": "*",
"php": ">=7.1.3",
"ext-ctype": "*",
"ext-dom": "*",
"ext-gd": "*",
"ext-iconv": "*",
"ext-gd": "*"
"ext-json": "*",
"ext-mysqli": "*",
"ext-soap": "*",
"combodo/tcpdf": "~6.4.4",
"firebase/php-jwt": "~6.4.0",
"guzzlehttp/guzzle": "^6.5.8",
"guzzlehttp/psr7": "~1.9.1",
"laminas/laminas-mail": "^2.11",
"laminas/laminas-servicemanager": "^3.5",
"league/oauth2-google": "^3.0",
"nikic/php-parser": "~4.13.2",
"pear/archive_tar": "~1.4.14",
"pelago/emogrifier": "~3.1.0",
"scssphp/scssphp": "1.0.6",
"swiftmailer/swiftmailer": "~6.3.0",
"symfony/console": "~3.4.47",
"symfony/dotenv": "~3.4.47",
"symfony/framework-bundle": "~3.4.47",
"symfony/twig-bundle": "~3.4.47",
"symfony/yaml": "~3.4.47",
"thenetworg/oauth2-azure": "^2.0",
"twig/twig": "~1.42.5"
},
"require-dev": {
"symfony/stopwatch": "~3.4.47",
"symfony/web-profiler-bundle": "~3.4.47"
},
"suggest": {
"ext-libsodium": "Required to use the AttributeEncryptedString.",
@@ -19,7 +46,51 @@
},
"config": {
"platform": {
"php": "5.6.0"
"php": "7.1.3"
},
"vendor-dir": "lib",
"preferred-install": {
"*": "dist"
},
"sort-packages": true,
"classmap-authoritative": true
},
"autoload": {
"classmap": [
"core",
"application",
"sources/application",
"sources/Composer",
"sources/Controller",
"sources/Service",
"sources/Core"
],
"exclude-from-classmap": [
"core/dbobjectsearch.class.php",
"core/legacy/dbobjectsearchlegacy.class.php",
"core/querybuildercontext.class.inc.php",
"core/legacy/querybuildercontextlegacy.class.inc.php",
"core/querybuilderexpressions.class.inc.php",
"core/legacy/querybuilderexpressionslegacy.class.inc.php",
"application/loginform.class.inc.php",
"application/loginbasic.class.inc.php",
"application/logindefault.class.inc.php",
"application/loginexternal.class.inc.php",
"application/loginurl.class.inc.php"
]
},
"conflict": {
"symfony/symfony": "*"
},
"extra": {
"symfony": {
"allow-contrib": false,
"require": "3.4.*"
}
},
"scripts": {
"post-install-cmd": ["@rmDeniedTestDir"],
"post-update-cmd": ["@rmDeniedTestDir"],
"rmDeniedTestDir": "@php .make/composer/rmDeniedTestDir.php"
}
}
}

5876
composer.lock generated

File diff suppressed because it is too large Load Diff

2
composer.readme Normal file
View File

@@ -0,0 +1,2 @@
To regenerate the autoload, run:
composer dump-autoload -a

2
conf/index.php Normal file
View File

@@ -0,0 +1,2 @@
<?php
echo 'Access denied';

View File

@@ -1,105 +0,0 @@
# Contributing to iTop
You want to contribute to iTop? Many thanks to you! 🎉 👍
Here are some guidelines that will help us integrate your work!
## Contributions
### Subjects
You are welcome to create pull requests on any of those subjects:
* 🐛 `:bug:` bug fix
* 🔒 `:lock:` security
* 🌐 `:globe_with_meridians:` translation / i18n / l10n
If you want to implement a **new feature**, please [create a corresponding ticket](https://sourceforge.net/p/itop/tickets/new/) for review.
If you ever want to begin implementation, do so in a fork, and add a link to the corresponding commits in the ticket.
### License
iTop is distributed under the AGPL-3.0 license (see the [license.txt] file),
your code must comply with this license.
If you want to use another license, you may [create an extension][wiki new ext].
[license.txt]: https://github.com/Combodo/iTop/blob/develop/license.txt
[wiki new ext]: https://www.itophub.io/wiki/page?id=latest%3Acustomization%3Astart#by_writing_your_own_extension
## Branch model
TL;DR:
> **create a fork from iTop main repository,
> create a branch based on either release branch if present, or develop otherwise**
We are using the [GitFlow](https://nvie.com/posts/a-successful-git-branching-model/) branch model. That means we have in our repo those
main branches:
- develop: ongoing development version
- release/\*: if present, that means we are working on a beta version
- master: previous stable version
For example, if no beta version is currently ongoing we could have:
- develop containing future 2.8.0 version
- master containing 2.7.x maintenance version
In this example, when 2.8.0-beta is shipped that will become:
- develop: future 2.9.0 version
- release/2.8: 2.8.0-beta
- master: 2.7.x maintenance version
And when 2.8.0 final will be out:
- develop: future 2.9.0 version
- master: 2.8.x maintenance version
- support/2.7 : 2.7.x maintenance version
## Coding
### PHP styleguide
Please follow [our guidelines](https://www.itophub.io/wiki/page?id=latest%3Acustomization%3Acoding_standards).
### 🌐 Translations
A [dedicated page](https://www.itophub.io/wiki/page?id=latest%3Acustomization%3Atranslation) is available in the official wiki.
### Tests
Please create tests that covers as much as possible the code you're submitting.
Our tests are located in the `test/` directory, containing a PHPUnit config file : `phpunit.xml.dist`.
### Git Commit Messages
* Describe the functional change instead of the technical modifications
* Use the present tense ("Add feature" not "Added feature")
* Use the imperative mood ("Move cursor to..." not "Moves cursor to...")
* Limit the first line to 72 characters or less
* Please start the commit message with an applicable emoji code (following the [Gitmoji guide](https://gitmoji.carloscuesta.me/)). For example :
* 🌐 `:globe_with_meridians:` for translations
* 🎨 `:art:` when improving the format/structure of the code
* ⚡️ `:zap:` when improving performance
* 🐛 `:bug:` when fixing a bug
* 🔥 `:fire:` when removing code or files
* 💚 `:green_heart:` when fixing the CI build
*`:white_check_mark:` when adding tests
* 🔒 `:lock:` when dealing with security
* ⬆️ `:arrow_up:` when upgrading dependencies
* ⬇️ `:arrow_down:` when downgrading dependencies
* ♻️ `:recycle:` code refactoring
* 💄 `:lipstick:` Updating the UI and style files.
## Pull request
When your code is working, please:
* stash as much as possible your commits,
* rebase your branch on our repo last commit,
* create a pull request.
Detailed procedure to work on fork and create PR is available [in GitHub help pages](https://help.github.com/articles/creating-a-pull-request-from-a-fork/).

View File

@@ -67,8 +67,7 @@ class MyHelpers
// format sss.mmmuuupppnnn
public static function getmicrotime()
{
list($usec, $sec) = explode(" ",microtime());
return ((float)$usec + (float)$sec);
return microtime(true);
}
/*
@@ -420,6 +419,7 @@ class MyHelpers
//}
return $sOutput;
}
}
/**
@@ -457,7 +457,7 @@ class Str
public static function gpc2pure($gpc)
{
if (ini_get('magic_quotes_sybase')) $pure = str_replace("''", "'", $gpc);
else $pure = get_magic_quotes_gpc() ? stripslashes($gpc) : $gpc;
else $pure = $gpc;
return $pure;
}
public static function html2pure($html)
@@ -524,5 +524,3 @@ class Str
return (strtolower($sString) == $sString);
}
}
?>

View File

@@ -179,7 +179,7 @@ class ActionEmail extends ActionNotification
protected function FindRecipients($sRecipAttCode, $aArgs)
{
$sOQL = $this->Get($sRecipAttCode);
if (strlen($sOQL) == '') return '';
if (strlen($sOQL) === 0) return '';
try
{
@@ -328,8 +328,12 @@ class ActionEmail extends ActionNotification
$sBody = MetaModel::ApplyParams($this->Get('body'), $aContextArgs);
$oObj = $aContextArgs['this->object()'];
$sMessageId = sprintf('iTop_%s_%d_%f@%s.openitop.org', get_class($oObj), $oObj->GetKey(), microtime(true /* get as float*/),
MetaModel::GetEnvironmentId());
$sMessageId = sprintf('iTop_%s_%d_%F@%s.openitop.org',
get_class($oObj),
$oObj->GetKey(),
microtime(true /* get as float*/),
MetaModel::GetEnvironmentId()
);
$sReference = '<'.$sMessageId.'>';
}
catch (Exception $e) {

View File

@@ -166,7 +166,14 @@ class apcFile
}
else
{
if (!@unlink($sCache))
if (is_file($sCache))
{
if (!@unlink($sCache))
{
return false;
}
}
else
{
return false;
}
@@ -209,8 +216,14 @@ class apcFile
return false;
}
@unlink(self::GetCacheFileName($sKey));
@unlink(self::GetCacheFileName('-'.$sKey));
if (is_file(self::GetCacheFileName($sKey)))
{
@unlink(self::GetCacheFileName($sKey));
}
if (is_file(self::GetCacheFileName('-'.$sKey)))
{
@unlink(self::GetCacheFileName('-'.$sKey));
}
if ($iTTL > 0)
{
// hint for ttl management
@@ -312,6 +325,10 @@ class apcFile
*/
static protected function ReadCacheLocked($sFilename)
{
if (!is_file($sFilename))
{
return false;
}
$file = @fopen($sFilename, 'r');
if ($file === false)
{

View File

@@ -0,0 +1,42 @@
<?php
/**
* Class ApcService
* @since 2.7.6 N°4125
*/
class ApcService {
public function __construct() {
}
/**
* @param string $function_name
* @return bool
* @see function_exists()
*/
public function function_exists($function_name) {
return function_exists($function_name);
}
/**
* @param string|array $key
* @return mixed
* @see apc_fetch()
*/
function apc_fetch($key)
{
return apc_fetch($key);
}
/**
* @param array|string $key
* @param $var
* @param int $ttl
* @return array|bool
* @see apc_store()
*/
function apc_store($key, $var = NULL, $ttl = 0)
{
return apc_store($key, $var, $ttl);
}
}
?>

View File

@@ -1,335 +0,0 @@
<?php
// Copyright (C) 2010-2012 Combodo SARL
//
// This file is part of iTop.
//
// iTop is free software; you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// iTop 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 Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with iTop. If not, see <http://www.gnu.org/licenses/>
/**
* Utility to import/export the DB from/to a ZIP file
*
* @copyright Copyright (C) 2010-2012 Combodo SARL
* @license http://opensource.org/licenses/AGPL-3.0
*/
/**
* iTopArchive a class to manipulate (read/write) iTop archives with their catalog
* Each iTop archive is a zip file that contains (at the root of the archive)
* a file called catalog.xml holding the description of the archive
*/
class iTopArchive
{
const read = 0;
const create = ZipArchive::CREATE;
protected $m_sZipPath;
protected $m_oZip;
protected $m_sVersion;
protected $m_sTitle;
protected $m_sDescription;
protected $m_aPackages;
protected $m_aErrorMessages;
/**
* Construct an iTopArchive object
* @param $sArchivePath string The full path the archive file
* @param $iMode integrer Either iTopArchive::read for reading an existing archive or iTopArchive::create for creating a new one. Updating is not supported (yet)
*/
public function __construct($sArchivePath, $iMode = iTopArchive::read)
{
$this->m_sZipPath = $sArchivePath;
$this->m_oZip = new ZipArchive();
$this->m_oZip->open($this->m_sZipPath, $iMode);
$this->m_aErrorMessages = array();
$this->m_sVersion = '1.0';
$this->m_sTitle = '';
$this->m_sDescription = '';
$this->m_aPackages = array();
}
public function SetTitle($sTitle)
{
$this->m_sTitle = $sTitle;
}
public function SetDescription($sDescription)
{
$this->m_sDescription = $sDescription;
}
public function GetTitle()
{
return $this->m_sTitle;
}
public function GetDescription()
{
return $this->m_sDescription;
}
public function GetPackages()
{
return $this->m_aPackages;
}
public function __destruct()
{
$this->m_oZip->close();
}
/**
* Get the error message explaining the latest error encountered
* @return array All the error messages encountered during the validation
*/
public function GetErrors()
{
return $this->m_aErrorMessages;
}
/**
* Read the catalog from the archive (zip) file
* @param sPath string Path the the zip file
* @return boolean True in case of success, false otherwise
*/
public function ReadCatalog()
{
if ($this->IsValid())
{
$sXmlCatalog = $this->m_oZip->getFromName('catalog.xml');
$oParser = xml_parser_create();
xml_parse_into_struct($oParser, $sXmlCatalog, $aValues, $aIndexes);
xml_parser_free($oParser);
$iIndex = $aIndexes['ARCHIVE'][0];
$this->m_sVersion = $aValues[$iIndex]['attributes']['VERSION'];
$iIndex = $aIndexes['TITLE'][0];
$this->m_sTitle = $aValues[$iIndex]['value'];
$iIndex = $aIndexes['DESCRIPTION'][0];
if (array_key_exists('value', $aValues[$iIndex]))
{
// #@# implement a get_array_value(array, key, default) ?
$this->m_sDescription = $aValues[$iIndex]['value'];
}
foreach($aIndexes['PACKAGE'] as $iIndex)
{
$this->m_aPackages[$aValues[$iIndex]['attributes']['HREF']] = array( 'type' => $aValues[$iIndex]['attributes']['TYPE'], 'title'=> $aValues[$iIndex]['attributes']['TITLE'], 'description' => $aValues[$iIndex]['value']);
}
//echo "Archive path: {$this->m_sZipPath}<br/>\n";
//echo "Archive format version: {$this->m_sVersion}<br/>\n";
//echo "Title: {$this->m_sTitle}<br/>\n";
//echo "Description: {$this->m_sDescription}<br/>\n";
//foreach($this->m_aPackages as $aFile)
//{
// echo "{$aFile['title']} ({$aFile['type']}): {$aFile['description']}<br/>\n";
//}
}
return true;
}
public function WriteCatalog()
{
$sXml = "<?xml version=\"1.0\" encoding=\"utf-8\"?".">\n"; // split the XML closing tag that disturbs PSPad's syntax coloring
$sXml .= "<archive version=\"1.0\">\n";
$sXml .= "<title>{$this->m_sTitle}</title>\n";
$sXml .= "<description>{$this->m_sDescription}</description>\n";
foreach($this->m_aPackages as $sFileName => $aFile)
{
$sXml .= "<package title=\"{$aFile['title']}\" type=\"{$aFile['type']}\" href=\"$sFileName\">{$aFile['description']}</package>\n";
}
$sXml .= "</archive>";
$this->m_oZip->addFromString('catalog.xml', $sXml);
}
/**
* Add a package to the archive
* @param string $sExternalFilePath The path to the file to be added to the archive as a package (directories are not yet implemented)
* @param string $sFilePath The name of the file inside the archive
* @param string $sTitle A short title for this package
* @param string $sType Type of the package. SQL scripts must be of type 'text/sql'
* @param string $sDescription A longer description of the purpose of this package
* @return none
*/
public function AddPackage($sExternalFilePath, $sFilePath, $sTitle, $sType, $sDescription)
{
$this->m_aPackages[$sFilePath] = array('title' => $sTitle, 'type' => $sType, 'description' => $sDescription);
$this->m_oZip->addFile($sExternalFilePath, $sFilePath);
}
/**
* Reads the contents of the given file from the archive
* @param string $sFileName The path to the file inside the archive
* @return string The content of the file read from the archive
*/
public function GetFileContents($sFileName)
{
return $this->m_oZip->getFromName($sFileName);
}
/**
* Extracts the contents of the given file from the archive
* @param string $sFileName The path to the file inside the archive
* @param string $sDestinationFileName The path of the file to write
* @return none
*/
public function ExtractToFile($sFileName, $sDestinationFileName)
{
$iBufferSize = 64 * 1024; // Read 64K at a time
$oZipStream = $this->m_oZip->getStream($sFileName);
$oDestinationStream = fopen($sDestinationFileName, 'wb');
while (!feof($oZipStream)) {
$sContents = fread($oZipStream, $iBufferSize);
fwrite($oDestinationStream, $sContents);
}
fclose($oZipStream);
fclose($oDestinationStream);
}
/**
* Apply a SQL script taken from the archive. The package must be listed in the catalog and of type text/sql
* @param string $sFileName The path to the SQL package inside the archive
* @return boolean false in case of error, true otherwise
*/
public function ImportSql($sFileName, $sDatabase = 'itop')
{
if ( ($this->m_oZip->locateName($sFileName) == false) || (!isset($this->m_aPackages[$sFileName])) || ($this->m_aPackages[$sFileName]['type'] != 'text/sql'))
{
// invalid type or not listed in the catalog
return false;
}
$sTempName = tempnam("../tmp/", "sql");
//echo "Extracting to: '$sTempName'<br/>\n";
$this->ExtractToFile($sFileName, $sTempName);
// Note: the command line below works on Windows with the right path to mysql !!!
$sCommandLine = 'type "'.$sTempName.'" | "/iTop/MySQL Server 5.0/bin/mysql.exe" -u root '.$sDatabase;
//echo "Executing: '$sCommandLine'<br/>\n";
exec($sCommandLine, $aOutput, $iRet);
//echo "Return code: $iRet<br/>\n";
//echo "Output:<br/><pre>\n";
//print_r($aOutput);
//echo "</pre><br/>\n";
unlink($sTempName);
return ($iRet == 0);
}
/**
* Dumps some part of the specified MySQL database into the archive as a text/sql package
* @param $sTitle string A short title for this SQL script
* @param $sDescription string A longer description of the purpose of this SQL script
* @param $sFileName string The name of the package inside the archive
* @param $sDatabase string name of the database
* @param $aTables array array or table names. If empty, all tables are dumped
* @param $bStructureOnly boolean Whether or not to dump the data or just the schema
* @return boolean False in case of error, true otherwise
*/
public function AddDatabaseDump($sTitle, $sDescription, $sFileName, $sDatabase = 'itop', $aTables = array(), $bStructureOnly = true)
{
$sTempName = tempnam("../tmp/", "sql");
$sNoData = $bStructureOnly ? "--no-data" : "";
$sCommandLine = "\"/iTop/MySQL Server 5.0/bin/mysqldump.exe\" --user=root --opt $sNoData --result-file=$sTempName $sDatabase ".implode(" ", $aTables);
//echo "Executing command: '$sCommandLine'<br/>\n";
exec($sCommandLine, $aOutput, $iRet);
//echo "Return code: $iRet<br/>\n";
//echo "Output:<br/><pre>\n";
//print_r($aOutput);
//echo "</pre><br/>\n";
if ($iRet == 0)
{
$this->AddPackage($sTempName, $sFileName, $sTitle, 'text/sql', $sDescription);
}
//unlink($sTempName);
return ($iRet == 0);
}
/**
* Check the consistency of the archive
* @return boolean True if the archive file is consistent
*/
public function IsValid()
{
// TO DO: use a DTD to validate the XML instead of this hand-made validation
$bResult = true;
$aMandatoryTags = array('ARCHIVE' => array('VERSION'),
'TITLE' => array(),
'DESCRIPTION' => array(),
'PACKAGE' => array('TYPE', 'HREF', 'TITLE'));
$sXmlCatalog = $this->m_oZip->getFromName('catalog.xml');
$oParser = xml_parser_create();
xml_parse_into_struct($oParser, $sXmlCatalog, $aValues, $aIndexes);
xml_parser_free($oParser);
foreach($aMandatoryTags as $sTag => $aAttributes)
{
// Check that all the required tags are present
if (!isset($aIndexes[$sTag]))
{
$this->m_aErrorMessages[] = "The XML catalog does not contain the mandatory tag $sTag.";
$bResult = false;
}
else
{
foreach($aIndexes[$sTag] as $iIndex)
{
switch($aValues[$iIndex]['type'])
{
case 'complete':
case 'open':
// Check that all the required attributes are present
foreach($aAttributes as $sAttribute)
{
if (!isset($aValues[$iIndex]['attributes'][$sAttribute]))
{
$this->m_aErrorMessages[] = "The tag $sTag ($iIndex) does not contain the required attribute $sAttribute.";
}
}
break;
default:
// ignore other type of tags: close or cdata
}
}
}
}
return $bResult;
}
}
/*
// Unit test - reading an archive
$sArchivePath = '../tmp/archive.zip';
$oArchive = new iTopArchive($sArchivePath, iTopArchive::read);
$oArchive->ReadCatalog();
$oArchive->ImportSql('full_backup.sql');
// Writing an archive --
$sArchivePath = '../tmp/archive2.zip';
$oArchive = new iTopArchive($sArchivePath, iTopArchive::create);
$oArchive->SetTitle('First Archive !');
$oArchive->SetDescription('This is just a test. Does not contain a lot of useful data.');
$oArchive->AddPackage('../tmp/schema.sql', 'test.sql', 'this is just a test', 'text/sql', 'My first attempt at creating an archive from PHP...');
$oArchive->WriteCatalog();
$sArchivePath = '../tmp/archive2.zip';
$oArchive = new iTopArchive($sArchivePath, iTopArchive::create);
$oArchive->SetTitle('First Archive !');
$oArchive->SetDescription('This is just a test. Does not contain a lot of useful data.');
$oArchive->AddDatabaseDump('Test', 'This is my first automatic dump', 'schema.sql', 'itop', array('objects'));
$oArchive->WriteCatalog();
*/
?>

View File

@@ -230,7 +230,7 @@ abstract class AsyncTask extends DBObject
$this->Set('remaining_retries', $this->GetMaxRetries($iErrorCode));
}
$this->Set('last_error', $sErrorMessage);
$this->SetTrim('last_error', $sErrorMessage);
$this->Set('last_error_code', $iErrorCode); // Note: can be ZERO !!!
$this->Set('last_attempt', time());

File diff suppressed because it is too large Load Diff

View File

@@ -33,6 +33,7 @@ MetaModel::IncludeModule('core/tagsetfield.class.inc.php');
MetaModel::IncludeModule('synchro/synchrodatasource.class.inc.php');
MetaModel::IncludeModule('core/backgroundtask.class.inc.php');
MetaModel::IncludeModule('core/inlineimage.class.inc.php');
MetaModel::IncludeModule('core/counter.class.inc.php');
MetaModel::IncludeModule('webservices/webservices.basic.php');

View File

@@ -1,29 +1,23 @@
<?php
// Copyright (C) 2010-2013 Combodo SARL
//
// This file is part of iTop.
//
// iTop is free software; you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// iTop 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 Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with iTop. If not, see <http://www.gnu.org/licenses/>
/**
* interface iProcess
* Something that can be executed
* Copyright (C) 2010-2020 Combodo SARL
*
* @copyright Copyright (C) 2010-2012 Combodo SARL
* @license http://opensource.org/licenses/AGPL-3.0
* This file is part of iTop.
*
* iTop is free software; you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* iTop 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 Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
*/
interface iProcess
{
/**
@@ -56,8 +50,9 @@ interface iBackgroundProcess extends iProcess
* interface iScheduledProcess
* A variant of process that must be called at specific times
*
* @copyright Copyright (C) 2013 Combodo SARL
* @see \AbstractWeeklyScheduledProcess for a bootstrap implementation
* @license http://opensource.org/licenses/AGPL-3.0
* @copyright Copyright (C) 2013 Combodo SARL
*/
interface iScheduledProcess extends iProcess
{
@@ -67,22 +62,226 @@ interface iScheduledProcess extends iProcess
public function GetNextOccurrence();
}
/**
* Class ProcessException
* Exception for iProcess implementations.<br>
* Implementation of {@link iScheduledProcess}, using config parameters for module
*
* Use these parameters :
*
* * enabled
* * week_days
* * time
*
* Param names and some of their default values are in constant that can be overridden.
*
* Other info (module name and time default value) should be provided using a method that needs to be implemented.
*
* @since 2.7.0 PR #89
* @since 2.7.0-2 N°2580 Fix {@link GetNextOccurrence} returning wrong value
*/
abstract class AbstractWeeklyScheduledProcess implements iScheduledProcess
{
// param have default names/values but can be overridden
const MODULE_SETTING_ENABLED = 'enabled';
const DEFAULT_MODULE_SETTING_ENABLED = true;
const MODULE_SETTING_WEEKDAYS = 'week_days';
const DEFAULT_MODULE_SETTING_WEEKDAYS = 'monday, tuesday, wednesday, thursday, friday, saturday, sunday';
const MODULE_SETTING_TIME = 'time';
/**
* @var Config can be used to mock config for tests
*/
protected $oConfig;
/**
* Module must be declared in each implementation
*
* @return string
*/
abstract protected function GetModuleName();
/**
* @return string default value for {@link MODULE_SETTING_TIME} config param.
* example '23:30'
*/
abstract protected function GetDefaultModuleSettingTime();
/**
* @return \Config
*/
public function getOConfig()
{
if (!isset($this->oConfig))
{
$this->oConfig = MetaModel::GetConfig();
}
return $this->oConfig;
}
/**
* Interpret current setting for the week days
*
* @returns int[] (monday = 1)
* @throws ProcessInvalidConfigException
*/
public function InterpretWeekDays()
{
static $aWEEKDAYTON = array(
'monday' => 1,
'tuesday' => 2,
'wednesday' => 3,
'thursday' => 4,
'friday' => 5,
'saturday' => 6,
'sunday' => 7,
);
$aDays = array();
$sWeekDays = $this->getOConfig()->GetModuleSetting(
$this->GetModuleName(),
static::MODULE_SETTING_WEEKDAYS,
static::DEFAULT_MODULE_SETTING_WEEKDAYS
);
if ($sWeekDays !== '')
{
$aWeekDaysRaw = explode(',', $sWeekDays);
foreach ($aWeekDaysRaw as $sWeekDay)
{
$sWeekDay = strtolower(trim($sWeekDay));
if (array_key_exists($sWeekDay, $aWEEKDAYTON))
{
$aDays[] = $aWEEKDAYTON[$sWeekDay];
}
else
{
throw new ProcessInvalidConfigException($this->GetModuleName().": wrong format for setting '".static::MODULE_SETTING_WEEKDAYS."' (found '$sWeekDay')");
}
}
}
if (count($aDays) === 0)
{
throw new ProcessInvalidConfigException($this->GetModuleName().': missing setting \''.static::MODULE_SETTING_WEEKDAYS.'\'');
}
$aDays = array_unique($aDays);
sort($aDays);
return $aDays;
}
/**
* @param string $sCurrentTime Date string to extract time dependency
* this parameter is not present in the interface but as it is optional it's ok
*
* @return DateTime the exact time at which the process must be run next time
* @throws \ProcessInvalidConfigException
*/
public function GetNextOccurrence($sCurrentTime = 'now')
{
$bEnabled = $this->getOConfig()->GetModuleSetting(
$this->GetModuleName(),
static::MODULE_SETTING_ENABLED,
static::DEFAULT_MODULE_SETTING_ENABLED
);
$sItopTimeZone = $this->getOConfig()->Get('timezone');
$timezone = new DateTimeZone($sItopTimeZone);
if (!$bEnabled)
{
return new DateTime('3000-01-01', $timezone);
}
// 1st - Interpret the list of days as ordered numbers (monday = 1)
//
$aDays = $this->InterpretWeekDays();
// 2nd - Find the next active week day
//
$sProcessTime = $this->getOConfig()->GetModuleSetting(
$this->GetModuleName(),
static::MODULE_SETTING_TIME,
static::GetDefaultModuleSettingTime()
);
if (!preg_match('/[0-2]\d:[0-5]\d/', $sProcessTime))
{
throw new ProcessInvalidConfigException($this->GetModuleName().": wrong format for setting '".static::MODULE_SETTING_TIME."' (found '$sProcessTime')");
}
$oNow = new DateTime($sCurrentTime, $timezone);
$iNextPos = false;
$sDay = $oNow->format('N');
for ($iDay = (int) $sDay; $iDay <= 7; $iDay++)
{
$iNextPos = array_search($iDay, $aDays, true);
if ($iNextPos !== false)
{
if (($iDay > $oNow->format('N')) || ($oNow->format('H:i') < $sProcessTime))
{
break;
}
$iNextPos = false; // necessary on sundays
}
}
// 3rd - Compute the result
//
if ($iNextPos === false)
{
// Jump to the first day within the next week
$iFirstDayOfWeek = $aDays[0];
$iDayMove = $oNow->format('N') - $iFirstDayOfWeek;
$oRet = clone $oNow;
$oRet->modify('-'.$iDayMove.' days');
$oRet->modify('+1 weeks');
}
else
{
$iNextDayOfWeek = $aDays[$iNextPos];
$iMove = $iNextDayOfWeek - $oNow->format('N');
$oRet = clone $oNow;
$oRet->modify('+'.$iMove.' days');
}
list($sHours, $sMinutes) = explode(':', $sProcessTime);
/** @noinspection PhpElementIsNotAvailableInCurrentPhpVersionInspection non used new parameter in PHP 7.1 */
$oRet->setTime((int)$sHours, (int)$sMinutes);
return $oRet;
}
/**
* @see \iProcess
*
* @param int $iUnixTimeLimit
*
* @return string
*/
abstract public function Process($iUnixTimeLimit);
}
/**
* Exception for {@link iProcess} implementations.<br>
* An error happened during the processing but we can go on with the next implementations.
* @since 2.5.0 N°1195
*/
class ProcessException extends CoreException
{
}
/**
* @since 2.7.0 PR #89
*/
class ProcessInvalidConfigException extends ProcessException
{
}
/**
* Class ProcessFatalException
* Exception for iProcess implementations.<br>
* A big error occurred, we have to stop the iProcess processing.
* @since 2.5.0 N°1195
*/
class ProcessFatalException extends CoreException
{
}

View File

@@ -19,13 +19,31 @@
/**
* Class BackgroundTask
* A class to record information about the execution of background processes
* A class to record information about the execution of background processes ({@link iProcess} impl)
*
* @copyright Copyright (C) 2010-2012 Combodo SARL
* @license http://opensource.org/licenses/AGPL-3.0
*/
class BackgroundTask extends DBObject
{
protected $bDebug = false;
/**
* @return bool
*/
public function IsDebug()
{
return $this->bDebug;
}
/**
* @param bool $bDebug
*/
public function SetDebug($bDebug)
{
$this->bDebug = $bDebug;
}
public static function Init()
{
$aParams = array
@@ -55,6 +73,7 @@ class BackgroundTask extends DBObject
MetaModel::Init_AddAttribute(new AttributeBoolean("running", array("allowed_values"=>null, "sql"=>"running", "default_value"=>false, "is_null_allowed"=>false, "depends_on"=>array())));
MetaModel::Init_AddAttribute(new AttributeEnum("status", array("allowed_values"=>new ValueSetEnum('active,paused'), "sql"=>"status", "default_value"=>'active', "is_null_allowed"=>false, "depends_on"=>array())));
MetaModel::Init_AddAttribute(new AttributeString("system_user", array("allowed_values"=>null, "sql"=>"system_user", "default_value"=>null, "is_null_allowed"=>true, "depends_on"=>array())));
}
public function ComputeDurations($fLatestDuration)
@@ -73,4 +92,4 @@ class BackgroundTask extends DBObject
}
$this->Set('latest_run_duration', sprintf('%.3f',$fLatestDuration));
}
}
}

View File

@@ -309,7 +309,7 @@ class BulkChange
$value = $oForeignAtt->MakeValueFromString($aRowData[$iCol], $this->m_bLocalizedValues);
}
$oReconFilter->AddCondition($sForeignAttCode, $value, '=');
$aResults[$iCol] = new CellStatus_Void($aRowData[$iCol]);
$aResults[$iCol] = new CellStatus_Void(utils::HtmlEntities($aRowData[$iCol]));
}
$oExtObjects = new CMDBObjectSet($oReconFilter);
@@ -363,6 +363,7 @@ class BulkChange
foreach ($aKeyConfig as $sForeignAttCode => $iCol)
{
// Default reporting
// $aRowData[$iCol] is always null
$aResults[$iCol] = new CellStatus_Void($aRowData[$iCol]);
}
if ($oExtKey->IsNullAllowed())
@@ -395,7 +396,7 @@ class BulkChange
}
$aCacheKeys[] = $value;
$oReconFilter->AddCondition($sForeignAttCode, $value, '=');
$aResults[$iCol] = new CellStatus_Void($aRowData[$iCol]);
$aResults[$iCol] = new CellStatus_Void(utils::HtmlEntities($aRowData[$iCol]));
}
$sCacheKey = implode('_|_', $aCacheKeys); // Unique key for this query...
$iForeignKey = null;
@@ -465,7 +466,7 @@ class BulkChange
foreach ($aKeyConfig as $sForeignAttCode => $iCol)
{
// Report the change on reconciliation values as well
$aResults[$iCol] = new CellStatus_Modify($aRowData[$iCol]);
$aResults[$iCol] = new CellStatus_Modify(utils::HtmlEntities($aRowData[$iCol]));
}
}
}
@@ -538,7 +539,7 @@ class BulkChange
{
if ($sAttCode == 'id')
{
$aResults[$iCol]= new CellStatus_Void($aRowData[$iCol]);
$aResults[$iCol]= new CellStatus_Void(utils::HtmlEntities($aRowData[$iCol]));
}
else
{
@@ -554,7 +555,7 @@ class BulkChange
}
if (isset($aErrors[$sAttCode]))
{
$aResults[$iCol]= new CellStatus_Issue($aRowData[$iCol], $sOrigValue, $aErrors[$sAttCode]);
$aResults[$iCol]= new CellStatus_Issue(utils::HtmlEntities($aRowData[$iCol]), $sOrigValue, $aErrors[$sAttCode]);
}
elseif (array_key_exists($sAttCode, $aChangedFields))
{
@@ -577,7 +578,7 @@ class BulkChange
}
else
{
$aResults[$iCol]= new CellStatus_Void($aRowData[$iCol]);
$aResults[$iCol]= new CellStatus_Void(utils::HtmlEntities($aRowData[$iCol]));
}
}
}
@@ -654,7 +655,7 @@ class BulkChange
return $aResults;
}
protected function CreateObject(&$aResult, $iRow, $aRowData, CMDBChange $oChange = null)
{
$oTargetObj = MetaModel::NewObject($this->m_sClass);
@@ -726,25 +727,38 @@ class BulkChange
$aResult[$iRow]["__STATUS__"] = new RowStatus_Issue(Dict::Format('UI:CSVReport-Row-Issue-MissingExtKey', $sMissingKeys));
return $oTargetObj;
}
// Optionaly record the results
// Optionally record the results
//
if ($oChange)
{
$newID = $oTargetObj->DBInsertTrackedNoReload($oChange);
$aResult[$iRow]["__STATUS__"] = new RowStatus_NewObj();
$aResult[$iRow]["finalclass"] = get_class($oTargetObj);
$aResult[$iRow]["id"] = new CellStatus_Void($newID);
$newID = $oTargetObj->DBInsert();
}
else
{
$aResult[$iRow]["__STATUS__"] = new RowStatus_NewObj();
$aResult[$iRow]["finalclass"] = get_class($oTargetObj);
$aResult[$iRow]["id"] = new CellStatus_Void(0);
$newID = 0;
}
$aResult[$iRow]["__STATUS__"] = new RowStatus_NewObj();
$aResult[$iRow]["finalclass"] = get_class($oTargetObj);
$aResult[$iRow]["id"] = new CellStatus_Void($newID);
return $oTargetObj;
}
/**
* @param array $aResult
* @param int $iRow
* @param \CMDBObject $oTargetObj
* @param array $aRowData
* @param \CMDBChange $oChange
*
* @throws \CoreException
* @throws \CoreUnexpectedValue
* @throws \MissingQueryArgument
* @throws \MySQLException
* @throws \MySQLHasGoneAwayException
*/
protected function UpdateObject(&$aResult, $iRow, $oTargetObj, $aRowData, CMDBChange $oChange = null)
{
$aResult[$iRow] = $this->PrepareObject($oTargetObj, $aRowData, $aErrors);
@@ -772,7 +786,7 @@ class BulkChange
{
try
{
$oTargetObj->DBUpdateTracked($oChange);
$oTargetObj->DBUpdate();
}
catch(CoreException $e)
{
@@ -786,6 +800,14 @@ class BulkChange
}
}
/**
* @param array $aResult
* @param int $iRow
* @param \CMDBObject $oTargetObj
* @param \CMDBChange $oChange
*
* @throws \BulkChangeException
*/
protected function UpdateMissingObject(&$aResult, $iRow, $oTargetObj, CMDBChange $oChange = null)
{
$aResult[$iRow] = $this->PrepareMissingObject($oTargetObj, $aErrors);
@@ -813,7 +835,7 @@ class BulkChange
{
try
{
$oTargetObj->DBUpdateTracked($oChange);
$oTargetObj->DBUpdate();
}
catch(CoreException $e)
{
@@ -829,6 +851,11 @@ class BulkChange
public function Process(CMDBChange $oChange = null)
{
if ($oChange)
{
CMDBObject::SetCurrentChange($oChange);
}
// Note: $oChange can be null, in which case the aim is to check what would be done
// Debug...
@@ -898,7 +925,7 @@ class BulkChange
{
// Leave the cell unchanged
$aResult[$iRow]["__STATUS__"]= new RowStatus_Issue(Dict::S('UI:CSVReport-Row-Issue-DateFormat'));
$aResult[$iRow][$sAttCode] = new CellStatus_Issue(null, $this->m_aData[$iRow][$iCol], Dict::S('UI:CSVReport-Row-Issue-DateFormat'));
$aResult[$iRow][$sAttCode] = new CellStatus_Issue(null, utils::HtmlEntities($this->m_aData[$iRow][$iCol]), Dict::S('UI:CSVReport-Row-Issue-DateFormat'));
}
}
}
@@ -1056,7 +1083,7 @@ class BulkChange
{
if (!array_key_exists($iCol, $aResult[$iRow]))
{
$aResult[$iRow][$iCol] = new CellStatus_Void($aRowData[$iCol]);
$aResult[$iRow][$iCol] = new CellStatus_Void(utils::HtmlEntities($aRowData[$iCol]));
}
}
foreach($this->m_aExtKeys as $sAttCode => $aForeignAtts)
@@ -1070,7 +1097,7 @@ class BulkChange
if (!array_key_exists($iCol, $aResult[$iRow]))
{
// The foreign attribute is one of our reconciliation key
$aResult[$iRow][$iCol] = new CellStatus_Void($aRowData[$iCol]);
$aResult[$iRow][$iCol] = new CellStatus_Void(utils::HtmlEntities($aRowData[$iCol]));
}
}
}

View File

@@ -1,20 +1,21 @@
<?php
// Copyright (C) 2015 Combodo SARL
//
// This file is part of iTop.
//
// iTop is free software; you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// iTop 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 Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with iTop. If not, see <http://www.gnu.org/licenses/>
/**
* Copyright (C) 2013-2019 Combodo SARL
*
* This file is part of iTop.
*
* iTop is free software; you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* iTop 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 Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
*/
define('EXPORTER_DEFAULT_CHUNK_SIZE', 1000);
@@ -109,7 +110,7 @@ class BulkExportResultGC implements iBackgroundProcess
{
// Next one ?
$oSet = new CMDBObjectSet(DBObjectSearch::FromOQL($sOQL), array('created' => true) /* order by*/, array(), null, 1 /* limit count */);
$oSet->OptimizeColumnLoad(array('temp_file_path'));
$oSet->OptimizeColumnLoad(array('BulkExportResult' => array('temp_file_path')));
$oResult = $oSet->Fetch();
if (is_null($oResult))
{
@@ -148,7 +149,9 @@ abstract class BulkExport
$this->oSearch = null;
$this->iChunkSize = 0;
$this->sFormatCode = null;
$this->aStatusInfo = array();
$this->aStatusInfo = [
'show_obsolete_data' => utils::ShowObsoleteData(),
];
$this->oBulkExportResult = null;
$this->sTmpFile = '';
$this->bLocalizeOutput = false;
@@ -170,6 +173,7 @@ abstract class BulkExport
$oRefClass = new ReflectionClass($sPHPClass);
if ($oRefClass->isSubclassOf('BulkExport') && !$oRefClass->isAbstract())
{
/** @var BulkExport $oBulkExporter */
$oBulkExporter = new $sPHPClass();
if ($oBulkExporter->IsFormatSupported($sFormatCode, $oSearch))
{
@@ -189,7 +193,7 @@ abstract class BulkExport
*
* @param int $iPersistentToken The identifier of the BulkExportResult object storing the information
*
* @return iBulkExport|null
* @return BulkExport|null
* @throws ArchivedObjectException
* @throws CoreException
* @throws ReflectionException
@@ -201,15 +205,17 @@ abstract class BulkExport
if ($oInfo && ($oInfo->Get('user_id') == UserRights::GetUserId()))
{
$sFormatCode = $oInfo->Get('format');
$oSearch = DBObjectSearch::unserialize($oInfo->Get('search'));
$aStatusInfo = json_decode($oInfo->Get('status_info'),true);
$oSearch = DBObjectSearch::unserialize($oInfo->Get('search'));
$oSearch->SetShowObsoleteData($aStatusInfo['show_obsolete_data']);
$oBulkExporter = self::FindExporter($sFormatCode, $oSearch);
if ($oBulkExporter)
{
$oBulkExporter->SetFormat($sFormatCode);
$oBulkExporter->SetObjectList($oSearch);
$oBulkExporter->SetChunkSize($oInfo->Get('chunk_size'));
$oBulkExporter->SetStatusInfo(json_decode($oInfo->Get('status_info'), true));
$oBulkExporter->SetStatusInfo($aStatusInfo);
$oBulkExporter->SetLocalizeOutput($oInfo->Get('localize_output'));
@@ -287,6 +293,7 @@ abstract class BulkExport
*/
public function SetObjectList(DBSearch $oSearch)
{
$oSearch->SetShowObsoleteData($this->aStatusInfo['show_obsolete_data']);
$this->oSearch = $oSearch;
}
@@ -343,10 +350,10 @@ abstract class BulkExport
$this->oBulkExportResult->Set('format', $this->sFormatCode);
$this->oBulkExportResult->Set('search', $this->oSearch->serialize());
$this->oBulkExportResult->Set('chunk_size', $this->iChunkSize);
$this->oBulkExportResult->Set('temp_file_path', $this->sTmpFile);
$this->oBulkExportResult->Set('localize_output', $this->bLocalizeOutput);
}
$this->oBulkExportResult->Set('status_info', json_encode($this->GetStatusInfo()));
$this->oBulkExportResult->Set('temp_file_path', $this->sTmpFile);
utils::PushArchiveMode(false);
$ret = $this->oBulkExportResult->DBWrite();
utils::PopArchiveMode();
@@ -418,6 +425,11 @@ abstract class BulkExport
public function GetStatistics()
{
}
public function SetFields($sFields)
{
}
public function GetDownloadFileName()

View File

@@ -63,22 +63,30 @@ class CMDBChangeOp extends DBObject
/**
* Describe (as a text string) the modifications corresponding to this change
*/
*/
public function GetDescription()
{
return '';
}
/**
* Safety net: in case the change is not given, let's guarantee that it will
* be set to the current ongoing change (or create a new one)
*/
* Safety net:
* * if change isn't persisted yet, use the current change and persist it if needed
* * in case the change is not given, let's guarantee that it will be set to the current ongoing change (or create a new one)
*
* @since 2.7.7 3.0.2 3.1.0 N°3717 do persist the current change if needed
*/
protected function OnInsert()
{
if ($this->Get('change') <= 0)
{
$this->Set('change', CMDBObject::GetCurrentChange());
$iChange = $this->Get('change');
if (($iChange <= 0) || (is_null($iChange))) {
$oChange = CMDBObject::GetCurrentChange();
if ($oChange->IsNew()) {
$oChange->DBWrite();
}
$this->Set('change', $oChange);
}
parent::OnInsert();
}
}
@@ -544,7 +552,7 @@ class CMDBChangeOpSetAttributeEncrypted extends CMDBChangeOpSetAttribute
// The attribute was renamed or removed from the object ?
$sAttName = $this->Get('attcode');
}
$sPrevString = $this->Get('prevstring');
$sPrevString = $this->GetAsHTML('prevstring');
$sResult = Dict::Format('Change:AttName_Changed_PreviousValue_OldValue', $sAttName, $sPrevString);
}
return $sResult;

View File

@@ -59,7 +59,6 @@ require_once('sqlobjectquery.class.inc.php');
require_once('sqlunionquery.class.inc.php');
require_once('dbobject.class.php');
require_once('dbsearch.class.php');
require_once('dbobjectset.class.php');
require_once('backgroundprocess.inc.php');
@@ -96,15 +95,45 @@ abstract class CMDBObject extends DBObject
protected static $m_oCurrChange = null;
protected static $m_sInfo = null; // null => the information is built in a standard way
protected static $m_sOrigin = null; // null => the origin is 'interactive'
/**
* Specify another change (this is mainly for backward compatibility)
* Specify the change to be used by the API to attach any CMDBChangeOp* object created
*
* @see SetTrackInfo if CurrentChange is null, then a new one will be create using trackinfo
*
* @param CMDBChange|null $oChange use null so that the API will recreate a new CMDBChange using TrackInfo & TrackOrigin
* If providing a CMDBChange, you should persist it first ! Indeed the API will automatically create CMDBChangeOp (see
* \CMDBObject::RecordObjCreation / RecordAttChange / RecordObjDeletion for example) and link them to the current change : in
* consequence this CMDBChange must have a key set !
*
* @since 2.7.2 N°3219 can now reset CMDBChange by passing null
* @since 2.7.2 N°3218 PHPDoc about persisting the $oChange parameter first
*/
public static function SetCurrentChange(CMDBChange $oChange)
public static function SetCurrentChange($oChange)
{
self::$m_oCurrChange = $oChange;
}
/**
* @param string $sUserInfo
* @param string $sOrigin
* @param \DateTime $oDate
*
* @throws \CoreException
*
* @since 2.7.7 3.0.2 3.1.0 N°3717 new method to reset current change
*/
public static function SetCurrentChangeFromParams($sUserInfo, $sOrigin = null, $oDate = null)
{
static::SetTrackInfo($sUserInfo);
static::SetTrackOrigin($sOrigin);
static::CreateChange();
if (!is_null($oDate)) {
static::$m_oCurrChange->Set("date", $oDate);
}
}
//
// Todo: simplify the APIs and do not pass the current change as an argument anymore
// SetTrackInfo to be invoked in very few cases (UI.php, CSV import, Data synchro)
@@ -113,7 +142,11 @@ abstract class CMDBObject extends DBObject
// GetCurrentChange to create a default change if not already done in the current context
//
/**
* Get a change record (create it if not existing)
* @param bool $bAutoCreate if true calls {@link CreateChange} to get a new persisted object
*
* @return \CMDBChange
*
* @uses CreateChange
*/
public static function GetCurrentChange($bAutoCreate = true)
{
@@ -127,11 +160,17 @@ abstract class CMDBObject extends DBObject
/**
* Override the additional information (defaulting to user name)
* A call to this verb should replace every occurence of
* $oMyChange = MetaModel::NewObject("CMDBChange");
* $oMyChange = MetaModel::NewObject("CMDBChange");
* $oMyChange->Set("date", time());
* $oMyChange->Set("userinfo", 'this is done by ... for ...');
* $iChangeId = $oMyChange->DBInsert();
*/
*
* **warning** : this will do nothing if current change already exists !
*
* @see SetCurrentChange to specify a CMDBObject instance instead
*
* @param string $sInfo
*/
public static function SetTrackInfo($sInfo)
{
self::$m_sInfo = $sInfo;
@@ -139,24 +178,28 @@ abstract class CMDBObject extends DBObject
/**
* Provides information about the origin of the change
* @param $sOrigin String: one of: interactive, csv-interactive, csv-import.php, webservice-soap, webservice-rest, syncho-data-source, email-processing, custom-extension
*/
*
* **warning** : this will do nothing if current change already exists !
*
* @see SetTrackInfo
* @see SetCurrentChange to specify a CMDBObject instance instead
*
* @param $sOrigin String: one of: interactive, csv-interactive, csv-import.php, webservice-soap, webservice-rest, syncho-data-source,
* email-processing, custom-extension
*/
public static function SetTrackOrigin($sOrigin)
{
self::$m_sOrigin = $sOrigin;
}
/**
* Get the additional information (defaulting to user name)
*/
protected static function GetTrackInfo()
*/
public static function GetTrackInfo()
{
if (is_null(self::$m_sInfo))
{
if (is_null(self::$m_sInfo)) {
return CMDBChange::GetCurrentUserName();
}
else
{
} else {
return self::$m_sInfo;
}
}
@@ -175,17 +218,19 @@ abstract class CMDBObject extends DBObject
return self::$m_sOrigin;
}
}
/**
* Create a standard change record (done here 99% of the time, and nearly once per page)
*/
* Set to {@link $m_oCurrChange} a standard change record (done here 99% of the time, and nearly once per page)
*
* @since 2.7.7 3.0.2 3.1.0 N°3717 {@see CMDBChange} **will be persisted later** in {@see \CMDBChangeOp::OnInsert} (was done previously directly here)
* This will avoid creating in DB CMDBChange lines without any corresponding CMDBChangeOp
*/
protected static function CreateChange()
{
self::$m_oCurrChange = MetaModel::NewObject("CMDBChange");
self::$m_oCurrChange->Set("date", time());
self::$m_oCurrChange->Set("userinfo", self::GetTrackInfo());
self::$m_oCurrChange->Set("origin", self::GetTrackOrigin());
self::$m_oCurrChange->DBInsert();
}
/**
@@ -514,7 +559,23 @@ abstract class CMDBObject extends DBObject
}
}
/**
* @deprecated 2.7.0 N°2361 simply use {@link DBInsert} instead, that will automatically create and persist a CMDBChange object.
* If you need to persist your own, call {@link CMDBObject::SetCurrentChange} before.
*
* @param \CMDBChange $oChange
* @param null $bSkipStrongSecurity
*
* @return int|null
* @throws \ArchivedObjectException
* @throws \CoreCannotSaveObjectException
* @throws \CoreException
* @throws \CoreUnexpectedValue
* @throws \CoreWarning
* @throws \MySQLException
* @throws \OQLException
* @throws \SecurityException
*/
public function DBInsertTracked(CMDBChange $oChange, $bSkipStrongSecurity = null)
{
self::SetCurrentChange($oChange);
@@ -522,7 +583,24 @@ abstract class CMDBObject extends DBObject
$ret = $this->DBInsertTracked_Internal();
return $ret;
}
/**
* @deprecated 2.7.0 N°2361 simply use {@link DBInsertNoReload} instead, that will automatically create and persist a CMDBChange object.
* If you need to persist your own, call {@link CMDBObject::SetCurrentChange} before.
*
* @param \CMDBChange $oChange
* @param null $bSkipStrongSecurity
*
* @return int
* @throws \ArchivedObjectException
* @throws \CoreCannotSaveObjectException
* @throws \CoreException
* @throws \CoreUnexpectedValue
* @throws \CoreWarning
* @throws \MySQLException
* @throws \OQLException
* @throws \SecurityException
*/
public function DBInsertTrackedNoReload(CMDBChange $oChange, $bSkipStrongSecurity = null)
{
self::SetCurrentChange($oChange);
@@ -530,13 +608,20 @@ abstract class CMDBObject extends DBObject
$ret = $this->DBInsertTracked_Internal(true);
return $ret;
}
/**
* To Be Obsoleted: DO NOT rely on an overload of this method since
* DBInsertTracked (resp. DBInsertTrackedNoReload) may call directly
* DBInsert (resp. DBInsertNoReload) in future versions of iTop.
* @deprecated 2.7.0 N°2361 simply use {@link DBInsert} or {@link DBInsertNoReload} instead
*
* @param bool $bDoNotReload
*
* @return integer Identifier of the created object
* @throws \ArchivedObjectException
* @throws \CoreCannotSaveObjectException
* @throws \CoreException
* @throws \CoreUnexpectedValue
* @throws \CoreWarning
* @throws \MySQLException
* @throws \OQLException
*/
protected function DBInsertTracked_Internal($bDoNotReload = false)
{
@@ -583,6 +668,18 @@ abstract class CMDBObject extends DBObject
return $ret;
}
/**
* @deprecated 2.7.0 N°2361 simply use {@link DBUpdate} instead, that will automatically create and persist a CMDBChange object.
* If you need to persist your own, call {@link CMDBObject::SetCurrentChange} before.
*
* @param \CMDBChange $oChange
* @param null $bSkipStrongSecurity
*
* @return int|void
* @throws \CoreCannotSaveObjectException
* @throws \CoreException
* @throws \SecurityException
*/
public function DBUpdateTracked(CMDBChange $oChange, $bSkipStrongSecurity = null)
{
self::SetCurrentChange($oChange);
@@ -594,13 +691,38 @@ abstract class CMDBObject extends DBObject
* @param null $oDeletionPlan
*
* @return \DeletionPlan|null
* @throws \ArchivedObjectException
* @throws \CoreCannotSaveObjectException
* @throws \CoreException
* @throws \CoreUnexpectedValue
* @throws \DeleteException
* @throws \MySQLException
* @throws \MySQLHasGoneAwayException
* @throws \OQLException
*/
public function DBDelete(&$oDeletionPlan = null)
{
return $this->DBDeleteTracked_Internal($oDeletionPlan);
}
/**
* @deprecated 2.7.0 N°2361 simply use {@link DBDelete} instead, that will automatically create and persist a CMDBChange object.
* If you need to persist your own, call {@link CMDBObject::SetCurrentChange} before.
*
* @param \CMDBChange $oChange
* @param null $bSkipStrongSecurity
* @param null $oDeletionPlan
*
* @throws \ArchivedObjectException
* @throws \CoreCannotSaveObjectException
* @throws \CoreException
* @throws \CoreUnexpectedValue
* @throws \DeleteException
* @throws \MySQLException
* @throws \MySQLHasGoneAwayException
* @throws \OQLException
* @throws \SecurityException
*/
public function DBDeleteTracked(CMDBChange $oChange, $bSkipStrongSecurity = null, &$oDeletionPlan = null)
{
self::SetCurrentChange($oChange);
@@ -612,11 +734,17 @@ abstract class CMDBObject extends DBObject
* @param null $oDeletionPlan
*
* @return \DeletionPlan|null
* @throws \ArchivedObjectException
* @throws \CoreCannotSaveObjectException
* @throws \CoreException
* @throws \CoreUnexpectedValue
* @throws \DeleteException
* @throws \MySQLException
* @throws \MySQLHasGoneAwayException
* @throws \OQLException
*/
protected function DBDeleteTracked_Internal(&$oDeletionPlan = null)
{
$prevkey = $this->GetKey();
$ret = parent::DBDelete($oDeletionPlan);
return $ret;
}

View File

@@ -39,6 +39,7 @@ class MySQLException extends CoreException
*/
public function __construct($sIssue, $aContext, $oException = null, $oMysqli = null)
{
if ($oException != null)
{
$aContext['mysql_errno'] = $oException->getCode();
@@ -58,13 +59,18 @@ class MySQLException extends CoreException
$aContext['mysql_error'] = CMDBSource::GetError();
}
parent::__construct($sIssue, $aContext);
//if is connection error, don't log the default message with password in
if (mysqli_connect_errno()) {
error_log($this->message);
error_reporting(0);
}
}
}
/**
* Class MySQLQueryHasNoResultException
*
* @since 2.5
* @since 2.5.0
*/
class MySQLQueryHasNoResultException extends MySQLException
{
@@ -74,7 +80,7 @@ class MySQLQueryHasNoResultException extends MySQLException
/**
* Class MySQLHasGoneAwayException
*
* @since 2.5
* @since 2.5.0
* @see itop bug 1195
* @see https://dev.mysql.com/doc/refman/5.7/en/gone-away.html
*/
@@ -89,7 +95,7 @@ class MySQLHasGoneAwayException extends MySQLException
{
return array(
2006,
2013
2013,
);
}
@@ -99,10 +105,26 @@ class MySQLHasGoneAwayException extends MySQLException
}
}
/**
* @since 2.7.0 N°679
*/
class MySQLNoTransactionException extends MySQLException
{
}
/**
* @since 2.7.8 3.0.3 3.1.0 N°5538
*/
class MySQLTransactionNotClosedException extends MySQLException
{
}
/**
* CMDBSource
* database access wrapper
* database access wrapper
*
* @package iTopORM
*/
@@ -111,24 +133,58 @@ class CMDBSource
const ENUM_DB_VENDOR_MYSQL = 'MySQL';
const ENUM_DB_VENDOR_MARIADB = 'MariaDB';
const ENUM_DB_VENDOR_PERCONA = 'Percona';
/**
* @since 2.7.10 3.0.4 3.1.2 3.0.2 N°6889 constant creation
* @internal will be removed in a future version
*/
const MYSQL_DEFAULT_PORT = 3306;
/**
* Error: 1205 SQLSTATE: HY000 (ER_LOCK_WAIT_TIMEOUT)
* Message: Lock wait timeout exceeded; try restarting transaction
*/
const MYSQL_ERRNO_WAIT_TIMEOUT = 1205;
/**
* Error: 1213 SQLSTATE: 40001 (ER_LOCK_DEADLOCK)
* Message: Deadlock found when trying to get lock; try restarting transaction
*/
const MYSQL_ERRNO_DEADLOCK = 1213;
protected static $m_sDBHost;
protected static $m_sDBUser;
protected static $m_sDBPwd;
protected static $m_sDBName;
/**
* @var boolean
* @since 2.5 N°1260 MySQL TLS first implementation
* @since 2.5.0 N°1260 MySQL TLS first implementation
*/
protected static $m_bDBTlsEnabled;
/**
* @var string
* @since 2.5 N°1260 MySQL TLS first implementation
* @since 2.5.0 N°1260 MySQL TLS first implementation
*/
protected static $m_sDBTlsCA;
/** @var mysqli $m_oMysqli */
protected static $m_oMysqli;
/**
* The mysqli object is really hard to mock ! This attribute is used only in certain methods, so that we can mock only a very little subset of the mysqli object.
* We are setting it in {@see Init}, by default it is a copy of {@see $m_oMysqli}
* The mock can be injected using the setter {@see SetMySQLiForQuery}
*
* @var mysqli $oMySQLiForQuery
* @see GetMySQLiForQuery
* @see SetMySQLiForQuery
* @since 2.7.5 N°3513 new var to allow mock in tests ({@see \Combodo\iTop\Test\UnitTest\Core\TransactionsTest})
*/
protected static $oMySQLiForQuery;
/**
* @var int number of level for nested transactions : 0 if no transaction was ever opened, +1 for each 'START TRANSACTION' sent
* @since 2.7.0 N°679
*/
protected static $m_iTransactionLevel = 0;
/**
* SQL charset & collation declaration for text columns
@@ -137,7 +193,7 @@ class CMDBSource
* use expression as value)
*
* @see https://dev.mysql.com/doc/refman/5.7/en/charset-column.html
* @since 2.5 N°1001 switch to utf8mb4
* @since 2.5.1 N°1001 switch to utf8mb4
*/
public static function GetSqlStringColumnDefinition()
{
@@ -189,6 +245,7 @@ class CMDBSource
self::$m_sDBTlsCA = empty($sTlsCA) ? null : $sTlsCA;
self::$m_oMysqli = self::GetMysqliInstance($sServer, $sUser, $sPwd, $sSource, $bTlsEnabled, $sTlsCA, true);
self::SetMySQLiForQuery(self::$m_oMysqli);
}
/**
@@ -202,12 +259,12 @@ class CMDBSource
*
* @return \mysqli
* @throws \MySQLException
*
* @uses IsOpenedDbConnectionUsingTls when asking for a TLS connection, to check if it was really opened using TLS
*/
public static function GetMysqliInstance(
$sDbHost, $sUser, $sPwd, $sSource = '', $bTlsEnabled = false, $sTlsCa = null, $bCheckTlsAfterConnection = false
) {
$oMysqli = null;
$sServer = null;
$iPort = null;
self::InitServerAndPort($sDbHost, $sServer, $iPort);
@@ -237,7 +294,7 @@ class CMDBSource
}
catch(mysqli_sql_exception $e)
{
throw new MySQLException('Could not connect to the DB server', array('host' => $sServer, 'user' => $sUser), $e);
throw new MySQLException('Could not connect to the DB server', array('host' => $sServer, 'user' => $sUser),$e);
}
if ($bTlsEnabled
@@ -268,16 +325,19 @@ class CMDBSource
/**
* @param string $sDbHost initial value ("p:domain:port" syntax)
* @param string $sServer server variable to update
* @param int $iPort port variable to update
* @param int|null $iPort port variable to update, will return null if nothing is specified in $sDbHost
*
* @since 2.7.10 3.0.4 3.1.2 3.2.0 N°6889 will return null in $iPort if port isn't present in $sDbHost. Use {@see MYSQL_DEFAULT_PORT} if needed
*
* @link http://php.net/manual/en/mysqli.persistconns.php documentation for the "p:" prefix (persistent connexion)
*/
public static function InitServerAndPort($sDbHost, &$sServer, &$iPort)
{
$aConnectInfo = explode(':', $sDbHost);
$bUsePersistentConnection = false;
if (strcasecmp($aConnectInfo[0], 'p') == 0)
if (strcasecmp($aConnectInfo[0], 'p') === 0)
{
// we might have "p:" prefix to use persistent connections (see http://php.net/manual/en/mysqli.persistconns.php)
$bUsePersistentConnection = true;
$sServer = $aConnectInfo[0].':'.$aConnectInfo[1];
}
@@ -289,15 +349,11 @@ class CMDBSource
$iConnectInfoCount = count($aConnectInfo);
if ($bUsePersistentConnection && ($iConnectInfoCount == 3))
{
$iPort = $aConnectInfo[2];
$iPort = (int)($aConnectInfo[2]);
}
else if (!$bUsePersistentConnection && ($iConnectInfoCount == 2))
{
$iPort = $aConnectInfo[1];
}
else
{
$iPort = 3306;
$iPort = (int)($aConnectInfo[1]);
}
}
@@ -306,41 +362,41 @@ class CMDBSource
* parameters were used.<br>
* This method can be called to ensure that the DB connection really uses TLS.
*
* <p>We're using this object connection : {@link self::$m_oMysqli}
* <p>We're using our own mysqli instance to do the check as this check is done when creating the mysqli instance : the consumer
* might want a dedicated object, and if so we don't want to overwrite the one saved in CMDBSource !<br>
* This is the case for example with {@see \iTopMutex} !
*
* @param \mysqli $oMysqli
*
* @return boolean true if the connection was really established using TLS
* @return boolean true if the connection was really established using TLS, false otherwise
* @throws \MySQLException
*
* @used-by GetMysqliInstance
* @uses IsMySqlVarNonEmpty
* @uses 'ssl_version' MySQL var
* @uses 'ssl_cipher' MySQL var
*/
private static function IsOpenedDbConnectionUsingTls($oMysqli)
{
if (self::$m_oMysqli == null)
{
self::$m_oMysqli = $oMysqli;
}
$bNonEmptySslVersionVar = self::IsMySqlVarNonEmpty('ssl_version');
$bNonEmptySslCipherVar = self::IsMySqlVarNonEmpty('ssl_cipher');
$bNonEmptySslVersionVar = self::IsMySqlVarNonEmpty('ssl_version', $oMysqli);
$bNonEmptySslCipherVar = self::IsMySqlVarNonEmpty('ssl_cipher', $oMysqli);
return ($bNonEmptySslVersionVar && $bNonEmptySslCipherVar);
}
/**
* @param string $sVarName
* @param mysqli $oMysqli connection to use for the query
*
* @return bool
* @throws \MySQLException
*
* @uses SHOW STATUS queries
* @uses 'SHOW SESSION STATUS' queries
*/
private static function IsMySqlVarNonEmpty($sVarName)
private static function IsMySqlVarNonEmpty($sVarName, $oMysqli)
{
try
{
$sResult = self::QueryToScalar("SHOW SESSION STATUS LIKE '$sVarName'", 1);
$sResult = self::QueryToScalar("SHOW SESSION STATUS LIKE '$sVarName'", 1, $oMysqli);
}
catch (MySQLQueryHasNoResultException $e)
{
@@ -404,6 +460,12 @@ class CMDBSource
}
/**
* @return string
* @throws \MySQLException
*
* @uses \CMDBSource::QueryToCol() so needs a connection opened !
*/
public static function GetDBVersion()
{
$aVersions = self::QueryToCol('SELECT Version() as version', 'version');
@@ -411,10 +473,20 @@ class CMDBSource
}
/**
* Get the DB vendor between MySQL and its main forks
* @return string
*/
static public function GetDBVendor()
public static function GetServerInfo()
{
return mysqli_get_server_info ( self::$m_oMysqli );
}
/**
* Get the DB vendor between MySQL and its main forks
* @return string
*
* @uses \CMDBSource::GetServerVariable() so needs a connection opened !
*/
public static function GetDBVendor()
{
$sDBVendor = static::ENUM_DB_VENDOR_MYSQL;
@@ -468,6 +540,7 @@ class CMDBSource
{
self::$m_sDBName = '';
}
self::_TablesInfoCacheReset(); // reset the table info cache!
}
public static function CreateTable($sQuery)
@@ -497,6 +570,24 @@ class CMDBSource
return self::$m_oMysqli;
}
/**
* @return
*/
private static function GetMySQLiForQuery()
{
return self::$oMySQLiForQuery;
}
/**
* Used for test purpose (mysqli mock)
* @param $oMySQLi
*/
private static function SetMySQLiForQuery($oMySQLi)
{
self::$oMySQLiForQuery = $oMySQLi;
}
public static function GetErrNo()
{
if (self::$m_oMysqli->errno != 0)
@@ -554,11 +645,6 @@ class CMDBSource
return $aRes;
}
// Stripslashes
if (get_magic_quotes_gpc())
{
$value = stripslashes($value);
}
// Quote if not a number or a numeric string
if ($bAlways || is_string($value))
{
@@ -567,43 +653,305 @@ class CMDBSource
return $value;
}
/**
* MariaDB returns "'value'" for enum, while MySQL returns "value" (without the surrounding single quotes)
*
* @param string $sValue
*
* @return string without the surrounding quotes
* @since 2.7.0 N°2490
*/
private static function RemoveSurroundingQuotes($sValue)
{
if (utils::StartsWith($sValue, '\'') && utils::EndsWith($sValue, '\''))
{
$sValue = substr($sValue, 1, -1);
}
return $sValue;
}
/**
* @param string $sSQLQuery
*
* @return \mysqli_result
* @throws \MySQLException
* @throws \MySQLHasGoneAwayException
* @return mysqli_result|null
* @throws MySQLException
* @throws MySQLHasGoneAwayException
*
* @since 2.7.0 N°679 handles nested transactions
*/
public static function Query($sSQLQuery)
{
if (preg_match('/^START TRANSACTION;?$/i', $sSQLQuery))
{
self::StartTransaction();
return null;
}
if (preg_match('/^COMMIT;?$/i', $sSQLQuery))
{
self::Commit();
return null;
}
if (preg_match('/^ROLLBACK;?$/i', $sSQLQuery))
{
self::Rollback();
return null;
}
return self::DBQuery($sSQLQuery);
}
/**
* Send the query directly to the DB. **Be extra cautious with this !**
*
* Use {@link Query} if you're not sure.
*
* @internal
*
* @param string $sSql
*
* @return bool|\mysqli_result
* @throws \MySQLHasGoneAwayException
* @throws \MySQLException
*
* @since 2.7.0 N°679
*/
private static function DBQuery($sSql)
{
$sShortSQL = substr(preg_replace("/\s+/", " ", substr($sSql, 0, 180)), 0, 150);
if (substr_compare($sShortSQL, "SELECT", 0, strlen("SELECT")) !== 0) {
IssueLog::Trace("$sShortSQL", 'cmdbsource');
}
$oKPI = new ExecutionKPI();
try
{
$oResult = self::$m_oMysqli->query($sSQLQuery);
$oResult = self::GetMySQLiForQuery()->query($sSql);
}
catch(mysqli_sql_exception $e)
catch (mysqli_sql_exception $e)
{
throw new MySQLException('Failed to issue SQL query', array('query' => $sSQLQuery, $e));
}
$oKPI->ComputeStats('Query exec (mySQL)', $sSQLQuery);
self::LogDeadLock($e);
throw new MySQLException('Failed to issue SQL query', array('query' => $sSql, $e));
} finally {
$oKPI->ComputeStats('Query exec (mySQL)', $sSql);
}
if ($oResult === false)
{
$aContext = array('query' => $sSQLQuery);
$aContext = array('query' => $sSql);
$iMySqlErrorNo = self::$m_oMysqli->errno;
$iMySqlErrorNo = self::GetMySQLiForQuery()->errno;
$aMySqlHasGoneAwayErrorCodes = MySQLHasGoneAwayException::getErrorCodes();
if (in_array($iMySqlErrorNo, $aMySqlHasGoneAwayErrorCodes))
{
throw new MySQLHasGoneAwayException(self::GetError(), $aContext);
}
throw new MySQLException('Failed to issue SQL query', $aContext);
$e = new MySQLException('Failed to issue SQL query', $aContext);
self::LogDeadLock($e);
throw $e;
}
return $oResult;
}
/**
* @param \Exception $e
*
* @since 2.7.1
*/
private static function LogDeadLock(Exception $e)
{
// checks MySQL error code
$iMySqlErrorNo = self::GetMySQLiForQuery()->errno;
if (!in_array($iMySqlErrorNo, array(self::MYSQL_ERRNO_WAIT_TIMEOUT, self::MYSQL_ERRNO_DEADLOCK)))
{
return;
}
// Get error info
$sUser = UserRights::GetUser();
$oError = self::GetMySQLiForQuery()->query('SHOW ENGINE INNODB STATUS');
if ($oError !== false)
{
$aData = $oError->fetch_all(MYSQLI_ASSOC);
$sInnodbStatus = $aData[0];
}
else
{
$sInnodbStatus = 'Get status query cannot execute';
}
// log !
$sMessage = "deadlock detected: user= $sUser; errno=$iMySqlErrorNo";
$aLogContext = array(
'userinfo' => $sUser,
'errno' => $iMySqlErrorNo,
'ex_msg' => $e->getMessage(),
'callstack' => $e->getTraceAsString(),
'data' => $sInnodbStatus,
);
DeadLockLog::Info($sMessage, $iMySqlErrorNo, $aLogContext);
IssueLog::Error($sMessage, LogChannels::DEADLOCK, $e->getMessage());
}
/**
* If nested transaction, we are not starting a new one : only one global transaction will exist.
*
* Indeed [the official documentation](https://dev.mysql.com/doc/refman/5.6/en/commit.html) states :
*
* > Beginning a transaction causes any pending transaction to be committed
*
* @internal
* @see m_iTransactionLevel
* @since 2.7.0 N°679
*/
private static function StartTransaction()
{
$aStackTrace = debug_backtrace(DEBUG_BACKTRACE_PROVIDE_OBJECT , 3);
$bHasExistingTransactions = self::IsInsideTransaction();
if (!$bHasExistingTransactions)
{
IssueLog::Trace("START TRANSACTION was sent to the DB", LogChannels::CMDB_SOURCE, ['stacktrace' => $aStackTrace]);
self::DBQuery('START TRANSACTION');
} else {
IssueLog::Trace("START TRANSACTION ignored as a transaction is already opened", LogChannels::CMDB_SOURCE, ['stacktrace' => $aStackTrace]);
}
self::AddTransactionLevel();
}
/**
* Sends the COMMIT to the db only if we are at the root transaction level
*
* @internal
* @see m_iTransactionLevel
* @throws \MySQLException
* @throws \MySQLHasGoneAwayException
* @throws \MySQLNoTransactionException if called with no opened transaction
* @since 2.7.0 N°679
*/
private static function Commit()
{
$aStackTrace = debug_backtrace(DEBUG_BACKTRACE_PROVIDE_OBJECT , 3);
$sCaller = 'From '.$aStackTrace[1]['file'].'('.$aStackTrace[1]['line'].'): '.$aStackTrace[2]['class'].'->'.$aStackTrace[2]['function'].'()';
if (!self::IsInsideTransaction())
{
// should not happen !
IssueLog::Error("No Transaction COMMIT $sCaller", 'cmdbsource');
throw new MySQLNoTransactionException('Trying to commit transaction whereas none have been started !', null);
}
self::RemoveLastTransactionLevel();
if (self::IsInsideTransaction())
{
IssueLog::Trace("Ignore nested (".self::$m_iTransactionLevel.") COMMIT $sCaller", 'cmdbsource');
return;
}
IssueLog::Trace("COMMIT $sCaller", 'cmdbsource');
self::DBQuery('COMMIT');
}
/**
* Sends the ROLLBACK to the db only if we are at the root transaction level
*
* The parameter allows to send a ROLLBACK whatever the current transaction level is
*
* @internal
* @see m_iTransactionLevel
*
* @throws \MySQLNoTransactionException if called with no opened transaction
* @throws \MySQLException
* @throws \MySQLHasGoneAwayException
* @since 2.7.0 N°679
*/
private static function Rollback()
{
$aStackTrace = debug_backtrace(DEBUG_BACKTRACE_PROVIDE_OBJECT , 3);
$sCaller = 'From '.$aStackTrace[1]['file'].'('.$aStackTrace[1]['line'].'): '.$aStackTrace[2]['class'].'->'.$aStackTrace[2]['function'].'()';
if (!self::IsInsideTransaction())
{
// should not happen !
IssueLog::Error("No Transaction ROLLBACK $sCaller", 'cmdbsource');
throw new MySQLNoTransactionException('Trying to commit transaction whereas none have been started !', null);
}
self::RemoveLastTransactionLevel();
if (self::IsInsideTransaction())
{
IssueLog::Trace("Ignore nested (".self::$m_iTransactionLevel.") ROLLBACK $sCaller", 'cmdbsource');
return;
}
IssueLog::Trace("ROLLBACK $sCaller", 'cmdbsource');
self::DBQuery('ROLLBACK');
}
/**
* @api
* @see m_iTransactionLevel
* @return bool true if there is one transaction opened, false otherwise (not a single 'START TRANSACTION' sent)
* @since 2.7.0 N°679
*/
public static function IsInsideTransaction()
{
return (self::$m_iTransactionLevel > 0);
}
/**
* @internal
* @see m_iTransactionLevel
* @since 2.7.0 N°679
*/
private static function AddTransactionLevel()
{
++self::$m_iTransactionLevel;
}
/**
* @internal
* @see m_iTransactionLevel
* @since 2.7.0 N°679
*/
private static function RemoveLastTransactionLevel()
{
if (self::$m_iTransactionLevel === 0)
{
return;
}
--self::$m_iTransactionLevel;
}
/**
* @internal
* @see m_iTransactionLevel
* @since 2.7.0 N°679
*/
private static function RemoveAllTransactionLevels()
{
self::$m_iTransactionLevel = 0;
}
public static function IsDeadlockException(Exception $e)
{
while ($e instanceof Exception) {
if (($e instanceof MySQLException) && ($e->getCode() == 1213)) {
return true;
}
$e = $e->getPrevious();
}
return false;
}
/**
*
* @deprecated 2.7.0 N°1627 use ItopCounter instead
*
* @param string $sTable
*
* @return int
@@ -638,6 +986,13 @@ class CMDBSource
return false;
}
/**
* @param $sSQLQuery
*
* @throws \CoreException
* @throws \MySQLException
* @throws \MySQLHasGoneAwayException
*/
public static function DeleteFrom($sSQLQuery)
{
self::Query($sSQLQuery);
@@ -646,17 +1001,21 @@ class CMDBSource
/**
* @param string $sSql
* @param int $iCol beginning at 0
* @param mysqli $oMysqli if not null will query using this connection, otherwise will use {@see GetMySQLiForQuery}
*
* @return string corresponding cell content on the first line
* @throws \MySQLException
* @throws \MySQLQueryHasNoResultException
* @since 2.7.5-2 2.7.6 3.0.0 N°4215 new optional mysqli param
*/
public static function QueryToScalar($sSql, $iCol = 0)
public static function QueryToScalar($sSql, $iCol = 0, $oMysqli = null)
{
$oMysqliToQuery = (is_null($oMysqli)) ? self::GetMySQLiForQuery() : $oMysqli;
$oKPI = new ExecutionKPI();
try
{
$oResult = self::$m_oMysqli->query($sSql);
$oResult = $oMysqliToQuery->query($sSql);
}
catch(mysqli_sql_exception $e)
{
@@ -696,7 +1055,7 @@ class CMDBSource
$oKPI = new ExecutionKPI();
try
{
$oResult = self::$m_oMysqli->query($sSql);
$oResult = self::GetMySQLiForQuery()->query($sSql);
}
catch(mysqli_sql_exception $e)
{
@@ -778,7 +1137,7 @@ class CMDBSource
{
try
{
$oResult = self::$m_oMysqli->query($sSql);
$oResult = self::GetMySQLiForQuery()->query($sSql);
}
catch(mysqli_sql_exception $e)
{
@@ -914,6 +1273,134 @@ class CMDBSource
return false;
}
/**
* There may have some differences between DB ! For example in :
* * MySQL 5.7 we have `INT`
* * MariaDB >= 10.2 you get `int DEFAULT 'NULL'`
*
* We still need to do a case sensitive comparison for enum values !
*
* A better solution would be to generate SQL field definitions ({@link GetFieldSpec} method) based on the DB used... But for
* now (N°2490 / SF #1756 / PR #91) we did implement this simpler solution
*
* @see GetFieldDataTypeAndOptions extracts all info from the SQL field definition
*
* @param string $sDbFieldType
*
* @param string $sItopGeneratedFieldType
*
* @return bool true if same type and options (case sensitive comparison only for type options), false otherwise
*
* @throws \CoreException
* @since 2.7.0 N°2490
*/
public static function IsSameFieldTypes($sItopGeneratedFieldType, $sDbFieldType)
{
[$sItopFieldDataType, $sItopFieldTypeOptions, $sItopFieldOtherOptions] = static::GetFieldDataTypeAndOptions($sItopGeneratedFieldType);
[$sDbFieldDataType, $sDbFieldTypeOptions, $sDbFieldOtherOptions] = static::GetFieldDataTypeAndOptions($sDbFieldType);
if (strcasecmp($sItopFieldDataType, $sDbFieldDataType) !== 0)
{
return false;
}
if (strcmp($sItopFieldTypeOptions, $sDbFieldTypeOptions) !== 0)
{
// case sensitive comp as we need to check case for enum possible values for example
return false;
}
// remove the default value NULL added by MariadDB
$sMariaDbDefaultNull = ' DEFAULT \'NULL\'';
if (utils::EndsWith($sDbFieldOtherOptions, $sMariaDbDefaultNull))
{
$sDbFieldOtherOptions = substr($sDbFieldOtherOptions, 0, -strlen($sMariaDbDefaultNull));
}
// remove quotes around default values (always present in MariaDB)
$sDbFieldOtherOptions = preg_replace_callback(
'/( DEFAULT )\'([^\']+)\'/',
function ($aMatches) use ($sItopFieldDataType) {
// ENUM default values should keep quotes, but all other numeric values don't have quotes
if (is_numeric($aMatches[2]) && ($sItopFieldDataType !== 'ENUM'))
{
return $aMatches[1].$aMatches[2];
}
return $aMatches[0];
},
$sDbFieldOtherOptions);
if (strcasecmp($sItopFieldOtherOptions, $sDbFieldOtherOptions) !== 0)
{
return false;
}
return true;
}
/**
* @see \self::GetEnumOptions() specific processing for ENUM fields
*
* @param string $sCompleteFieldType sql field type, for example `VARCHAR(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT 0`
*
* @return string[] consisting of 3 items :
* 1. data type : for example `VARCHAR`
* 2. type value : for example `255`
* 3. other options : for example `CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT 0`
*
* @throws \CoreException
*/
private static function GetFieldDataTypeAndOptions($sCompleteFieldType)
{
preg_match('/^([a-zA-Z]+)(\(([^\)]+)\))?( .+)?/', $sCompleteFieldType, $aMatches);
$sDataType = isset($aMatches[1]) ? $aMatches[1] : '';
if (strcasecmp($sDataType, 'ENUM') === 0){
try{
return self::GetEnumOptions($sDataType, $sCompleteFieldType);
}catch(CoreException $e){
//do nothing ; especially do not block setup.
IssueLog::Warning("enum was not parsed properly: $sCompleteFieldType. it should not happen during setup.");
}
}
$sTypeOptions = isset($aMatches[2]) ? $aMatches[3] : '';
$sOtherOptions = isset($aMatches[4]) ? $aMatches[4] : '';
return array($sDataType, $sTypeOptions, $sOtherOptions);
}
/**
* @param string $sDataType for example `ENUM`
* @param string $sCompleteFieldType Example:
* `ENUM('CSP A','CSP (aaaa) M','NA','OEM(ROC)','OPEN(VL)','RETAIL (Boite)') CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci`
*
* @return string[] consisting of 3 items :
* 1. data type : ENUM or enum here
* 2. type value : in-between EUM parenthesis
* 3. other options : for example ' CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT 0'
* @throws \CoreException
* @since 2.7.4 N°3065 specific processing for enum fields : fix no alter table when enum values containing parenthesis
* Handle ENUM options
*/
private static function GetEnumOptions($sDataType, $sCompleteFieldType)
{
$iFirstOpeningParenthesis = strpos($sCompleteFieldType, '(');
$iLastEndingParenthesis = strrpos($sCompleteFieldType, ')');
if ($iFirstOpeningParenthesis === false || $iLastEndingParenthesis === false ){
//should never happen as GetFieldDataTypeAndOptions regexp matched.
//except if regexp is modiied/broken somehow one day...
throw new CoreException("GetEnumOptions issue with $sDataType parsing : " . $sCompleteFieldType);
}
$sTypeOptions = substr($sCompleteFieldType, $iFirstOpeningParenthesis + 1, $iLastEndingParenthesis - 1);
$sOtherOptions = substr($sCompleteFieldType, $iLastEndingParenthesis + 1);
return array($sDataType, $sTypeOptions, $sOtherOptions);
}
/**
* @param string $sTable
* @param string $sField
@@ -965,7 +1452,8 @@ class CMDBSource
}
elseif (is_string($aFieldData["Default"]) == 'string')
{
$sRet .= ' DEFAULT '.self::Quote($aFieldData["Default"]);
$sDefaultValue = static::RemoveSurroundingQuotes($aFieldData["Default"]);
$sRet .= ' DEFAULT '.self::Quote($sDefaultValue);
}
return $sRet;
@@ -1100,20 +1588,20 @@ class CMDBSource
* @return string query to upgrade table charset and collation if needed, null if not
* @throws \MySQLException
*
* @since 2.5 N°1001 switch to utf8mb4
* @since 2.5.0 N°1001 switch to utf8mb4
* @see https://dev.mysql.com/doc/refman/5.7/en/charset-table.html
*/
public static function DBCheckTableCharsetAndCollation($sTableName)
{
$sDBName = self::DBName();
$sTableInfoQuery = "SELECT C.character_set_name, T.table_collation
$sTableInfoQuery = "SELECT C.CHARACTER_SET_NAME, T.TABLE_COLLATION
FROM information_schema.`TABLES` T inner join information_schema.`COLLATION_CHARACTER_SET_APPLICABILITY` C
ON T.table_collation = C.collation_name
WHERE T.table_schema = '$sDBName'
AND T.table_name = '$sTableName';";
$aTableInfo = self::QueryToArray($sTableInfoQuery);
$sTableCharset = $aTableInfo[0]['character_set_name'];
$sTableCollation = $aTableInfo[0]['table_collation'];
$sTableCharset = $aTableInfo[0]['CHARACTER_SET_NAME'];
$sTableCollation = $aTableInfo[0]['TABLE_COLLATION'];
if ((DEFAULT_CHARACTER_SET == $sTableCharset) && (DEFAULT_COLLATION == $sTableCollation))
{
@@ -1136,7 +1624,7 @@ class CMDBSource
$sSql = "SELECT * FROM `$sTable`";
try
{
$oResult = self::$m_oMysqli->query($sSql);
$oResult = self::GetMySQLiForQuery()->query($sSql);
}
catch(mysqli_sql_exception $e)
{
@@ -1246,18 +1734,30 @@ class CMDBSource
return false;
}
/**
* @return string query to upgrade database charset and collation if needed, null if not
public static function GetClusterNb()
{
$result = 0;
$sSql = "SHOW STATUS LIKE 'wsrep_cluster_size';";
$aRows = self::QueryToArray($sSql);
if (count($aRows) > 0)
{
$result = $aRows[0]['Value'];
}
return intval($result);
}
/**
* @return string query to upgrade database charset and collation if needed, null if not
* @throws \MySQLException
*
* @since 2.5 N°1001 switch to utf8mb4
* @since 2.5.0 N°1001 switch to utf8mb4
* @see https://dev.mysql.com/doc/refman/5.7/en/charset-database.html
*/
public static function DBCheckCharsetAndCollation()
{
$sDBName = CMDBSource::DBName();
$sDBInfoQuery = "SELECT DEFAULT_CHARACTER_SET_NAME, DEFAULT_COLLATION_NAME
FROM INFORMATION_SCHEMA.SCHEMATA WHERE SCHEMA_NAME = '$sDBName';";
FROM information_schema.SCHEMATA WHERE SCHEMA_NAME = '$sDBName';";
$aDBInfo = CMDBSource::QueryToArray($sDBInfoQuery);
$sDBCharset = $aDBInfo[0]['DEFAULT_CHARACTER_SET_NAME'];
$sDBCollation = $aDBInfo[0]['DEFAULT_COLLATION_NAME'];

View File

@@ -1,35 +1,44 @@
<?php
// Copyright (C) 2010-2014 Combodo SARL
//
// This file is part of iTop.
//
// iTop is free software; you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// iTop 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 Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with iTop. If not, see <http://www.gnu.org/licenses/>
/**
* Copyright (C) 2010-2020 Combodo SARL
*
* This file is part of iTop.
*
* iTop is free software; you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* iTop 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 Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with iTop. If not, see <http://www.gnu.org/licenses/>
*/
/**
* Any extension to compute things like a stop watch deadline or working hours
* Any extension to compute things like a stop watch deadline or working hours
*
* @copyright Copyright (C) 2010-2012 Combodo SARL
* @license http://opensource.org/licenses/AGPL-3.0
*/
/**
* Metric computing for stop watches
* Metric computing for stop watches.
* Can be used for AttributeStopWatch goal (iTop XML node xpath: /itop_design/classes/class/fields/field/goal)
*/
interface iMetricComputer
{
public static function GetDescription();
/**
* @param \DBObject $oObject
*
* @return float number of seconds for the time limit
*/
public function ComputeMetric($oObject);
}
@@ -41,21 +50,21 @@ interface iWorkingTimeComputer
public static function GetDescription();
/**
* Get the date/time corresponding to a given delay in the future from the present
* considering only the valid (open) hours for a specified object
* @param $oObject DBObject The object for which to compute the deadline
* @param $iDuration integer The duration (in seconds) in the future
* @param $oStartDate DateTime The starting point for the computation
* @return DateTime The date/time for the deadline
* @param DBObject $oObject The object for which to compute the deadline
* @param integer $iDuration The duration (in seconds) in the future
* @param DateTime $oStartDate The starting point for the computation
*
* @return DateTime The date/time corresponding to a given delay in the future from the present
* considering only the valid (open) hours for a specified object
*/
public function GetDeadline($oObject, $iDuration, DateTime $oStartDate);
/**
* Get duration (considering only open hours) elapsed bewteen two given DateTimes
* @param $oObject DBObject The object for which to compute the duration
* @param $oStartDate DateTime The starting point for the computation (default = now)
* @param $oEndDate DateTime The ending point for the computation (default = now)
* @return integer The duration (number of seconds) of open hours elapsed between the two dates
* @param DBObject $oObject The object for which to compute the duration
* @param DateTime $oStartDate The starting point for the computation (default = now)
* @param DateTime $oEndDate The ending point for the computation (default = now)
*
* @return integer The duration (number of seconds) elapsed between two given dates, considering only open hours
*/
public function GetOpenDuration($oObject, DateTime $oStartDate, DateTime $oEndDate);
}
@@ -87,12 +96,7 @@ class DefaultWorkingTimeComputer implements iWorkingTimeComputer
}
/**
* Get the date/time corresponding to a given delay in the future from the present
* considering only the valid (open) hours for a specified object
* @param $oObject DBObject The object for which to compute the deadline
* @param $iDuration integer The duration (in seconds) in the future
* @param $oStartDate DateTime The starting point for the computation
* @return DateTime The date/time for the deadline
* @inheritDoc
*/
public function GetDeadline($oObject, $iDuration, DateTime $oStartDate)
{
@@ -113,11 +117,7 @@ class DefaultWorkingTimeComputer implements iWorkingTimeComputer
}
/**
* Get duration (considering only open hours) elapsed bewteen two given DateTimes
* @param $oObject DBObject The object for which to compute the duration
* @param $oStartDate DateTime The starting point for the computation (default = now)
* @param $oEndDate DateTime The ending point for the computation (default = now)
* @return integer The duration (number of seconds) of open hours elapsed between the two dates
* @inheritDoc
*/
public function GetOpenDuration($oObject, DateTime $oStartDate, DateTime $oEndDate)
{
@@ -134,6 +134,3 @@ class DefaultWorkingTimeComputer implements iWorkingTimeComputer
return $iDuration;
}
}
?>

File diff suppressed because it is too large Load Diff

Some files were not shown because too many files have changed in this diff Show More